The LangGraph runtime that drives the agent’s per-turn execution. Reference for advanced integrators who want to embed Cogtrix programmatically or replace specific pipeline phases.
cogtrix_core.orchestration.runner
Top-level coordinator. Builds the graph, streams its execution, and returns the response.
Key symbols:
run_agent(...)— the per-turn entry point: build the graph, stream it, return the response string.extract_response(result, ...)— walk the message list back to the last assistant content.ToolCallLogger— tracks tool invocations bycall_idfor accurate per-call timing.
cogtrix_core.orchestration.graph
LangGraph definition. build_agent_graph() compiles a custom StateGraph: a core call_model → process_tools loop plus a verification layer of handler nodes that catch hallucinated completions, unverified claims, and phantom tool calls before the response is returned.
Key symbols:
build_agent_graph(config, registry, approvals, ...)— build and compile theStateGraph.ToolManagementRequest— dataclass describing on-demand tool add/remove requests.DEFAULT_RECURSION_LIMIT—90(roughly 45 tool calls).
cogtrix_core.orchestration.session_orchestrator
Snapshot/rollback semantics for model, mode, and session switches — captures mutable state before a switch and restores it if the switch fails.
Key symbols:
SessionOrchestrator.snapshot(...)— capture aSessionSnapshotof the current session.SessionOrchestrator.rollback(snap, ...)— restore a captured snapshot.SessionSnapshot— the captured state (model alias, memory mode/config, session, system prompt, tools).
cogtrix_core.orchestration.run_config
Per-run configuration that flows into run_agent() and build_agent_graph().
Key symbols:
AgentRunConfig— a@dataclassbundling the ~39 fields a run needs (LLM, tools, compression, ownership classifier, decision accountability, …). Imported from here for backward compatibility; the definition now lives incogtrix_core.common.types.