-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
Please read this first
-
Have you read the docs?Agents SDK docs
Yes. I've read it. -
Have you searched for related issues? Others may have faced similar issues.
Yes. Related issues don't exist.
Describe the bug
There is an error in the code block for the Basic Configuration Section in the Agents page.
The get_weather
is incorrectly declared. When I copy page the code to my local machine, it throws a syntax error:
Unindent amount does not match previous indentPylance
Reason for the error
There is an extra preceding space in the line:
"""returns weather info for the specified city."""
Debug information
- Agents SDK version: (e.g.
v0.2.10
) - Python version (e.g. Python 3.10+)
Repro steps
Added the get_weather
function from the documentation to my IDE Code
import asyncio
from agents import Agent, Runner, function_tool
from dotenv import load_dotenv
load_dotenv(override=True)
@function_tool
def get_weather(city: str) -> str:
"""returns weather info for the specified city.""" ### -> Error here
return f"The weather in {city} is sunny"
agent1 = Agent(
name="Haiku agent",
instructions="Always respond in haiku form",
model="o3-mini",
tools=[get_weather],
)
async def main():
result = await Runner.run(agent1, "New Delhi")
print(result.final_output)
if __name__ == "__main__":
asyncio.run(main())
Expected fix
Fix the code in the file agents.md
Expected behavior
It should show no error when I copy and paste the code from the Documentation to my IDE.
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation