Quickstart: Run Your First Orchestration Strategy
Retrieve a built-in execution strategy and run it against a pair of agents.
from attune.orchestration import get_strategy
strategy = get_strategy("sequential")
result = strategy.execute(agents=[agent_a, agent_b], context={"task": "review"})
print(result)
Expected output: A StrategyResult object whose fields show each agent's contribution and the combined outcome.
Prerequisites
- The package is installed locally (
pip install -e .from the repo root) - You have at least two
AgentTemplateinstances to pass asagents
Step 1: Retrieve a strategy
Call get_strategy() with one of the built-in strategy names:
from attune.orchestration import get_strategy
strategy = get_strategy("sequential") # or "parallel", "debate", etc.
If you pass an unknown name, get_strategy raises ValueError and lists the available strategies.
Step 2: Execute the strategy
Pass your agents and a context dict:
result = strategy.execute(
agents=[agent_a, agent_b],
context={"task": "review", "target": "src/"},
)
Step 3: Register a custom strategy (optional)
To use your own ExecutionStrategy subclass, register it before calling get_strategy:
from attune.orchestration import register_strategy
from my_project.strategies import MyStrategy
register_strategy("my-strategy", MyStrategy)
strategy = get_strategy("my-strategy")
Step 4: Compose nested workflows
Register a WorkflowDefinition and reference it inside a NestedStrategy:
from attune.orchestration import register_workflow, get_strategy
from attune.orchestration import WorkflowDefinition, NestedStrategy
register_workflow(WorkflowDefinition(id="review-flow", ...))
strategy = NestedStrategy(workflow_ref="review-flow", max_depth=2)
result = strategy.execute(agents=[agent_a], context={})
print(result)
Expected output: A StrategyResult reflecting the resolved nested workflow execution.
Next: Read the full strategy reference — attune help-docs ref-orchestration — to see every built-in strategy, ConditionalStrategy, DelegationChainStrategy, and all constructor options.
Unresolved references
Auto-generated by attune-author fact-check. Review and either fix the source code, fix this doc, or add an override.
| Location | Severity | Issue |
|---|---|---|
| Line 57 (code fence) | error | from attune.orchestration import register_strategy — register_strategy not found in attune.orchestration |
| Line 57 (code fence) | error | from my_project.strategies import … — module not importable |