Documentation
¶
Overview ¶
Package webtools gives every Responses-API agent the three capabilities the platform already serves and no agent could reach: web search, page fetch, and deep research.
The registry held five time tools, so an agent asking to search the web had nothing to call — while /v1/websearch/search, /v1/crawl and /v1/ask were live the whole time. These are those endpoints as tools.
WHY EVERY BACKEND IS A SEAM. This package is a LEAF and must stay one: `object` imports `agent`, `agent` imports this registry, so a tool that reached into object for crawl closed the loop — agent → builtin_tool → web → object → agent — and the module stopped compiling. Search and research are served by the HOST (hanzoai/cloud), which imports this module, so they could never have been direct calls either. All three are installed from outside: crawl by this module's own bootstrap, search and research by the host at mount time, beside the balance and tier readers it already installs.
It is also the shape this codebase learned the hard way: the ai module once reached its own platform over api.hanzo.ai, which carries a customer credential and answered 401 to a service, and every completion fail-closed at 503 on a perfectly healthy pod. The edge is for customers; in-process is for us.
UNSET IS REFUSED, NEVER FAKED. A capability the host did not install answers that it is unavailable in this deployment. An agent told "no results" would conclude the web holds nothing on the subject and answer from memory — which is a fabricated answer with a confident tone. Absent and empty are different facts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotConfigured = errors.New("this capability is not available in this deployment")
ErrNotConfigured is what a tool answers when the host installed no backend for it. It names the deployment, not the query, so a model cannot read it as "nothing found".
Functions ¶
func SetResearch ¶
func SetResearch(f ResearchFunc)
SetResearch installs the host's deep research (nil clears it).
func SetSearch ¶
func SetSearch(f SearchFunc)
SetSearch installs the host's web search (nil clears it).
Types ¶
type FetchFunc ¶
type FetchFunc func(ctx context.Context, urls []string) ([]FetchResult, error)
FetchFunc fetches pages as Markdown. Installed by this module's bootstrap.
type FetchResult ¶
FetchResult is one fetched page, reduced to what a model can read and cite.
type FetchTool ¶
type FetchTool struct{}
func (*FetchTool) GetDescription ¶
func (*FetchTool) GetInputSchema ¶
type ResearchFunc ¶
ResearchFunc runs a grounded, multi-source investigation and returns the report with its citations inline. Installed by the host.
type ResearchTool ¶
type ResearchTool struct{}
func (*ResearchTool) Execute ¶
func (t *ResearchTool) Execute(ctx context.Context, args map[string]any) (*protocol.CallToolResult, error)
func (*ResearchTool) GetDescription ¶
func (t *ResearchTool) GetDescription() string
func (*ResearchTool) GetInputSchema ¶
func (t *ResearchTool) GetInputSchema() any
func (*ResearchTool) GetName ¶
func (t *ResearchTool) GetName() string
type SearchFunc ¶
SearchFunc runs a web meta-search. Installed by the host.
type SearchResult ¶
type SearchResult struct {
Title string `json:"title"`
URL string `json:"url"`
Snippet string `json:"snippet,omitempty"`
}
SearchResult is one web hit. Deliberately the smallest shape that is useful to a model: enough to cite, not enough to bloat a context window.
type SearchTool ¶
type SearchTool struct{}
func (*SearchTool) Execute ¶
func (t *SearchTool) Execute(ctx context.Context, args map[string]any) (*protocol.CallToolResult, error)
func (*SearchTool) GetDescription ¶
func (t *SearchTool) GetDescription() string
func (*SearchTool) GetInputSchema ¶
func (t *SearchTool) GetInputSchema() any
func (*SearchTool) GetName ¶
func (t *SearchTool) GetName() string