Skip to content

antikythera.models ¤

Classes¤

Blueprint ¤

Blueprint(
    id: str,
    name: str,
    version: str | None = "1.0",
    description: str | None = None,
    tasks: list[Task] = None,
    **kwargs
)

Represents a complete blueprint.

Attributes:

  • id (str) –

    Unique identifier for the blueprint.

  • name (str) –

    A human-readable name for the blueprint.

  • version (str) –

    The version of the blueprint schema.

  • description ((str, optional)) –

    A human-readable description of the blueprint.

  • tasks ((list[Task], optional)) –

    A list of tasks that make up the blueprint.

  • scopes (list[Scope]) –

    Scope definitions derived from scope_start/scope_end task pairs.

Functions¤

validate ¤
validate() -> None

Validates the blueprint structure.

Raises:

BlueprintSession ¤

BlueprintSession(
    bsid: str,
    blueprint: Blueprint,
    inner_blueprints: dict[str, Blueprint] = None,
    state: BlueprintSessionState = PENDING,
    params: dict[str, str] = None,
    composite_to_inner_blueprint_map: dict[str, str] = None,
    blueprint_contexts: dict[str, Any] = None,
    scope_iterations: dict[str, int] = None,
)

Represents a session of the execution of a blueprint.

Attributes:

  • bsid (str) –

    The ID of the blueprint session.

  • blueprint (Blueprint) –

    The blueprint.

  • inner_blueprints ((dict[str, Blueprint], optional)) –

    A dictionary of inner blueprints used in this session.

Functions¤

get_context_for_blueprint ¤
get_context_for_blueprint(blueprint_id: str) -> dict | None

Returns the context for a given blueprint, if it exists.

BlueprintSessionState ¤

Enumeration of possible blueprint session states.

Dependency ¤

Dependency(id: str, type: DependencyType = FS)

Represents a dependency of a task on another.

Attributes:

  • id (str) –

    The ID of the task this task depends on.

  • type (DependencyType) –

    The type of dependency, by default DependencyType.FS (Finish-to-Start).

DependencyType ¤

Enumeration of possible dependency types.

ExecutionMode ¤

Enumeration of execution modes.

Scope ¤

Scope(
    id: str,
    label: str,
    task_ids: list[str] = None,
    end_task_id: str = "",
    policy_type: str = "skip",
    policy: dict = None,
)

A scope spanning a contiguous region of a blueprint's task DAG.

A scope is uniquely identified by the task ID of its opening (scope_start) task. An optional human-readable label can be provided via scope_start["name"].

Attributes:

  • id (str) –

    Identifier for this scope — the task ID of the scope_start task.

  • label (str) –

    Human-readable label for the scope.

  • task_ids (list[str]) –

    All task IDs that belong to this scope (including start and end).

  • end_task_id (str) –

    Task ID of the scope_end task that closes this scope.

  • policy_type (str) –

    One of "skip", "retry", or "while".

  • policy (dict) –

    Raw policy dict from task.scope_start.

SystemTaskType ¤

Enumeration of system task types.

Task ¤

Task(
    id: str,
    type: str,
    description: str | None = None,
    condition: str | None = None,
    inputs: list[TaskInput] = None,
    outputs: list[TaskOutput] = None,
    params: list[TaskParam] = None,
    depends_on: list[Dependency] = None,
    state: TaskState = PENDING,
    context: dict[str, Any] = None,
    scope_start: dict | None = None,
    scope_end: str | None = None,
    **kwargs
)

Represents a single task in a blueprint.

Attributes:

  • id (str) –

    Unique identifier for the task.

  • type (str) –

    The type of the task, which determines the agent that will execute it.

  • description ((str, optional)) –

    A human-readable description of the task.

  • inputs ((list[TaskInput], optional)) –

    A list of inputs for the task.

  • outputs ((list[TaskOutput], optional)) –

    A list of outputs for the task.

  • depends_on ((list[Dependency], optional)) –

    A list of dependencies on other tasks.

  • params ((list[TaskParam], optional)) –

    A list of task-specific parameters.

Functions¤

from_dynamic_task classmethod ¤
from_dynamic_task(dynamic_task: Task, new_task_id: str, element_id: str) -> Task

Creates a new dynamically expanded task from a composite task.

Parameters:

  • dynamic_task (Task) –

    The original composite task to expand.

  • new_task_id (str) –

    The ID for the new expanded task.

  • element_id (str) –

    The element ID to associate with the new task.

Returns:

  • Task

    The newly created expanded task.

then ¤
then(task: Task | list[Task], type: DependencyType = FS) -> Task | list[Task]

Adds a dependency from the given task(s) to this task.

Parameters:

  • task (Task or List[Task]) –

    The task(s) that will depend on this task.

  • type (DependencyType, default: FS ) –

    The type of dependency, by default DependencyType.FS.

Returns:

  • Task or List[Task]

    The task(s) that was passed in, to allow chaining.

TaskAllocationMessage ¤

TaskAllocationMessage(
    task_id: str, assigned_agent_id: str, timestamp: datetime | None = None
)

Task allocation message sent by orchestrator to agents.

TaskAssignmentMessage ¤

TaskAssignmentMessage(
    id: str,
    type: str,
    inputs: dict[str, Any] = None,
    output_keys: list[str] = None,
    params: dict[str, Any] = None,
    context: dict[str, Any] = None,
    timestamp: datetime = None,
    execution_mode: ExecutionMode = EXCLUSIVE,
)

Task assignment message sent by orchestrator to agents.

TaskClaimRequest ¤

TaskClaimRequest(task_id: str, agent_id: str, timestamp: datetime | None = None)

Task claim request sent by agents to orchestrator.

TaskCompletionAckMessage ¤

TaskCompletionAckMessage(
    id: str, state: TaskState, accepted_agent_id: str, timestamp: datetime | None = None
)

Task completion acknowledgement message sent by orchestrator.

TaskCompletionMessage ¤

TaskCompletionMessage(
    id: str,
    state: TaskState,
    outputs: dict[str, Any] = None,
    error: TaskError | None = None,
    timestamp: datetime | None = None,
    duration_ms: int | None = None,
    agent_id: str | None = None,
)

Task completion message sent by agents to orchestrator.

TaskError ¤

TaskError(code: str, message: str, details: Any | None = None)

Task error information.

TaskIO ¤

TaskIO(
    name: str,
    value: Any = None,
    type: str | None = None,
    description: str | None = None,
)

Base class for task inputs, outputs, and parameters.