Tool Context
ToolContextdataclass
Bases:RunContextWrapper[TContext]
The context of a tool call.
Source code insrc/agents/tool_context.py
tool_nameclass-attributeinstance-attribute
The name of the tool being invoked.
tool_call_idclass-attributeinstance-attribute
The ID of the tool call.
tool_argumentsclass-attributeinstance-attribute
The raw arguments string of the tool call.
tool_callclass-attributeinstance-attribute
The tool call object associated with this invocation.
usageclass-attributeinstance-attribute
The usage of the agent run so far. For streamed responses, the usage will be stale until thelast chunk of the stream is processed.
from_agent_contextclassmethod
from_agent_context(context:RunContextWrapper[TContext],tool_call_id:str,tool_call:Optional[ResponseFunctionToolCall]=None,)->ToolContextCreate a ToolContext from a RunContextWrapper.