RequestRecorder
Tool middleware that records each tool request the agent gets, for
CallSimulator.replay(). Add it to the agent with
agent.add_tool_middleware(recorder), or to one tool with
define_tool(..., middleware=[recorder]). It records the request,
then passes the call on unchanged.
The requests carry what the caller said and the call’s data. Keep a recording file where you’d keep call recordings.
Parameters
path
A file to append each request to, one JSON object a line. None keeps the
requests in memory only.
limit
Keyword-only. The most requests kept in requests, newest kept. The file isn’t
trimmed.
Properties
requests
The requests recorded, oldest first, each with function and argument set.
Methods
load
RequestRecorder.load(path) -> list[dict[str, Any]]
A static method that returns the requests a recorder wrote to path.
path
The recording file.