ANSWER HUB
RunLedger for openai tool calls
RunLedger records and replays the tool calls your OpenAI-based agent requests.
Direct Answer
When the model selects a tool, emit a RunLedger tool_call event and wait for tool_result from the runner.
Quick Decision
| Use RunLedger when | Consider alternatives when |
|---|---|
| You can intercept tool selections. | You cannot modify your OpenAI agent loop. |
| You need deterministic replay in CI. | You only need live tool calls. |
| You want strict tool contracts. | You only care about final text output. |
Mapping
- Model chooses tool ? emit
tool_call. - Runner executes or replays ? returns
tool_result. - Agent continues until
final_output.
Example event
json
{"type":"tool_call","tool":"search_docs","args":{"query":"budget"}}
Tradeoffs
- Requires adapter code around tool selection.
- Strict matching can fail if tool args drift.
- Replay depends on cassette freshness.
When NOT to use RunLedger
Avoid if you cannot intercept tool calls or if every run must call live tools.