You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return Weather(city=city, temperature_range="14-20C", conditions="Sunny with wind.")
96
+
97
+
agent = Agent(
98
+
name="Weather Agent",
99
+
instructions="You are a helpful agent that can tell the weather of a given city.",
100
+
tools=[get_weather],
101
+
)
102
+
```
103
+
104
+
`ToolContext` provides the same `.context` property as `RunContextWrapper`,
105
+
plus additional fields specific to the current tool call:
106
+
107
+
-`tool_name` – the name of the tool being invoked
108
+
-`tool_call_id` – a unique identifier for this tool call
109
+
-`tool_arguments` – the raw argument string passed to the tool
110
+
111
+
Use `ToolContext` when you need tool-level metadata during execution.
112
+
For general context sharing between agents and tools, `RunContextWrapper` remains sufficient.
113
+
114
+
---
115
+
71
116
## Agent/LLM context
72
117
73
118
When an LLM is called, the **only** data it can see is from the conversation history. This means that if you want to make some new data available to the LLM, you must do it in a way that makes it available in that history. There are a few ways to do this:
0 commit comments