Skip to main content
Veryfront supports two agent composition patterns:
  • Wrap agents as tools with agentAsTool or getAgentsAsTools.
  • Run agents as ordered workflow steps.
Use agent-as-tool when the parent should choose the order at runtime. Use a workflow when the order is known in advance. Each agent can omit model and use openai/gpt-5.4-nano, set "auto" for runtime selection, or set an explicit provider/model override when you need one.

Prerequisites

  • At least two agents in agents/ (see Agents).
  • A configured provider (see Providers).

Agent-as-tool

Convert an agent into a tool that another agent can call:
Provider-native web search uses the web_search tool name and requires a provider/model that supports it. Use providerTools for provider-executed tools. Use tools for local tools that your app defines.
getAgentsAsTools() wraps each agent as a tool. The orchestrator decides when to call each agent based on its system prompt. Each sub-agent runs its own tool loop independently.

Invoke the orchestrator

Expose the orchestrator through an AG-UI route:
Run the dev server and ask for an output that requires delegation:
The orchestrator receives the user message, then calls researcher and writer as tools when the model decides they are needed.

Single agent-as-tool

For wrapping a single agent:

Declarative delegation with delegates

A markdown agent can opt into orchestration by listing the specialists it may call in its delegates frontmatter. The runtime gives the agent one agent_{id} tool per delegate; each delegate runs with its own settings, skills, and tools - capability ownership does not cross the delegation boundary in either direction.
With several agents and no delegates, the agents are independent: a caller selects one by id. Self-delegation and delegate ids that cannot form a valid provider tool name are rejected at discovery with explicit diagnostics.

Workflow-based composition

For deterministic multi-agent pipelines, use workflows:
Start this workflow from an API route, task, or tool. The Workflows guide shows a copyable createWorkflowClient() start route.

When to use which

Agent-as-tool is more flexible but harder to predict. Workflows are deterministic and easier to debug.

Agent registry

All agents in agents/ are registered automatically. Access them programmatically:

Verify it worked

After wiring delegation, run a request against the orchestrator and watch the dev-server logs:
A working delegation:
  • Logs show the orchestrator calling each sub-agent in order.
  • The final AG-UI response contains output that could only come from the sub-agents (research output then writer output, for example).
For workflows, hit the workflow start route from Workflows and follow runId events instead.