Meshes
Meshes tie together multiple Agents into a coherent, orchestrated system that can solve a larger task than any single agent. A Mesh is a graph of agent versions exchanging typed messages via Intents (entry points), Call Links (sub-task invocation) and Transfer Links (delegation or routing).
Designing an effective Mesh centers on three concerns:
- Decomposition: Partition the overall problem into narrowly scoped agents with focused instructions and input and output schemas.
- Data Flow: Define message schemas so each step receives only the information it needs to keep prompts small and grounded.
- Orchestration: Choose between Call Links (return control) and Transfer Links (delegate control) to model workflow structure, parallelism and specialization.
Quick Reference
Core Fields
| Field | Purpose | Guidance |
|---|---|---|
| Name | Mesh identifier | Keep concise; used in traces & and UI elements. |
| Description | Purpose & scope | Human readable description of the mesh's role and responsibilities. |
| Model Set | Routing rules reference | Associate set enabling complexity/tag-based profile selection. |
Intent Configuration
| Field | Purpose | Guidance |
|---|---|---|
| Intent Name | External entry point identifier | Stable API handle; use verbs/nouns meaningful to clients. |
| Intent Description | Usage conditions & outcomes | Documentation on when this intent should be used. |
| Target Agent | Processing agent version | A link to a specific agent version which will handle requests sent to this Intent. |
| Response Tools | Structured response types | Provide distinct schemas for different output modes; avoid generic catch-all types. See Message Schemas for more information. |
Call Link Configuration
| Field | Purpose | Guidance |
|---|---|---|
| Target Agent | Sub-task executor | The agent which will execute the sub-task. |
| Tool Name | Invocation cue to source agent | The tool name which will be exposed to the source agent to initiate the call to the target agent. Use a verb phrase similar to a method name describing the action the target agent will take. Avoid ambiguity - keep it short & action-oriented. |
| Tool Description | Guidance for when to call | Exposed to the source agent as instructions for calling the target agent. Include preconditions & input expectations. |
| Output Message Types | Potential structured results | Provide named schemas the target can choose from when returning to the source agent. These act like tools surfaced to the target agent. See Message Schemas for more information. |
Transfer Link Configuration
| Field | Purpose | Guidance |
|---|---|---|
| Target Agent | Successor controller | An agent which will replace the current agent and be responsible for continuing execution. Delegate when role permanently shifts. |
| Tool Name | Invocation cue to source agent | The tool name which will be exposed to the source agent to initiate the call to the target agent. Use a verb phrase similar to a method name describing the action the target agent will take. Avoid ambiguity - keep it short & action-oriented. |
| Tool Description | Criteria for delegation | Exposed to the source agent as instructions for calling the target agent. Include preconditions & input expectations. |
Versioning & Labels
Unlike Agents (which auto version on every edit), a Mesh always has a single mutable Draft. You edit the Draft; when ready you apply a Label to snapshot its current state. Each label creates an immutable Mesh Version accessible by its label name.
Typical flow:
- Edit the Draft (add intent, adjust links, swap agent versions).
- Smoke test via the Inference API targeting the Draft (no label) or a test label.
- Apply or update a label such as
stagingorprodto create an immutable snapshot for use in a particular environment.
Contained Entity Types
Meshes contain three entity categories. Understanding their roles is essential for proper decomposition.
Intent (entry point)
An Intent defines how external callers start a new Request within a Conversation. Each Intent selects one Agent Version to process its input and defines one or more output message types the agent can emit as a response.
Design Guidance
- Prefer multiple specific output types over one vague catch all to reinforce structured thinking.
- When an Intent can produce different “modes” of output (for example summary versus detailed analysis), use distinct output message types so downstream code can rely on shape instead of brittle free text parsing.
- Use grounding on fields where factual accuracy is critical (IDs, totals, compliance statements) to enforce provenance.
- Use different Intents for different types of request.
Call Link (sub-task invocation)
A Call Link connects a source agent version to a target agent version. The source can invoke the target as a tool and receive one of its defined output message types as a result. Control returns to the source after completion.
Design Guidance
- Use Call Links for synchronous, bounded work where the source continues orchestration after receiving structured results.
- Keep target input schemas minimal. Only provide data the target needs; the source can pre digest earlier context.
Transfer Link (delegation or routing)
A Transfer Link passes control from a source agent version to a target agent version. Unlike a call, control does not return. The target continues executing and can see the response tools originally available to the source (becoming its new active agent).
Design Guidance
- Use for router patterns (classification then delegate), skill specialization (general triage then expert), or long running workflows where specialization is clearer once context is gathered.
- Keep routing logic lightweight. The source agent’s purpose may just be deciding the best target.
- Avoid circular delegation chains. Design an acyclic progression of responsibility.
- If user interaction is required later, ensure the target agent has necessary user interaction flags enabled.
Selecting Call vs Transfer
| Scenario | Prefer | Rationale |
|---|---|---|
| Source needs structured sub result and continues orchestration | Call Link | Maintains local control and allows combining multiple sub results. |
| Source role is classification or routing | Transfer Link | Eliminates unnecessary return and simplifies trace. |
| Sub task may require user questions mid process while main agent should not resume | Transfer Link | Delegated agent can own interaction lifecycle. |
| Multiple parallel specialized analyses aggregated later | Call Link | Source can coordinate fan out and fan in. |
| Escalation to higher complexity model or expertise | Transfer Link | Representation shifts permanently to expert context. |
Model Routing via Model Sets
Associate a Model Set with the Mesh. Its rules evaluate each agent invocation complexity and tags to select an optimal Model Profile. Patterns:
- Cost optimization: Simple classification agents route to cheaper fast models. Complex synthesis agents route to higher capability models.
- Best of breed: Code generation agents tagged
coderoute to code tuned profiles. Summarizers taggedsummaryroute to models strong at compression. - Experimentation: Introduce a new profile behind a tag (
experimental) referenced by a small portion of traffic. Promote by removing the tag gate then re label the Mesh.
Security & Capability Partitioning
Follow the lethal trifecta mitigation: minimize any single agent having all three: (1) access to sensitive data, (2) untrusted input processing, (3) ability to change external state. Use Mesh links to ensure:
- Data gathering agents fetch and cite facts but cannot perform outbound actions.
- Action agents receive curated structured inputs (not raw user free text) reducing prompt injection risk.
- Validation agents apply grounding checks before action agents are invoked.
Call links help enforce review cycles (gather then validate then act). Transfer links enforce capability separation (triage then specialized executor) with a clear responsibility handoff.
Operational Tips
| Concern | Tip |
|---|---|
| Prompt bloat | Split overly large agents. Move ancillary operations into dedicated call link agents. |
| Hallucinations | Increase grounding coverage. Require citations for decisive fields. Ensure tools expose structured payloads. |
| Latency | Parallelize independent call links. Right size models. Minimize unnecessary transfer chains. |
| Debugging | Use traces to observe tool calls and grounding failures. Refine descriptions in output message types to reduce misuse. |
| Model drift | Encapsulate model choices in Model Set profiles. Re label the Mesh after modifying routing. Keep agent instructions stable to isolate model changes. |
When to Refactor a Mesh
Refactor when you see any of these symptoms:
- A single agent accumulating broad, multi paragraph instructions covering many tasks.
- Repeated large blobs passed through multiple call links untouched.
- Frequent hallucination or missing citation errors on specific fields. Consider introducing a dedicated validation agent.
- Model routing rules becoming complex. Consider splitting into multiple meshes per major workflow.
Summary
Meshes provide the structural backbone for scalable, observable, and trustworthy agentic workflows. By decomposing tasks, enforcing message structure and grounding, and labeling versions for controlled rollout, you can evolve AI systems with the same rigor as the rest of your stack.