@vertz/agents is the AI agent layer of the Vertz stack. You define agents with typed state, tools, and LLM configuration — the framework runs a ReAct loop, validates inputs/outputs, and manages agent lifecycle. Same config-object pattern as entity() and service().
How it works
1
Define tools
Each tool has a description, input/output schemas, and a handler. The LLM sees the description
and schema to decide when to call the tool.
2
Define an agent
An agent combines state, tools, an LLM model, and lifecycle hooks into a single definition. The
framework manages the ReAct loop — observe, think, act, repeat.
3
Run the agent
Call
run() with a message and an LLM adapter. The agent iterates until it completes, gets
stuck, or hits the iteration limit.What’s included
Quick example
Core concepts
Config-object pattern
Every factory —tool(), agent(), workflow(), step() — takes a name and a config object, returning a frozen definition. This matches the Vertz convention used by entity(), service(), and createEnv().
ReAct loop
Agents use a Reasoning + Acting loop. Each iteration:- The LLM receives the conversation history and available tools
- It decides to call a tool or respond with text
- Tool results are added to the conversation
- The loop repeats until the LLM responds without tool calls
Stuck detection
If the agent makes no meaningful progress for N consecutive iterations (repeating the same tool calls), it’s considered “stuck.” TheonStuck behavior controls what happens: 'stop' (default), 'retry', or 'escalate'.
Frozen definitions
All factories return deeply frozen objects. You can’t mutate an agent or tool definition after creation — this prevents accidental state sharing between requests.Guides
Workflows
Multi-step pipelines with approval gates and agent coordination.