Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ The most common properties of an agent you'll configure are:
```python
from agents import Agent, ModelSettings, function_tool

@function_tool
def get_weather(city: str) -> str:
return f"The weather in {city} is sunny"

agent = Agent(
name="Haiku agent",
instructions="Always respond in haiku form",
model="o3-mini",
tools=[function_tool(get_weather)],
tools=[get_weather],
)
```

Expand Down
3 changes: 2 additions & 1 deletion docs/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class UserInfo: # (1)!
name: str
uid: int

@function_tool
async def fetch_user_age(wrapper: RunContextWrapper[UserInfo]) -> str: # (2)!
return f"User {wrapper.context.name} is 47 years old"

Expand All @@ -44,7 +45,7 @@ async def main():

agent = Agent[UserInfo]( # (4)!
name="Assistant",
tools=[function_tool(fetch_user_age)],
tools=[fetch_user_age],
)

result = await Runner.run(
Expand Down