Skip to main content

Installation

Framework adapters

Install only the adapters you need:

Your first contract test

Contract-test a two-agent handoff: the intake agent builds a vendor packet, and the security review agent consumes it. reagent-flow validates the shape of what flows between them.
If an upstream change renames contains_customer_pii to handles_personal_data, assert_handoff_matches fails with the exact path: handoff field 'data_access.contains_customer_pii': missing from data — attached to an Agent Stack Trace.

Run the test

What just happened?

1

Recorded the intake agent's work

The session context manager captured every tool call and result into a structured trace.
2

Validated the tool output

assert_tool_output_matches checked that extract_vendor_packet returned data matching the declared schema.
3

Linked the sessions

The security-review session declared parent_trace_id and handoff_context, creating a typed boundary between the two agents.
4

Enforced the handoff contract

assert_handoff_matches verified the data shape, assert_handoff_received confirmed the parent link, and assert_context_preserved checked that vendor_name survived the hop.

Trace privacy

reagent-flow stores traces locally in the configured trace_dir. Traces can include tool arguments, tool outputs, handoff payloads, and model responses. Use a temporary trace_dir in tests, keep .reagent/ out of git, and avoid logging raw secrets or full customer payloads. For fields that should never be written to trace files, pass redact_fields:
Redaction only affects the saved .trace.json file. In-memory assertions still validate the original values.

Next steps

Core Concepts

Understand sessions, traces, and the recording model.

Contract Testing

Learn how reagent-flow treats handoffs as contracts.

Framework Adapters

Auto-capture traces from OpenAI, Anthropic, LangChain, and more.

Vendor Onboarding Example

See a full multi-agent approval workflow with contract testing end-to-end.

Run in CI

Add reagent-flow contract tests to GitHub Actions.

Why Contract Testing?

Understand how reagent-flow differs from guardrails, structured outputs, and evals.