Web search
Give an agent a built-in tool for finding current information on the web.
Web search gives the Agent a built-in tool for finding current information. It does not require a managed environment and never allocates a Sandbox.
Enable web search
const agent = await client.beta.agents.create({
model: 'glm-5.3',
tools: [{ type: 'web_search' }],
});
Add it to a saved Agent or a Session the same way as any other tool. Omitting web_search from a Session's explicit tool override removes it, like any other tool.
Configure result size and domains
tools: [{
type: 'web_search',
context_size: 'high',
allowed_domains: ['docs.example.com'],
}]
context_size bounds both result count and snippet length: low (3 results, up to 1,000 characters each), medium (6 results, up to 2,000 characters), or high (10 results, up to 4,000 characters). It defaults to medium.
allowed_domains accepts up to 100 bare hostnames, matches their subdomains, and is enforced on the returned URLs. Omit it, or pass an empty or null list, to leave search unrestricted.
Current limits
mode: "cached" and a non-null location are rejected with 400; the current search provider does not implement cached-only search or location targeting. mode: "disabled" exposes no search tool to the model. Web search does not open full pages and does not return image content.
Read results
Search activity appears as a web_search_call item with a stable ID and output index, its search action, and added/done lifecycle events. A failed search reports incomplete status with its error, which is also returned to the model. Results enter the Session's history together with their source URLs.
Continue with MCP connections for external, credentialed tools.