What this stack is for
Run an agent and you get a mess of concurrent events. Tool calls, LLM round trips, handoffs between agents, retries, errors, all interleaved across servers. The trace looks like a wall of timestamps and tells you almost nothing about which call actually caused the failure.
PyRapide models that as causality. You declare rules like "every tool call must produce a result," and violations surface as violations instead of as something you notice three days later. When an error does land, you trace root causes back through the chain rather than reading upward through a log and guessing.
This is the manifesto point made concrete. A system that cannot show you why it produced an answer has not given you an answer.
Full disclosure: I wrote PyRapide, and I maintain it. It shows up in this curriculum because it's what I reach for, not because anyone paid for placement and not because the material depends on it.
Nothing here requires it. Every exercise that uses PyRapide has a plain-Python path, and if you skip it entirely you finish with everything the curriculum promises. If an author recommending his own library reads as a conflict to you, that's fair. Weigh it the way you'd weigh any other one.
It's at 0.3.0. Pre-1.0, MIT licensed, and the API can still move.
PyRapide is a Python library (pip install pyrapide) implementing the Stanford
RAPIDE causal-event specification: instead of a flat timestamped log, your agent's
events form a causal graph, so you can trace why a decision happened. It ships
eight adapters: AutoGen, LangGraph, CrewAI, LlamaIndex, Agno, OpenAI Swarm,
MetaGPT, and FlowiseAI.
Components
- Python 3.11+ — runtime
- PyRapide — causal event modeling, pattern constraints, analysis
- MCP — automatic causal linking for MCP-based agents
- Your agent framework — any of the eight adapters above
How the pieces fit
- The agent framework, via its PyRapide adapter, emits events as it runs
- PyRapide models those events as a causal graph instead of a flat log, linking each event to what caused it
- MCP-based tool calls are linked automatically, without extra instrumentation code
- Pattern constraints flag causal shapes you've defined as errors — e.g. a tool call without a preceding plan
- Analysis queries answer "why" questions after the fact: which decision led to this outcome, and what fed into it
Setup outline
- Install PyRapide with
pip install pyrapide(full walkthrough coming) - Wire the adapter for your agent framework — AutoGen, LangGraph, CrewAI, or one of the other five (full walkthrough coming)
- Confirm events are flowing into the causal graph (full walkthrough coming)
- Define pattern constraints for the failure modes you care about (full walkthrough coming)
- Query the causal graph to answer a real "why did it do that" question (full walkthrough coming)
What to hand your agent
Observability instruments questions, so tell the agent which ones you need answered:
- The full stack description above, plus which of the eight adapters applies to your framework
- The specific "why" questions you need answered, so pattern constraints can target them
- The instruction to treat the causal graph as the source of truth over any flat log already in place
Adaptation notes
- A flat structured log is enough until "why" questions start mattering more than "what"
- Any of the eight adapters can be swapped for another mid-project without re-instrumenting the whole agent
- MCP-based agents get causal linking "for free"; non-MCP tool calls need the adapter's explicit event calls