agora.fleet.orchestrator

Fleet orchestrator.

Three operating modes:

  1. Orchestrator.single_task() — spawn or find one agent, execute one task, return the result. State machine is bypassed.

  2. Orchestrator.run_project() — drive a project through the full phase state machine (INIT → ANALYSIS → ARCHITECTURE → IMPLEMENTATION → TESTING → REVIEW → DONE|loop-back).

  3. Orchestrator.run_flow() — instantiate a Flow and then run_project.

The orchestrator does not call the LLM or Matrix directly — it composes Dispatcher, AgentRuntime, RoomManager, and EventDispatcher.

Classes

Orchestrator

Top-level run driver: phase state machine + agent dispatch + observer.

ProjectResult

Aggregated outcome of one Orchestrator.run_project() call.

ReviewDecision

Outcome of the REVIEW phase poll / human approval.

class agora.fleet.orchestrator.ReviewDecision[source]

Bases: object

Outcome of the REVIEW phase poll / human approval.

approved=True advances the project to DONE. approved=False with return_to_phase set drives the loop-back path — the orchestrator re-opens the targeted phase, resets the relevant tasks to PENDING, and resumes execution. feedback is surfaced to the next agent’s prompt as a system-authored task comment.

approved: bool
feedback: str = ''
return_to_phase: ProjectPhase | None = None
__init__(approved, feedback='', return_to_phase=None)
class agora.fleet.orchestrator.ProjectResult[source]

Bases: object

Aggregated outcome of one Orchestrator.run_project() call.

success is the conjunction of every task’s postcondition outcome plus the review approval. task_results is in execution order; total_tokens aggregates input/output token counts (and cost_usd if a metered backend sets it) across all agents.

project: Project
success: bool
task_results: list[TaskResult]
total_tokens: dict[str, int]
duration_seconds: float = 0.0
project_room_id: str = ''
__init__(project, success, task_results=<factory>, total_tokens=<factory>, duration_seconds=0.0, project_room_id='')
class agora.fleet.orchestrator.Orchestrator[source]

Bases: object

Top-level run driver: phase state machine + agent dispatch + observer.

The orchestrator does not call the LLM or Matrix directly. It composes Dispatcher (agent assignment), AgentRuntime (per-task execution), RoomManager (room creation), and EventDispatcher (observer surface).

Three entry points: single_task() for a one-shot, run_project() for a full phase-state-machine run, and run_flow() to instantiate a declarative Flow and then run_project it.

Per-project work directories live under work_dir/<project_name>/ and are unified with the per-project git repo so auto-hook commits and the framework’s view of artefacts share one tree.

__init__(matrix_client, room_manager, llm_factory, work_dir, homeserver_name='agora.local', max_parallel_agents=3, vram_check=None, *, enable_observer=False, repo_root=None, knowledge_cache_dir=None, ollama_base_url, skip_warmup=False, warmup_deadline=600.0, keep_alive='30m', review_timeout_seconds=300.0, enable_web_fetch=False, fetch_timeout_seconds=30.0, fetch_max_bytes=1048576, fetch_max_text_bytes=16384, auto_hooks_enabled=False, plan_authoring_enabled=False, routed_retry_budget=2, tool_errors='raw', nudge_budget=0, review_budget=0, salvage_budget=0, observer=None)[source]
get_control(project_room_id)[source]

Return the live OrchestratorControl for a given project room, if any.

async single_task(agent_config, task, project_room_id=None)[source]

Spawn one agent, execute one task, return the result.

async run_project(name, agents, tasks, review_fn=None, max_loopbacks=2, staged_tasks=None, max_task_retries=0)[source]

Run a project through the state machine.

review_fn is called during REVIEW; the default auto-approves if all task postconditions passed. It may return a return_to_phase to trigger a loop-back.

staged_tasks maps task.id → StagedTask. Any task whose id is in the map is routed through the StageRunner instead of the one-shot AgentRuntime.execute_task() loop.

max_task_retries (default 0) is the number of in-phase retries a task is granted after a failed attempt. 0 preserves legacy behaviour (a single attempt, then the cross-phase max_loopbacks machinery takes over). With max_task_retries=2 each task gets up to 3 total attempts within the same phase; between attempts, auto-learnings and the narration redirect are injected so the retry sees the feedback immediately rather than waiting for the next phase boundary.

async run_flow(flow, project_name)[source]

Materialise a declarative Flow then run it.

Equivalent to instantiate_flow(flow, project_name) followed by run_project(). Use this when driving Agora from a YAML plan file (flows/*.plan.yaml); use run_project directly when agents and tasks are constructed in code.