Answering

The answer node. Passages as top-level search_result blocks, citations streaming as they arrive, and no tools key in the request at all.


answer runs when either level’s route says the evidence holds. It sends that level’s passages and the question to the model with citations enabled, and streams the reply. answer_request_kwargs() in agent/templates/documents.py assembles the request.

The interesting part of that request is what is missing from it.


The flow

answer(state)
  │
  ├─ answer_request_kwargs()
  │     search_result blocks (passages first) + the question (last)
  │     system prompt (cache breakpoint) · history · no `tools` key
  ▼
Messages API (streaming, citations enabled)
  │  text_delta      ──▶ stream writer ──▶ SSE `text`
  │  citations_delta ──▶ stream writer ──▶ SSE `citation`, as it arrives
  ▼
collect_segments(response)              agent/common.py
  └─▶ state: answer · citations · segments · outcome="answer"

There is no tools key in the request. Not an empty list: the key never appears, and neither does the ticket tool’s name. A test asserts both on the real request.

collect_segments() lives in agent/common.py, beside the conversation and cost helpers, so the stored segments format has one owner.


A worked example

“My Cloud Run container fails to start — what does the PORT error mean?” A real run.

  • Level 1 passed it on similarity 0.62 and groundedness 0.95, with five passages.
  • The request goes out as five search_result blocks followed by the question, plus the system prompt. No tools.
  • The reply streams as text events, and a citation event each time the model attributes a claim. Two arrived.
  • The step records level: 1, n_citations: 2, and the guardrail’s sentence as its reasoning. The node took 2.5 s; the whole turn cost $0.026.

The follow-up in the same conversation reached this node from Level 2. Same request shape, built from the Level 2 passages instead, and a step with level: 2 and three citations.


Design decisions

The model has nothing to escalate with

Escalation is not this node’s decision, and the enforcement is structural rather than written down.

No tools key (built)Tools present, prompt says “don’t escalate”
Can it file a ticket?No, the capability is absentYes, if it decides to
Can it decline by escalating?NoYes, the easy out on any hard question
What enforces itThe API requestA sentence the model weighs against others
How you verify itAssert on the request in a testRe-run the evals and hope

Prompting a model not to do something it can do is a request. Removing the capability is a guarantee.

The request itself

  • search_result blocks go in as top-level user content. They do not have to arrive inside a tool_result, so retrieval can be a node with no tool involved.
  • Passages first, question last. The evidence is context; the question is the instruction.
  • Citations are enabled on every passage. The API requires them on all search results in a request or none.
  • The system prompt carries a cache breakpoint. It is inert on Haiku 4.5, whose minimum cacheable prefix is longer than answer.md. See Prompt Caching.
  • Deltas go through LangGraph’s stream writer. The node writes ("text", …) and ("citation", …) tuples, and stream_turn() forwards them unchanged. See SSE Streaming.
  • The response is assembled, not generated. Citations and output_config.format cannot be combined, so Python builds the final response from state.
  • This node never sees empty retrieval. Both decide functions require at least one passage before they route here.
  • An answer that cites nothing is visible, not blocked. n_citations: 0 on the step reads as a corpus problem rather than a wiring one.

Configuration

KeyDefaultWhat it does
agent.modelnoneThe model that answers. The same one grades
agent.max_tokens4096Cap on the streamed reply
agent.system_prompt_filenoneThe answer prompt. grade.md, rewrite.md and ticket_draft.md are resolved beside it

Citation payloads and how the frontend renders them: Citations.


Next: Handoff & Ticket, for the turn neither level could answer.