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.
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
| Data | Source | Logged as |
|---|---|---|
| Tool calls | response.choices[0].message.tool_calls | log_llm_call(tool_calls=...) |
| Response text | response.choices[0].message.content | log_llm_call(response_text=...) |
| Model name | response.model | log_llm_call(model=...) |
| Token usage | response.usage | log_llm_call(token_usage=...) |
| Tool results | {"role": "tool", ...} in next call’s messages | log_tool_result(...) |
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.