orchestrator
orchestrator
¶
OrchestratorAgent — multi-turn agent with tool-calling loop.
Supports two modes:
- function_calling (default): Uses OpenAI-format tool definitions and
parses
tool_callsfrom the engine response. - structured: Uses a THOUGHT/TOOL/INPUT/FINAL_ANSWER text format (like ReAct) with a canonical system prompt from the orchestrator prompt registry. This is the format used by the SFT/GRPO training pipelines, making the Orchestrator a distinctive trainable agent type.
Classes¶
OrchestratorAgent
¶
OrchestratorAgent(
engine: InferenceEngine,
model: str,
*,
tools: Optional[List[BaseTool]] = None,
bus: Optional[EventBus] = None,
max_turns: Optional[int] = None,
temperature: Optional[float] = None,
max_tokens: Optional[int] = None,
mode: str = "function_calling",
system_prompt: Optional[str] = None,
parallel_tools: bool = True,
interactive: bool = False,
confirm_callback=None,
prompt_builder=None,
)
Bases: ToolUsingAgent
Multi-turn agent that routes between tools and the LLM.
Implements a tool-calling loop:
1. Send messages with tool definitions to the engine.
2. If the response contains tool_calls, execute them and loop.
3. If no tool_calls, return the final answer.
4. Stop after max_turns iterations.
In structured mode the agent instead uses a
THOUGHT: / TOOL: / INPUT: / FINAL_ANSWER: text protocol
identical to the format used by the orchestrator SFT/GRPO
training pipelines.