Define an agent
Create a file inagents/:
id is how you reference the agent later with getAgent("assistant").
Add tools
Agents call tools to take actions or fetch data. Reference tools by name; the framework resolves them from thetools/ directory:
maxSteps limits how many tool-call iterations the agent can perform per request. See Tools for how to define getWeather.
Connect to a route
UsegetAgent() to retrieve a registered agent and stream its response:
Non-streaming response
For server-side generation (e.g., ingetServerData), use generate():
Dynamic system prompts
Thesystem property accepts a string, a function, or an async function:
Agent configuration
| Property | Type | Description |
|---|---|---|
id | string | Unique identifier used with getAgent() |
model | string | Provider and model (e.g. "openai/gpt-4o", "anthropic/claude-sonnet-4-5-20250929") |
system | string | () => string | Promise<string> | System prompt |
tools | Record<string, boolean | Tool> | Tools the agent can use |
maxSteps | number | Max tool-call iterations per request |
memory | MemoryConfig | Conversation memory settings |
streaming | boolean | Enable streaming (default: true) |
middleware | AgentMiddleware[] | Execution middleware |
Next
- Tools: define the tools your agent calls
- Memory & Streaming: add conversation memory
Related
veryfront/agent: agent API reference