Documentation Index
Fetch the complete documentation index at: https://reagent-ai.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
What is contract testing?
In a multi-agent system, agents pass structured data to each other. A contract is the declared shape of that data — the fields, types, and values the downstream agent expects. Without contracts, schema drift is silent. An upstream team renames a field, the LLM adapts, tests pass, and the bug shows up in production as a wrong decision. reagent-flow makes these contracts explicit and testable:contains_customer_pii to handles_personal_data, this assertion fails at PR time with the exact field path:
Two types of contracts
Handoff contracts
Validate the data passed between agents viahandoff_context:
Tool output contracts
Validate the data returned by a tool within a single agent:What contracts catch
| Failure mode | Example | Contract that catches it |
|---|---|---|
| Renamed field | contains_customer_pii becomes handles_personal_data | assert_handoff_matches |
| Missing field | subprocessors dropped entirely | assert_handoff_matches |
| Wrong type | retention_days returns "30" instead of 30 | assert_handoff_matches or assert_tool_output_matches |
| Extra fields leaking | Internal notes added to the handoff | assert_no_extra_fields |
| Value changed | vendor_name mutated between hops | assert_context_preserved |
| Parent link broken | Child session not linked to parent | assert_handoff_received |
The multi-agent pattern
A typical contract-tested pipeline:Contracts are checked at test time using pytest, not at runtime. This keeps production behavior unchanged while catching drift in CI.
Why not guardrails or structured outputs?
See where contract testing fits alongside structured outputs, runtime guardrails, evals, and observability.