Installation
Setup
Wrap your OpenAI client withpatch():
patch() wraps client.chat.completions.create to automatically log every LLM turn into the active reagent-flow session.
Basic usage
Tool result capture
When you send tool results back in the nextcreate() call, the adapter automatically attaches them to the turn that requested them:
JSON-encoded tool content is automatically decoded before validation, so
assert_tool_output_matches can validate dict/list shapes even when the content was serialized as a string.What gets captured
Streaming
Streaming (stream=True) is detected and skipped with a warning. Use stream=False for traced calls.
No session active
If no reagent-flow session is active whencreate() is called, the adapter is a no-op — the original call passes through unchanged.