← Back to Dashboard

OpenAI Agent SDK Demo

This page runs the weather tool example from the OpenAI Agents SDK, mirroring the minimal demo shipped with the project.

Sample code:

import asyncio

from agents import Agent, Runner, function_tool


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


agent = Agent(
    name="Hello world",
    instructions="You are a helpful agent.",
    tools=[get_weather],
)


async def main():
    result = await Runner.run(agent, input="What's the weather in Tokyo?")
    print(result.final_output)


if __name__ == "__main__":
    asyncio.run(main())

Learn more in the official OpenAI Agents SDK repository and docs:

GitHub: openai/openai-agents-python

Quickstart guide • Function tools documentation

Example adapted from `examples/basic/hello_world.py` plus function tool docs.

Run the weather demo to capture traces.