ServerToolDefinition#
Implement the model contract and normalize usage and stream output. See the guide.
- class zett_agent.model.ServerToolDefinition(type, configuration=<factory>)[源代码]#
Opaque provider-hosted tool configuration for one model request.
Unlike
ToolDefinition, a server tool is executed by the selected provider or gateway. The Agent must not dispatch it through its local tool loop or append a client-authoredToolMessagefor it.typeis the exact provider protocol discriminator, such asweb_search,web_search_20260318, oropenrouter:web_fetch.configurationcontains the remaining provider-specific fields. Keeping that configuration opaque avoids pretending that differently shaped and versioned server tools are interchangeable across providers.示例
Configure OpenRouter web fetch:
ServerToolDefinition( type="openrouter:web_fetch", configuration={ "parameters": { "max_uses": 4, "allowed_domains": ["docs.python.org"], } }, )
Configure Anthropic web search:
ServerToolDefinition( type="web_search_20260318", configuration={"name": "web_search", "max_uses": 5}, )
备注
Provider adapters validate whether they understand the requested type. A compatible gateway may accept types that the first-party provider does not, so this core model intentionally does not use a closed enum.
- 参数:
type (str)
configuration (Mapping[str, Any])
- type: str#
Exact tool type expected by the selected provider protocol.
- configuration: Mapping[str, Any]#
Provider-specific fields merged beside
typein the wire payload.