chat_model_start + llm_end) and each tool execution (tool_start + tool_end) is assembled into a single PairedEvent carrying agent identity, parent context, and paired payload.
Install
Initialise
ws_url at Adrian Cloud. The SDK’s own default is ws://localhost:8080/ws (a self-hosted backend), so set ws_url= or ADRIAN_WS_URL to wss://adrian.secureagentics.ai/ws for the hosted service.
Use the async pattern (
asyncio.run + await llm.ainvoke) rather than sync llm.invoke. The WebSocket transport runs on the asyncio loop, and sync llm.invoke returns before the loop has a chance to flush events.Configuration
All parameters are optional; unset values fall back to env vars, then defaults.Callbacks
Register any of the following onadrian.init(...) to observe the event and verdict stream. Sync or async callables are both accepted.
VerdictContext carries the event ID, session ID, original event type/data, run IDs, the classifier’s mad_code + escalate flag, the active policy snapshot, and a hitl field present only on dashboard-resolved verdicts.
PairedEvent shape
Each paired event is a dataclass serialised identically to JSONL and protobuf. Fields:LlmPairData carries the model name, full message list (chat_model_start input), output text, tool_calls, and token usage. ToolPairData carries the tool name, tool_call_id, input string, and output string.
Agent identity is derived from LangGraph’s langgraph_checkpoint_ns, producing stable paths like "reason", "director|team_lead|worker", "research_supervisor|supervisor_tools|1|researcher".
What’s captured
- Activity events. Tool calls, tool outputs, model inputs and outputs.
- Reasoning traces. The agent’s chain of thought, where the underlying model exposes it. Capture is passive; Adrian does not modify your system prompt.
Supported frameworks
- LangChain. Pinned to
langchain-core >= 1.2.19, < 2.0at launch. The Adrian callback handler attaches via the standard LangChain callback interfaces.
Known limitations
- Hidden chain-of-thought. Some model families (notably OpenAI’s GPT-O series) hide reasoning steps. Adrian captures whatever the framework exposes and works with or without model reasoning - reasoning simply improves detection accuracy.
- MCP visibility. MCP server names are captured via LangChain’s
mcp-adaptersintegration. Agents that bypassmcp-adaptersand use lower-level MCP client APIs directly will not have MCP server names captured at v1.

