Strategy
A strategy is the orchestration entry point executed by the runtime. It is the entry of a Touba program: it declares in uses the agent (or strategy, skill, tool, function) it may invoke, then orchestrates execution in a do block.
Shape
strategy StrategyName
uses AgentName
do
AgentName
Simple Case
module examples.strategy_simple
type DatasetRequest
query is Text
type DatasetBrief
summary is Text
tool SearchDatasets
takes request as DatasetRequest
gives DatasetBrief
requires network
skill BuildDatasetBrief
takes request as DatasetRequest
gives DatasetBrief
uses SearchDatasets
do
SearchDatasets
with request as request
into result
give result
agent Researcher
responsibility "Fulfill the declared Researcher responsibility using only authorized capabilities."
uses BuildDatasetBrief
callable_by strategy RunDatasetResearch
strategy RunDatasetResearch
uses Researcher
do
Researcher
RunDatasetResearch is the only authorized caller for Researcher, explicitly declared by callable_by.
Advanced Case
module examples.strategy_advanced
type ChangeRequest
summary is Text
type ReviewedChange
summary is Text
tool ApplyChange
takes request as ChangeRequest
gives ReviewedChange
skill MakeChange
takes request as ChangeRequest
gives ReviewedChange
uses ApplyChange
do
ApplyChange
with request as request
into result
give result
skill ReviewChange
takes request as ChangeRequest
gives ChangeRequest
do
give request
agent Reviewer
responsibility "Fulfill the declared Reviewer responsibility using only authorized capabilities."
uses ReviewChange
callable_by strategy RunChangeReview
agent Engineer
responsibility "Fulfill the declared Engineer responsibility using only authorized capabilities."
uses MakeChange
callable_by strategy RunChangeReview
strategy RunChangeReview
takes request as ChangeRequest
uses Reviewer
uses Engineer
do
Reviewer
Engineer
A strategy can declare takes (the run input) and orchestrate several distinct agents. Each agent remains bounded by its own uses and is invocable here only because it declares callable_by strategy RunChangeReview.
Strategy vs Agent
- An
agentcarries responsibility for a choice among the capabilities it declares itself inuses. - A
strategycarries orchestration of the global sequence: which agents are requested, in which order, and with which input.
An agent may authorize a strategy or another agent through callable_by,
including qualified names. A strategy has no callable_by: it may be a
CLI/trigger entry or a typed capability invoked through with / into.
Its arguments and results stay separate from its caller's local values.
Composition and parallelism
Ordinary calls run in sequence. For independent inputs, a strategy or skill can
declare a parallel group over a typed local or imported target. This example
requires neither a handler nor a model:
module examples.batch_labels
strategy LabelTicket
takes ticket as Text
gives Text
do
give "Ticket: " ++ ticket
strategy LabelBatch
takes tickets as List of Text
gives List of Text
uses LabelTicket
do
parallel LabelTicket
each ticket in tickets
with ticket as ticket
max_concurrency 4
max_items 32
into labels
give labels
LabelBatch returns labels in the order of tickets, regardless of completion
order. An empty input returns an empty list; more than 32 items refuses the group
before its first call. The join waits for every result: failure never becomes
a successful partial list.
The same form accepts an agent, skill, function or tool with a declared output type. Run budgets remain shared while invocation data stays isolated. For providers, human pauses and recovery, follow the multi-agent tutorial.
Runtime Contract
- Execution is sequential outside an explicit
parallelgroup. max_concurrencyandmax_itemsbound the group; host ceilings and run budgets still apply.- A
strategydoes not bypassuses/callable_byon the agents it invokes: the runtime verifies these contracts at every call. - See Bounded Autonomy for the runtime control model on each agent invocation.