LangGraph is the primary framework integration in Idun Engine. It supports full AG-UI streaming, CopilotKit, and persistent checkpointing through in-memory, SQLite, or PostgreSQL backends.Documentation Index
Fetch the complete documentation index at: https://docs.idun-group.com/llms.txt
Use this file to discover all available pages before exploring further.
Code
agent.py
Config
config.yaml
How it works
The LangGraph adapter wraps yourStateGraph for production serving. Four stages, all driven by agent.config in config.yaml:
- Load.
graph_definitionis parsed as<file_path>:<variable_name>. The adapter resolves it as a file path first (relative or absolute), then falls back to a Python module import path (my_pkg.agent:graph). Both work. - Validate. The exported variable must be a
StateGraph. ACompiledStateGraphis accepted: the engine extracts.builderand recompiles with the engine-managed checkpointer and store, preserving anyinterrupt_beforeandinterrupt_afteryou supplied to.compile(). A warning is logged when this path is taken. - Compile. The engine compiles the
StateGraphwith the checkpointer configured inconfig.yaml(memory,sqlite, orpostgres) and wraps the result inLangGraphAGUIAgentfrom CopilotKit for AG-UI event streaming. - Serve. Chat requests POST to
/agent/runwith the AG-UI streaming protocol. The engine emits typed events (RUN_STARTED,TEXT_MESSAGE_CONTENT,TOOL_CALL_START,TOOL_CALL_ARGS,TOOL_CALL_END,STEP_STARTED,STEP_FINISHED,RUN_FINISHED) as SSEdata:lines.
StateGraph(state_schema) with a messages field is treated as chat; an explicit StateGraph(state, input_schema=..., output_schema=...) declares a structured contract.
Source: libs/idun_agent_engine/src/idun_agent_engine/agent/langgraph/langgraph.py.
Notes
Export the uncompiled
StateGraph. If you export a CompiledStateGraph (the result of .compile()), the engine extracts the original StateGraph via .builder and recompiles with the engine-managed checkpointer and store. Compile options like interrupt_before and interrupt_after are preserved. A warning is logged when this happens.Import type annotations directly. The engine introspects annotations when loading the graph.
from __future__ import annotations produces deferred string annotations (PEP 563), and the resolver raises NameError on names like Annotated at graph-build time.Always include a
checkpointer: block. LangGraph requires one at request time; requests fail with No checkpointer set when it is missing. Use type: memory for ephemeral state, type: sqlite or type: postgres for persistence. See Memory and checkpointing for LangGraph for backend options.Next steps
Memory and checkpointing details
Backend options and configuration for persistent state.
Guardrails
Add safety guards to your agent inputs and outputs.
Observability
Trace runs, monitor latency, and inspect token usage.
MCP Servers
Connect external tools through the Model Context Protocol.