@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
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.
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.
What’s included
| Feature | Description |
|---|---|
| Tools | Typed units of capability with input/output schemas and handlers |
| Agents | Stateful ReAct agents with lifecycle hooks and stuck detection |
| Workflows | Multi-step sequential pipelines coordinating multiple agents |
| Approval gates | Human-in-the-loop steps that suspend and resume workflows |
| Agent-to-agent calls | Tools can invoke other agents via ctx.agents.invoke() |
| Session persistence | Store and resume agent conversations across requests |
| LLM adapters | Pluggable adapters for Cloudflare AI, OpenAI, Anthropic, MiniMax |
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.