File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,15 @@ The most common properties of an agent you'll configure are:
1313``` python
1414from agents import Agent, ModelSettings, function_tool
1515
16+ @function_tool
1617def get_weather (city : str ) -> str :
1718 return f " The weather in { city} is sunny "
1819
1920agent = Agent(
2021 name = " Haiku agent" ,
2122 instructions = " Always respond in haiku form" ,
2223 model = " o3-mini" ,
23- tools = [function_tool( get_weather) ],
24+ tools = [get_weather],
2425)
2526```
2627
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ class UserInfo: # (1)!
3636 name: str
3737 uid: int
3838
39+ @function_tool
3940async def fetch_user_age (wrapper : RunContextWrapper[UserInfo]) -> str : # (2)!
4041 return f " User { wrapper.context.name} is 47 years old "
4142
@@ -44,7 +45,7 @@ async def main():
4445
4546 agent = Agent[UserInfo]( # (4)!
4647 name = " Assistant" ,
47- tools = [function_tool( fetch_user_age) ],
48+ tools = [fetch_user_age],
4849 )
4950
5051 result = await Runner.run(
You can’t perform that action at this time.
0 commit comments