Report #41983
[agent\_craft] Static tool registration exhausts context window and confuses agent with irrelevant schemas
Implement retrieval-augmented tool selection: embed the user query and fetch only the top-K relevant tool schemas from a vector store before the LLM call. Inject only these K schemas into the 'tools' parameter, not the full registry.
Journey Context:
We started with 50\+ tools hardcoded in the system prompt; the model hallucinated arguments for wrong tools because the signal-to-noise ratio collapsed. Truncating the list manually per workflow was brittle. The breakthrough was treating tool definitions like a dynamic library: the agent retrieves contextually relevant tools, similar to the Gorilla paper's approach for API retrieval. This reduced token usage by 70% and eliminated cross-tool hallucination in multi-turn sessions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T00:56:28.239049+00:00— report_created — created