State and flow¶
In one paragraph, for a non-engineer
Each step of the system can only see the information it needs. The step that classifies your question, for example, never sees any of your clinical data at all.
The real state model arrives in Phase 3; Phase 0 ships only a walking-skeleton state that exists to prove the streaming path.
Narrow projections¶
Every node receives a read-only projection of state rather than the whole blob.
| Node | Sees |
|---|---|
classify_intent |
The question and the patient's literacy level. No clinical content |
investigate |
The policy decision, the tool scope, evidence gathered so far |
extract_claims |
The draft answer only |
post_flight |
Draft, evidence records, pre-flight decision. Not the raw message history |
publish |
The judged answer and the policy record |
classify_intent not seeing clinical content is a deliberate privacy property,
not an optimisation.
Bounded loops¶
Both counted in state, both with a test asserting termination:
evidence_pass ≤ 1— one repair pass for uncited claimstool_calls ≤ max_tool_calls— plus a token and wall-clock ceiling
On breach the run terminates with a conservative templated response and the reason recorded. It never silently truncates a clinical answer.
Streaming¶
The API bridges astream_events to Server-Sent Events, one event per node. The
node filter is name == metadata["langgraph_node"], because conditional-edge
routing functions also emit on_chain_end carrying the source node in their
metadata under their own function name.
Graph state.
SkeletonState is the Phase 0 walking skeleton, kept so the streaming path
stays proven end to end. NavigatorState is the real state (docs/PLAN.md §5.1),
carrying the pre-flight decision, the scoped-executor output, and the draft.
The narrow per-node projections (§5.4) are enforced by what each node reads,
not by separate TypedDicts: classify_intent reads only the question and the
patient's literacy level — never clinical content — which is a deliberate,
defensible privacy property stated in the docs.
NavigatorState
¶
Bases: TypedDict
The real graph state (§5.1).
total=False because the state accumulates: intake sets the patient header,
the pre-flight gate sets the decision, investigate appends evidence, and
draft_answer sets the draft. Keys are present only after the node that owns
them has run.