Graph Node API

Reference for what an execution graph node receives in its prompt and settings, and which fields of its response the host reads.

This page is the field-level reference for a graph node's inputs and outputs. The Graph Executor explains dispatch, Graph Chat API the chat's side, and Graph Service API the functions that drive graphs.

Prompt🔗

A task-conversation node's prompt is built from these parts, in order:

PartForm
Agent definitionThe definition's prompt, as the turn's agent profile
RequestThe graph's request: the user's message, ending with "Complete clarification answer history (JSON data):" and the answers when the proposal took some; for directive nodes a host sentence when the turn has no unchanged user message
Objective and handoffs"Graph objective and exact bound results (JSON data):" then {"objective", "bound_results"}
Session documentThe document section, when it can be read
Continuation"Current instruction for this attempt:" and the continuation's text, on a later attempt
ImagesThe request's and replies' attachments, last

On a later attempt the node's earlier attempts and replies are also replayed as its conversation. Each bound_results entry is {reference, body}: body is the producer's complete saved response, and reference is the GraphResolvedInput {name, result}, whose result is the GraphResultRef {execution, graph_id, graph_revision, id, node_id, output_name, schema, version}, with execution {"TaskAttempt": {attempt_id, operation_id, task_id}} or {"UtilityRun": {run_id}}. A redelivered node keeps the inputs pinned at its claim.

ContinuationText after "Current instruction for this attempt:"
Retry"Explicitly retry this node's original request. Retain its exact bound inputs."
Answer"Explicit clarification answers (JSON data):" then [{"answer", "question"}]
Reply"Explicit user reply (JSON data):" then {"message"}
OrchestratorReply"Answer from the session's orchestrator, not the user (JSON data):" then {"message"}

The session document section states the document's version, how many of its 32 KiB it uses or that it is full, and how many entries it left out, then lists the entries since the newest replacement, oldest first, as one fenced JSON array within 16 KiB, each entry counted as its text plus 256 bytes. Each entry is {version, author, kind, text}: author is {"kind": "graph_node", execution_id, graph_id, node_id}, {"kind": "user"}, or {"kind": "main_chat"}, and kind is note or replace. Only text is the author's, escaped. The section ends by inviting up to 5 notes of at most 2048 bytes. From crates/agentty/src/app/session/workflow/session_document_test.rs, text shortened:

{"version":1,"author":{"kind":"graph_node","execution_id":"attempt-1","graph_id":"graph","node_id":"plan"},"kind":"note","text":"Done."}

Settings🔗

SettingValue
Working directoryThe session worktree, or the node's task worktree, shared with its children
PermissionsReadOnly for a reader; otherwise the definition's mode under the session's
ModelThe node's captured provider and model
Reasoning, style, speed, cachesThe session's reasoning level, response style, speed mode, and host caches
Task milestoneThe session's
Provider contextA fresh one for every attempt (AgentRequestKind::SessionStart)
Provider callsThe graph's shared budget, first call reserved before the claim
Tool environmentBuild job caps for a writer; none for a reader
Sandbox escapesSandboxEscapes::Unavailable
Orchestrator briefNone, so the node's directives are never honoured
Context compactionOff

A writer with SessionWorkflow post-processing commits its changes after the turn; nothing else a node does reaches the session's branch. A node cannot add nodes, children, or graphs: only an approved /graph proposal or an orchestrator directive can.

A fresh utility node gets one prompt of its definition's prompt, "Objective:", the request, and one Bound input `name` (untrusted result data): block per input, runs at ReasoningLevel::High, and answers under its response profile: UtilityPrompt ({"answer"}), FocusedReview, or ReviewMetadata. It reads no session document.

Response🔗

A task-conversation node answers with the session turn's AgentResponse, whose schema is crates/ag-protocol/schema/session_turn.all_properties.json:

FieldTypeRequiredDescription
answerstringyesMarkdown reply for the user: delivered work or its status. Put requests for input in questions instead.
graph_directivesarray of GraphDirectiveyesUp to 8 graph actions; empty unless the prompt holds an orchestrator-status block.
notesarray of stringyesShort notes for the session's shared document; empty unless the prompt invites them.
questionsarray of QuestionItemyesAt most 5 questions for the user; empty when no input is needed. Ask only to resolve an ambiguous requirement or a blocking design decision, never for permission to do agreed work ("Should I proceed?"), for sign-off ("Does this look good?"), or to confirm status: do agreed work and report it in answer.
review_comment_outcomesarray of ReviewCommentOutcomeyesAt most one outcome per forge thread ID the prompt supplies; empty when it supplies none or the turn asks questions.

The table above is the schema; this one is what the host does with a node's response:

FieldBoundsWhat the host does
answerNoneKept in the saved body
questionsNone enforced; the prompt asks for at most 5All are read; the node waits for answers, and effects and notes are skipped
notes5 per response, each 2 KiB; the document 32 KiBBlank ones skipped; the rest appended after effects, once per execution; a refused note gives one warning notice; removed from the saved body
graph_directivesNone; not applied for a nodeDropped
review_comment_outcomesNoneKept in the saved body; no forge effect

The saved body, the response without notes and graph_directives, is the node's output: one immutable result version per declared output, such as result for a directive node. A question-free success is validated by the host; acceptance, gates, and evidence are host records a node cannot write. A failed or unparsable turn saves no output and leaves the node's error. For the response {"answer":"Mapped it.","notes":["Parser lives in src/parse.rs."]} from crates/ag-protocol/src/parse_test.rs, the saved body is:

{"answer":"Mapped it.","questions":[],"review_comment_outcomes":[]}