Skip to main content

Search Tools page

The Search Tools page manages named search tools. Each search tool pairs a search provider with its API key, and the gateway uses it for the /v1/search/<search_tool_name> endpoint and for web search on models. Open the page at /ui/search-tools. It sits under AI Gateway in the left nav, inside the Tools group, as Search Tools.

The nav item has no role restriction, so every signed in role sees it unless an admin has limited the pages internal users can see with the UI setting enabled_ui_pages_internal_users. The page itself only checks that the session has a user ID and a role. Listing search tools and the provider list is open to internal users. Creating, updating, deleting and the connection test are refused by the proxy's role checks for every role except proxy admin. No license feature is checked on this page.

A real-world scenario​

An admin wants agents to search the web through the gateway without each team holding its own search key. They add one search tool from the Admin UI with the company's key, test the connection, and run a test query from the tool's details before announcing it.

Steps​

  1. Open Search Tools under Tools in the left nav, or go to /ui/search-tools.

  2. Click + Add New Search Tool, type a Search Tool Name such as web-search, pick the Search Provider, paste the API Key, and click Test Connection.

  3. Click Add Search Tool. The page calls:

    curl -X POST http://localhost:4000/search_tools \
    -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
    -d '{"search_tool": {"search_tool_name": "web-search", "spanway_params": {"search_provider": "tavily", "api_key": "<provider key>"}}}'
  4. Click the tool's ID to open its details and run a query with Test Search Tool, or from the command line:

    curl -X POST http://localhost:4000/v1/search/web-search \
    -H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" -d '{"query": "AI gateway"}'

Expected result​

A toast reads Search tool created successfully, the tool is listed with Source DB, and the test query returns results.

Search tools list​

The page is headed Search Tools with the line Configure and manage your search providers.

+ Add New Search Tool opens the add dialog. It is shown only to proxy admins, and is hidden from Admin Viewers.

The table sorts by Created At newest first, paginates in the browser with 25, 50 or 100 rows per page, and shows No search tools configured when there are none. When the proxy is set to deny search tools by default, the list can leave out tools that have not been granted to the caller.

ColumnMeaning
Search Tool IDThe tool's ID. Click it to open the tool details. Tools from the config file have no ID and show a dash. Sortable.
NameThe search tool name, which is what callers put in the search URL. Sortable.
ProviderThe provider's display name.
Created At and Updated AtDates. Sortable.
SourceDB for a tool saved from the dashboard or the API, Config for one defined in the config file.
ActionsA menu with Edit search tool and Delete search tool. Both are disabled for config tools, with a tooltip that says to edit the config file.

The row menu is shown to every role. The proxy refuses edits and deletes from anyone but a proxy admin.

Delete search tool opens a Delete Search Tool dialog with the tool's name, ID, provider and description. Click Delete to remove the tool or Cancel to keep it. It cannot be undone.

Add New Search Tool dialog​

FieldTypeWhat it does
Search Tool NameText, requiredA unique name for this configuration. It may contain only letters, numbers, hyphens and underscores.
Search ProviderCombobox, requiredThe provider, shown with its logo. The list comes from the proxy. Typing filters it, and No matching search providers shows when nothing matches.
API KeyPasswordThe provider API key. It is stored encrypted on the proxy.
Description (Optional)Text areaA short note about the tool.
ButtonWhat it does
Need Help?Opens the Spanway support page in a new tab.
Test ConnectionChecks that the provider and API key are filled, then opens Connection Test Results and runs a one result test query against the provider. It is a real provider call. It does not save the tool.
Add Search ToolSaves the tool. On success you see Search tool created successfully.

Closing the dialog clears the form.

Connection Test Results​

While the test runs you see Testing connection to followed by the provider. On success it shows that the connection to the provider was successful, with the test query and the number of results. On failure it says the connection failed and shows a short error, the error type, a Show Details link that reveals the full error, and a list of troubleshooting tips. View Search Documentation opens the search docs and Close closes the results.

Edit Search Tool dialog​

Edit search tool opens a dialog filled with the current values.

FieldTypeWhat it does
Search Tool NameText, requiredThe tool name.
Search ProviderSelect, requiredThe provider.
API KeyPasswordStarts empty with the placeholder "Leave blank to keep the current key". The help text reads "The saved key is never sent back to the browser. Leave this blank to keep it, or type a new key to replace it."
DescriptionText areaThe description.

OK saves the changes and Cancel discards them. A blank API Key keeps the stored key, and the gateway also keeps it if the masked value comes back. When you change a tool's api_base through the API, send the API key again in the same request, because the gateway refuses to send a stored key to a new address.

Search tool details​

Clicking a search tool ID opens its details. Back to All Search Tools returns to the list.

The header shows the tool name and ID, each with a copy button. Cards show the Provider, whether an API Key is set (**** or Not set), and Created At. A Description card appears when the tool has one.

Test Search Tool​

The Test Search Tool card sends a real search to the tool through the gateway's search endpoint, using your dashboard session. The provider bills the query.

ControlWhat it does
Query fieldType a query and press Enter or click Search. Search is disabled while the field is empty or a search runs.
ResultsThe latest search shows the query, the time, the number of results and the latency in milliseconds. Each result has its title as a link, an open in new tab button, the URL and the snippet. Snippets longer than 200 characters have Show more and Show less.
Previous SearchesShown after a second search. It lists up to five earlier searches with their result count, latency and time. Click one to put its query back in the field. Clear All empties the history.

Before the first search the card shows Test your search tool. A search with no results shows No results found. The history lives only in the page and is gone when you leave it.

Access defaults​

Below the search tool list, proxy admins who are not in view-only mode see an Access defaults card. It decides whether a caller may use a search tool nobody granted to it, and whether router fallbacks respect model access.

ControlWhat it does
Deny search tools by default (search_tool_deny_by_default)Off by default. Turn it on to stop keys from running paid web searches nobody approved. When on, a tool must be granted before it can be called: a virtual key needs the tool on the key and on its team, a team member without a key needs it on the team, and a user with neither needs it on the user. The unregistered search fallback is denied, and the master key and dashboard sessions are exempt. When off, every caller can use every search tool unless a grant narrows it.
Fallbacks respect model access (enforce_fallback_model_access)When on, router fallbacks only run on models the calling key, team and project may use, and a fallback target the caller may not use is skipped so the original error is returned. Fallbacks of a search request always check the search tool grants.

A row the config file sets is locked with "Set in the proxy config file. Change it there, the dashboard cannot override it." Save saves only the changed rows and shows "Access defaults saved". The card is hidden while a search tool's details are open.

Scenario: a team pays for a premium web search provider and wants only its own keys to use it. A proxy admin turns on Deny search tools by default and grants the tool to that team and to each of its keys under Allowed Search Tools, so every other key is refused.

  1. Open Search Tools and scroll to Access defaults.
  2. Turn on Deny search tools by default.
  3. Click Save.

Expected result: "Access defaults saved" appears, and a key without a grant gets a permission error when it calls the search tool. From the command line:

curl -sS -X POST "http://localhost:4000/config/field/update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
-d '{"field_name": "search_tool_deny_by_default", "field_value": true, "config_type": "general_settings"}'

Errors you may see when saving:

StatusMessageMeaning and fix
400Admin-only endpoint. Not allowed to access this.Only a proxy admin can change gateway settings. Sign in as one.
400A message that the key is set in the config fileThe setting is owned by config.yaml. The row shows "Set in the proxy config file" and is locked. Change it in the file and restart.
400DB not connected. This endpoint needs a database...The gateway has no database, so dashboard changes cannot be stored. Connect one, or set the value in config.yaml.

Each save writes an audit row for general_settings with the values before and after, when audit logs are on.

Empty, error and disabled states​

WhereWhat you seeWhat to do
Session missing a role or user IDMissing required authentication parameters.Sign in again.
No search toolsNo search tools configured.Add a search tool.
Create failsError creating search tool: followed by the error.A taken name answers 409 and an uncallable name or unknown provider 422, see Errors.
Update failsFailed to update search tool.Check that a name and a provider are set and that you are a proxy admin.
Delete failsFailed to delete search tool.Only proxy admins can delete. Config tools cannot be deleted here.
Test Connection with fields missingPlease fill in Search Provider and API Key before testing.Fill both fields.
Test search failsFailed to query search tool.Check the API key, the provider quota, and that your role can call the search endpoint.
Edit search tool and Delete search tool disabledThe tool comes from the config file.Change it in the config file.

Differences by role and license​

WhoWhat changes
Admin (proxy admin)Sees every control and every action works.
Admin ViewerSees the list and the details under the view-only banner. + Add New Search Tool is hidden. The row menu is still shown, but the proxy refuses its edit and delete actions.
Internal user and internal viewerSee the list. + Add New Search Tool is hidden, but the row menu is shown and the proxy refuses its actions. They can run the test search, which goes through the gateway's search endpoint like any other search request.
enabled_ui_pages_internal_usersWhen set, non admin users see the nav item only if search-tools is in the list.

No license feature gates this page.

Errors​

What you seeWhat it meansFix
No + Add New Search Tool buttonOnly proxy admins may add tools.Sign in as a proxy admin.
Edit and Delete are disabledThe tool comes from the config file.Change it in config.yaml.
The connection test fails with an authentication errorThe provider key is wrong.Fix the key and test again.
A search answers 403 with key_search_tool_access_denied or team_search_tool_access_deniedSearch tools are denied by default and the key, or its team, has no grant.Grant the tool on the key and on its team.
Saving a tool answers 401 with Authentication Error, Only proxy admin can be used to generate, delete, update info for new keys/users/teams. Route=/search_tools...Only proxy admins may create, change, delete or test search tools.Sign in as a proxy admin.
Creating or renaming a tool answers 409 with A search tool named <name> already exists. Pick another name or update the existing tool.Names are unique. This also happens when two admins save the same name at the same moment.Pick another name, or edit the existing tool.
A save, delete or list answers 500 with Could not save the search tool. The gateway log has the cause. (or delete, read, list the search tools, list the search providers)The database failed. The database's own message stays in the gateway log.Read the matching Error ... search tool log line, then retry.
Saving a tool answers 422 with search_tool_name may only use letters, numbers, hyphens and underscores ... or search_provider '<x>' is not supported. Use one of: ...The name could never be called as /v1/search/<name>, or the provider is unknown.Use a name like web-search and pick a listed provider.
Saving a tool answers 400 with The destination (api_base) changed while the stored secret (api_key) was left out or sent back masked. Re-enter the secret to use it with the new destination.A new api_base was saved with the masked key.Type the provider key again in the same save.

Logs​

LevelLineMeaningAction
ERRORError adding search tool to db: <error> or Error updating search tool: <error>A save failed and the page showed the fixed 500 text.Fix what the error names, usually the database.
ERRORSearch tool router refresh failed after a management write: <error>The tool was saved, but this gateway picks it up only on the next reload.None unless it repeats.

The log reference lists every search tool line.