Skip to content

Jobs, handoffs, and review#

A run has one job: the problem statement, the work done on it so far, and the deliverable. At any moment exactly one node holds the job. The job starts on the entry node, moves only along handoff edges, and ends when a node that holds Done accepts it. This page explains how the job moves, what is checked when it moves, how review works, and how to bring a graph written for an older version of adda up to date.

Two kinds of edge#

An edge in a graph is a permission, not a step that runs. It comes in two kinds:

Edge Tool it grants the source What happens
Edge(a, b) Delegate a gives b a task. b works on a copy of itself and returns a report. a keeps the job.
Edge(a, b, handoff=True) Handoff a passes the job to b. b holds the job from then on, and a stops.

The same pair of nodes can have both kinds. The default graph has Edge("strategizer", "critic") for find-only feedback, and handoff edges in both directions for review:

from adda import Edge

edges = (
    Edge("strategizer", "critic"),                # ask for feedback
    Edge("strategizer", "critic", handoff=True),  # pass the job for review
    Edge("critic", "strategizer", handoff=True),  # hand it back
)

A node gets the Handoff tool only when it has a handoff edge out. A graph with no handoff edge keeps the job on the entry node for the whole run, so the entry must hold Done (see A graph must be able to close).

Job ownership#

The node that holds the job is the owner. Only the owner can call Handoff or Done. Another node that calls either one gets an error that names the current owner.

Every period during which one node holds the job is a tenure, recorded as a row in debug/delegation_log.jsonl with an X### id and phase: "handoff":

  • The run start opens X001, from human to the entry node. A resumed run reopens it.
  • Each handoff closes the sender's tenure with status HANDED_OFF and opens a new id for the receiver.
  • The close records the last tenure as DONE (accepted) or CLOSED, with its evaluation count and a workspace commit.

The owner's evaluations are stamped with its tenure id, the same way a delegation's evaluations carry its D### id. So every row in the store traces back to the node that produced it, whether that node was delegated to or held the job.

Other nodes reach the owner with SendMessage(to="owner", ...). The run's clock, its budget notices and the wind-down follow the owner, not the entry node.

Release checks#

Done enforces four checks, in this order:

  1. The required deliverables exist in the study directory. pipeline.ipynb is required only when pipeline_deliverable is on and some node in the graph holds the notebook tools. Files listed under required_deliverables are always required.
  2. The deliverable format.
  3. The milestones.
  4. The reproduction gate, when it is on.

Done is refused while a check fails, and the result names the check and its output. If the reproduction gate runs out of attempts, the run closes FAILED.

A handoff to a node that holds Done runs the same checks but is never refused by them. If a check fails, the job still moves. The receiver reads a "Release checks on the work you received" notice in the handoff message, and the sender's Handoff result reports the same failures. The handoff spends none of Done's reproduction attempts.

When every check passes on a handoff, adda records a fingerprint of pipeline.ipynb, the required deliverables and the store. The receiver's Done skips the checks while that fingerprint is unchanged.

A handoff is also refused while the sender still has delegations running.

Review and closing#

In the default graph, review is part of the topology. The strategizer holds no Done. When the deliverable is ready, it hands the job to the critic. The critic then either:

  • accepts with Done(summary). The run closes GATED.
  • hands the job back with Handoff("strategizer", review). The strategizer owns the job again and the review is in its tool result.

Each review round, accepted or handed back, is written to debug/critic_reviews/call_NNN.md. The outcome is read from the Done and Handoff records (RUN_CLOSED.accepted in diagnostics.jsonl, and accepted_by in run_status.json), never parsed from the review text. A node that hands the job back starts its next review from its thread, which holds its earlier review.

A delegation to the critic over the plain edge asks for find-only feedback: the critic reports what it finds and nothing is accepted.

After the run closes, every node that held the job or ran as a woken node writes its own retrospective. The node that closed the run answers through Done. Each other node gets one more turn from its thread, without Done or Handoff, and its reply is recorded in debug/retrospectives.jsonl with the source id RETRO-<node>. The turn's transcript is debug/transcripts/RETRO-<node>.jsonl.

A graph must be able to close#

At load time, adda checks one rule: a directed path of handoff edges must lead from the entry to at least one node that holds Done. One such node is enough, and several are fine. The entry itself counts. If no such path exists, the run stops before it starts with an error that names the fix:

The job starts at planner and moves only along handoff edges; a delegation
returns a report but never passes the job. No handoff path leads from planner
to a node that holds Done (reviewer). Add a handoff path from planner to one
of them, e.g. Edge("planner", "reviewer", handoff=True), or give planner Done.

The check doesn't require an edge back from the reviewer. To let a reviewer reject the work, also add a handoff edge back to the node that sent it.

A graph in which no node holds Done is accepted only when every node holds tools: [Default] in config.yaml, or tools={"Default"} in Python: the backend's own tool loop. Such a graph closes when the entry's turn ends:

from adda import Agent, Graph

graph = Graph(nodes={"solo": Agent(tools={"Default"})}, edges=(), entry="solo")

A graph with any other node and no Done stops at load:

No node in this graph holds Done, so the run can never finish. Give Done to at
least one node (for a one-node graph, single_agent_graph(agent)).

The same check runs after every topology change during a run.

The wind-down#

When a budget reaches 100%, the owner writes the deliverable from what exists and then either calls Done or hands the job to the node that holds Done. The reproduction gate runs once. With a handoff, the receiver gets exactly one review, with no rework:

  • Done accepts the run.
  • A handoff back closes the run as not accepted. Its text is recorded as the review.

Core concepts describes the budgets that start the wind-down.

Threads: one conversation per node#

With node_threads on (the default), each node keeps one conversation for the whole run in debug/threads/<node>.jsonl. Each delegation to the node, each of its own turns, and each wake appends one block when it finishes. A new delegation starts from the node's thread, so a reviewer remembers its earlier review and a worker remembers what it already tried. The viewer shows a node's thread in its inspector. The runtime reference lists node_threads and node_thread_max_chars.

Woken nodes#

A node can also be woken by events of the run, such as a closed hypothesis, without holding the job. Each wake is a W### row in the delegation log, and a wake can never call Done or Handoff. Event subscriptions describes the events, the sync and async modes, and what a wake records.

A message sent with SendMessage(to="owner") waits on the node that holds the job and appears in that node's next tool result. If the node hands the job off before then, the message travels with the job: the receiver reads it in the handoff message, in the block headed "Messages to the job's holder." A message that no holder read by the time the run closes is recorded as an UNDELIVERED_MESSAGE row in debug/diagnostics.jsonl. The same applies to an async wake's message that no holder received.

Run record ids#

Id Row What it is
D### delegation A task one node gave another over a plain edge.
X### tenure (phase: "handoff") One node's hold of the job.
W### wake (phase: "wake") One wake of a subscribed node.

Node settings#

A node's nodes: entry in config.yaml, or the same attribute on its Agent class, accepts these keys:

Key What it sets
tools The node's tool list.
model, backend, base_url Which model serves the node.
base_prompt Default runs the node with no adda text.
derivation true marks its tasks as derivations, which the constraint screen never pauses.
ledgered_evaluations true applies the evaluation-ledger guards to it.
handbook_audience A list of tags that chooses which handbook entries it is offered.
subscribes The events that wake it, each sync or async.

Customize agents and tools has examples of each.

Prompt text by tool, not by name#

adda never chooses prompt text by a node's name or class. Two mechanisms put text in a node's prompt:

  • Include markers. [[include <block>]] pulls in one of adda's shared blocks, such as deliverable_format. See Shared prompt blocks.
  • Gates. [[if tool:Done]]…[[/if]] keeps its text only for a node that holds that tool. A node with a handoff edge out counts as holding Handoff. [[if subscribed:hypothesis_closed]] keeps text for a node that subscribes to that event ([[if subscribed:hypothesis_closed:sync]], in that mode), and [[if node:<name>]] keeps text while the graph contains that node. Every gate takes an optional [[else]].

A node's name is its only identifier. The role attribute is deprecated: Agent(role=...) and a role class attribute still load with a DeprecationWarning, and nothing reads the value. Remove them.

Removed settings and their replacements#

Removed Replacement
runtime: handoffs in config.yaml, or AgenticRun(runtime={"handoffs": ...}) in Python None needed. A handoff edge in the graph turns handoffs on. Delete the setting.
runtime: verdict_validator in config.yaml, or AgenticRun(runtime={"verdict_validator": ...}) in Python Delete the setting. To turn off the critic's verdict rulings, remove its hypothesis_closed subscription: nodes.critic.subscribes in config.yaml, or the critic agent's subscribes in Python. A run that still sets the knob stops at startup with this advice.
AskForFeedback tool Delegate to the critic over a plain edge.
The critic gate inside Done, its PASS/REVISE/REJECT parsing and the revise cap Review by handoff (see Review and closing).
reads_study_tree (config.yaml node key, or the Agent attribute in Python) None needed. Every node but the entry works from its delegation folder, and every node's preamble gives the run's absolute paths. A config or class that still sets it stops at load.
Topology(require_critic=...) Topology(check=True), which runs the closable-graph check.
gate_unparsed, termination: revise_cap, critic_verdict in run_status.json accepted_by and RUN_CLOSED.accepted. Old runs still carry the old fields.

Migrate a graph from an older version#

The shipped classes now carry the reviewed shape themselves: AdversarialCritiqueAgent holds Done and subscribes to hypothesis_closed and monitor_escalation (both async), and StrategizerAgent doesn't hold Done. default_graph() only adds the edges. A graph written for the old shape therefore stops at load with an error that names the fix, instead of running differently. If you wrote a custom graph for an older version of adda, check these points:

  • The critic on a plain edge only. The critic holds Done, but the job can't reach it, so the graph is refused. Add a handoff edge to the critic:

    graph = my_graph.with_edge("strategizer", "critic", handoff=True)
    

    To let the critic reject the work, also add a handoff edge back: .with_edge("critic", "strategizer", handoff=True).

    Or build from default_graph() and remove the nodes you don't want.

  • A graph with no critic, such as a single strategizer. No node holds Done, so the graph is refused. Build it with single_agent_graph(StrategizerAgent()), which gives its one node Done.

  • A subclass of AdversarialCritiqueAgent. It inherits Done and the two subscriptions. Set tools or subscribes on the subclass if it should not close the run or not be woken.

  • A custom Agent class with outgoing edges. It no longer gets RequestSpawn and Retire automatically. Add them to its tools if it should request topology changes. The shipped strategizer, data generator, implementer and test author declare them.

  • Prompts gated on a node. Text that described the critic gate with [[if node:critic]] should now gate on the tool it describes, for example [[if tool:Done]] or [[if tool:Handoff]].
  • Code or prompts that rely on role. role is deprecated and ignored; address a node by its name. Set the matching node key instead (derivation, ledgered_evaluations, handbook_audience), or add an include marker for the shared block the role used to receive. Read a record's node field; old runs have only role, which held the node name.
  • single_agent_graph node name. Without name, the node is named after the agent's class in snake case, without a trailing Agent: for example, AdversarialCritiqueAgent becomes adversarial_critique.
  • A config with a removed knob. See the table in Removed settings and their replacements.