Multi-agent composition
A multi-agent workflow need not be a free-form conversation. In Touba, a strategy orchestrates typed calls and each agent retains its responsibility, capabilities and authorized callers.
Choose the right unit
| Need | Unit |
|---|---|
| Deterministic calculation without effects | function |
| Reusable procedure composed of capabilities | skill |
| Autonomous choice among authorized capabilities | agent |
| Workflow order, branching and composition | strategy |
Do not create an agent just to call another declaration. A strategy can call
a typed sub-strategy with with / into.
Typed composition example
module examples.review_team
function PrepareBrief
description "Build a deterministic review brief from the supplied text."
takes brief as Text
gives Text
do
give "Review: " ++ brief
agent Reviewer
takes brief as Text
gives Text
responsibility "Prepare the supplied review brief using only the declared capability."
uses PrepareBrief
callable_by strategy ReviewOne
strategy ReviewOne
takes brief as Text
gives Text
uses Reviewer
do
Reviewer
with brief as brief
into reviewed
give reviewed
strategy ReviewBatch
takes briefs as List of Text
gives List of Text
uses ReviewOne
do
parallel ReviewOne
each brief in briefs
with brief as brief
max_concurrency 2
max_items 8
into reviews
give reviews
Each branch calls ReviewOne, which is authorized to invoke Reviewer.
The parent ReviewBatch does not receive the reviewer's capabilities.
This example does not perform an intelligent review: it demonstrates the
signature and call boundaries using a single pure capability.
Delegate and exchange data
An agent may invoke another agent when its uses and the recipient's
callable_by permit it. Pass an explicit business record and receive a
typed result. A call does not grant secret inheritance or implicit memory
or conversation sharing.
Multi-module imports let you split these declarations across modules. Imported targets undergo the same checks. A model proposes a call; it does not create an arbitrary callable target from a name supplied in a response.
Test compositions
Verify results, invocation refusals, shared budgets and resumption after a pause, not just each agent in isolation. An agent's own decision loop remains sequential; parallelism is declared by the workflow.
Follow the multi-agent tutorial for delegation, revisions and human validation, then the parallel guide for bounds and joining.