Dynamic tools ​
Dynamic tools let Anvia search a large tool catalog and send only the most relevant tool definitions to the model for each turn.
Explore dynamic tools ​
| Page | Learn how to |
|---|---|
| Tool sets | Group and execute concrete tool implementations. |
| Tool index | Build a searchable catalog and attach it to an agent. |
| Embedding text | Improve selection with accurate capability language. |
| Static and dynamic | Keep essential tools visible while retrieving the long tail. |
| Safety | Filter exposure and enforce authorization at execution. |
| Checklist | Verify relevance, permissions, and catalog freshness. |
Why retrieve tools ​
Static tools are included in every model turn. That is the right default for a small, stable set, but a large catalog increases prompt size and makes tool choice less focused.
Dynamic selection adds a retrieval step:
Current prompt
↓
Search embedded tool definitions
↓
Apply metadata filter and threshold
↓
Send selected definitions to the model
↓
Execute the chosen tool from the backing ToolSetThe model sees only selected definitions. The application still owns every concrete tool implementation.
Build a dynamic catalog ​
import { AgentBuilder } from '@anvia/core'
import { createToolIndex } from '@anvia/core/tool'
import { vectorFilter } from '@anvia/core/vector-store'
const toolIndex = await createToolIndex(
embeddingModel,
allSupportTools,
{
metadata(tool) {
return {
productArea: tool.name.startsWith('billing_')
? 'billing'
: 'support',
}
},
},
)
const agent = new AgentBuilder('billing-support', model)
.dynamicTools(toolIndex, {
topK: 6,
threshold: 0.72,
filter: vectorFilter.eq('productArea', 'billing'),
})
.build()Anvia searches again before every turn. Tool results can change the current runtime prompt, so a later turn may receive a different set of definitions.
Use it for scale, not authorization ​
Dynamic retrieval narrows the model-facing action surface. It does not prove that the user may execute a selected tool. Every handler must still validate input, enforce user and tenant permissions, protect side effects, and record sensitive actions.