Self-improving AI Employees for everyone
Context (context)
| Field | Value |
|---|---|
| Category | memory (config node on input-context) |
| Backend handler | server/nodes/context/__init__.py::AgentContextNode |
| Tests | server/tests/nodes/test_agent_context_node.py, server/tests/nodes/test_context_handlers.py, server/tests/services/agent_context/test_conversation.py |
| Skill (if any) | - |
| Dual-purpose tool | no |
Purpose
The opt-in switch and viewing panel for durable agent conversation.
Connecting output-context to an agent's input-context handle opts the
agent into the plain conversation store: one agent_conversations row per
(workflow_id, generation, agent_node_id), loaded at run start and saved
per turn, so every firing (chat messages AND taskTrigger reviews) continues
one conversation. The node carries no runtime state and declares no
parameters — the connection is the whole configuration. Normative
reference: agent_context_flow.md.
Inputs (handles)
| Handle | Connection type | Required | Purpose |
|---|---|---|---|
output-context → agent input-context |
context | yes | Opts the agent into conversation persistence |
Parameters
None (AgentContextParams is empty, extra="forbid").
Outputs (handles)
| Handle | Shape | Description |
|---|---|---|
output-context |
context (role context, top) |
The only declared handle; connects to an agent's input-context. hide_input_handle = True, hide_output_handle = False |
Class facts: component_kind = "model", group = ("memory",) (so
isConfigNode auto-derives), version = 2. The single
@Operation("policy") ignores its inputs and returns AgentContextOutput
({configured: true}, extra="forbid"); conversations stay in the store.
ui_hints: isContextPanel, systemManaged, hideInputSection,
hideOutputSection, hideRunButton — all True. systemManaged only
keeps the node out of the component palette; it does not protect it.
Behavior
- Lifecycle: an ordinary canvas node the user deletes like any other.
normalize_workflow_graphnever creates, reconnects or deletes one; the single exception is rewriting a legacysimpleMemory -> input-memoryedge, which adds a Context for an agent that has none. Save never restores a deleted Context, andworkflow_validatordoes not require one (noMISSING_CONTEXT). It still rejectsINVALID_CONTEXT_EDGE,MULTIPLE_CONTEXTSandSHARED_CONTEXT. Agent Builder'sadd_subagentwires a Context to the teammate it spawns. - Descriptor (
_descriptor.py): registered viaregister_agent_context_builder; emitskind: "context"+ workflow/generation identity. ReturnsNoneforgeneration <= 0(manual canvas Runs persist nothing — only Start admits a generation). - Persistence rides the agent pipeline, not this node:
agent.prepare_payloadloads (LOUD failures —ConversationLoadFailedretryable /ConversationTooLargenon-retryable at 1 MB),agent.execute_llm_stepsaves per turn best-effort; in-process via_AgentContextRuntime+ the loop'sconversation_saver; specialized providers viaSpecializedAgentContextBridge. - Panel (
isContextPaneluiHint →ContextPanel.tsx): shows the live generation only — role-tinted cards with per-messagetstimestamps, themed JSON trees for tool payloads, a Raw tab with the stored wires verbatim, and an agent selector when several agents share the node.refetchOnMount: 'always'. - WS handlers (
_handlers.py):get_agent_context(live generation, ownership-authorized),clear_agent_context(narrowable delete + warm-claude fence +context.updatedbroadcast). - Workflow Reset:
reset_execution_stateclears ALL of the workflow's stored conversations, terminates warm claude subprocesses, and broadcastscontext.updated— the generation bump alone would leave the panel rendering the pre-Reset conversation as live. - Events: one identity-only CloudEvent,
context.updated(_events.py), fired from the store's save listener (register_conversation_listener); the frontend invalidates['agentContext'].
Edge cases & known limits
- Deleting the node opts its agent out of persistence. The save's archive
outbox (
Database.save_workflowenqueues it for every Context id that leaves the graph) then clears ALL of the workflow's stored conversations, not just that agent's. - Deleting an agent leaves its Context node on the canvas, unconnected; nothing cascades.
- The palette does not offer the node (
systemManaged), so a deleted Context cannot be re-added from there. - Two agents on one Context node keep separate conversations (the key is
per agent node); the panel offers a selector. The validator nevertheless
rejects that wiring as
SHARED_CONTEXTat save, Run and Start. - A plain Stop → Start starts a fresh conversation (new generation) and leaves prior rows as inert, non-browsable history until Reset or workflow delete.
- Attaching a Context node must never change what the agent sends —
requests always build from
messages; the key only says where to save (the originalcontext_refregression, locked bytests/temporal/test_agent_workflow.py::TestConversationIdentity).
Related
- Sibling:
simpleMemory("Memory") — explicit durable facts, not conversation history. - Architecture docs: agent_context_flow.md, TEMPORAL_ARCHITECTURE.md.