agora.core.flow
Reusable flow/package definitions — YAML-declared agent team + task graph templates.
Position: the on-disk (YAML) form of a project. load_flow() parses and
validates the YAML (with recursive include resolution) into an immutable
Flow; instantiate_flow() then materialises runtime
AgentConfig + Task objects the
orchestrator executes. Templates are serializable and finding-annotated; the live
objects are not.
- Load-time lints (fail early, before any model runs):
_lint_role_write_scope()— F2: fatally rejects a task assigned to a role that cannot write its ownoutput_path(delegates toagora.core.role_scope, the same oracle the runtime guard uses, so a clean lint guarantees a runnable write — the F1 collision cannot reach runtime)._lint_spec_channel()— F6: warns loudly when a task description CITES an external spec/doc the runtime will not deliver into the prompt (the specification-channel starvation that made a tester fabricate an API).
Functions
|
Concrete AgentConfigs + Tasks from a flow template, with |
|
Load, validate, and resolve includes for a flow YAML. |
|
Serialize a flow to YAML. |
Classes
A whole project template: the agent team plus its task graph, with two optional embedded contracts ( |
|
Typed postcondition reference resolved at instantiate time via the plan registry. |
|
Serializable description of a |
|
Serializable YAML row for one task; |
- class agora.core.flow.PostconditionRef[source]
Bases:
objectTyped postcondition reference resolved at instantiate time via the plan registry.
v2.0 plans use this in place of
postcondition_descriptionsso the declarative YAML can hold real postcondition semantics instead of free text.- __init__(name, args=())
- class agora.core.flow.StageTemplate[source]
Bases:
objectSerializable description of a
Stage.instructionis free-form text (rendered as a YAML block scalar) forkind="llm"stages.validationcallables are not supported in plan YAML — express them as task-level postconditions instead.kind="decision"stages have no LLM call at all. The framework postsquestion+optionsas a Matrix question-card, awaits the user’s answer via any of three surfaces (poll click, emoji reaction, or/agora decision <answer>chat command), and writes the chosen answer id tooutput_pathunder the task’s work_dir. Decision stages take ownership of the decision metadata so the LLM cannot paraphrase it — fixes the 7B deviation observed in live plan-builder runs.- __init__(name, instruction='', context_files=(), max_iterations=5, kind='llm', decision_id='', question='', options=(), output_path='', validation_args=(), hide_tools=())
- class agora.core.flow.TaskTemplate[source]
Bases:
objectSerializable YAML row for one task;
instantiate_flow()turns it into a runtimeTask. Postconditions are carried asPostconditionRef(resolved against the plan registry at instantiate time), so validation can happen before any predicate object exists. Thephase/blocking/order_afterfields mirrorTask’s phase-gate semantics (see that class for F5).- postconditions: tuple[PostconditionRef, ...] = ()
- stages: tuple[StageTemplate, ...] = ()
- __init__(id, assigned_to, description, depends_on=(), precondition_descriptions=(), postcondition_descriptions=(), postconditions=(), output_path='', stages=(), phase='', blocking=True, order_after=())
- class agora.core.flow.Flow[source]
Bases:
objectA whole project template: the agent team plus its task graph, with two optional embedded contracts (
brief,api_spec) that a plan-builder authors ONCE and propagates so downstream executors — which start in a fresh work_dir — ground on the same source of truth rather than re-imagining it (the coordination failure theapi_specfield kills).probe_versionstamps experiment provenance for probe flows.- agents: tuple[AgentConfig, ...]
- task_graph: tuple[TaskTemplate, ...]
- __init__(name, description, agents, task_graph, brief='', api_spec='', probe_version=None)
- agora.core.flow.save_flow(flow, path)[source]
Serialize a flow to YAML.
Uses version
2.0iff any task carries v2.0-only fields (typed postconditions, output_path, or stages); otherwise emits v1.0 for backward compatibility with existing fixtures.
- agora.core.flow.instantiate_flow(flow, project_name, variables=None, *, id_strategy='uuid')[source]
Concrete AgentConfigs + Tasks from a flow template, with
${var}substitution.Always-available variables:
project_name. Callers may pass more viavariables(e.g.{"repo_path": "./workspace/repo"}). Any${unknown}token in a string field raisesAgoraError.id_strategy:"uuid"(default, preserves v1.0 behavior): task ids become fresh UUIDs;depends_onis remapped."preserve"(used byagora.plan.loader): task ids are kept as the template’s string ids so a staged-task dict keyed by those ids still matches.
For tasks with typed
postconditions(v2.0 plans), each reference is resolved viaagora.plan.predicate_registry. Tasks with onlypostcondition_descriptionsfall back to the_always_truestub.