Skip to content

antikythera_orchestrator ¤

Classes¤

Orchestrator ¤

Orchestrator(session: BlueprintSession, broker_host='127.0.0.1', broker_port=1883)

Coordinates the execution of a blueprint.

The orchestrator is responsible for managing the state of a blueprint session, and coordinating the execution of tasks by agents.

Attributes:

Functions¤

await_completion ¤
await_completion(timeout: float | None = None) -> bool

Waits for the session to complete (succeed or fail).

Parameters:

  • timeout (float, default: None ) –

    The maximum time to wait in seconds.

Returns:

  • bool

    True if the session completed, False if the timeout was reached.

on_task_claim ¤
on_task_claim(message: TaskClaimRequest) -> None

Handles incoming task claim requests.

on_task_completed ¤
on_task_completed(message: TaskCompletionMessage) -> None

Handles incoming task completion messages.

pause ¤
pause() -> None

Pauses the orchestrator.

register_instance classmethod ¤
register_instance(instance: Orchestrator) -> None

Registers an orchestrator instance and tracks active instances.

reset_scope ¤
reset_scope(scope_name: str) -> list[str]

Reset all tasks in a scope and clear its iteration counter.

This is the user-initiated reset path (as opposed to the internal loop-policy reset done by _handle_scope_completion). It restores the full retry/iteration budget so the scope behaves as if it has never run.

Parameters:

  • scope_name (str) –

    The scope name (i.e. the task ID of the scope_start task).

Returns:

  • list[str]

    Sorted list of fully-qualified task IDs that were reset.

Raises:

  • KeyError

    If no scope with the given name exists in the registry.

reset_task_state ¤
reset_task_state(
    blueprint_id: str,
    task_id: str,
    include_downstream: bool = True,
    clear_outputs: bool = True,
) -> list[str]

Reset a task (and optionally its downstream dependents) to PENDING.

Parameters:

  • blueprint_id (str) –

    Blueprint ID of the task to reset.

  • task_id (str) –

    Task ID to reset (within the blueprint).

  • include_downstream (bool, default: True ) –

    If True, also reset tasks that depend on this task.

  • clear_outputs (bool, default: True ) –

    If True, clear task outputs in session storage.

Returns:

  • list[str]

    A list of fully-qualified task IDs that were reset.

skip_task_state ¤
skip_task_state(blueprint_id: str, task_id: str) -> list[str]

Skip a task and its inner blueprint tasks (if composite).

For composite tasks, all tasks in the inner blueprint are also recursively skipped. Downstream dependent tasks are NOT skipped.

Parameters:

  • blueprint_id (str) –

    Blueprint ID of the task to skip.

  • task_id (str) –

    Task ID to skip (within the blueprint).

Returns:

  • list[str]

    A list of fully-qualified task IDs that were skipped.

start ¤
start() -> None

Starts the orchestrator.

stop ¤
stop() -> None

Stops the orchestrator.

to_mermaid_diagram ¤
to_mermaid_diagram(title='Blueprint') -> str

Generate a mermaid-syntax diagram representation of the blueprint session.

Returns:

  • str

    Gantt chart representation of the blueprint session.