mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
Converts hanzo-agent from git submodule to regular directory. This enables simpler cross-package refactoring and unified CI/CD. Source: github.com/hanzoai/agent.git (a8d7ec9)
22 lines
556 B
Python
22 lines
556 B
Python
import asyncio
|
|
|
|
from openai.types.responses import ResponseTextDeltaEvent
|
|
|
|
from agents import Agent, Runner
|
|
|
|
|
|
async def main():
|
|
agent = Agent(
|
|
name="Joker",
|
|
instructions="You are a helpful assistant.",
|
|
)
|
|
|
|
result = Runner.run_streamed(agent, input="Please tell me 5 jokes.")
|
|
async for event in result.stream_events():
|
|
if event.type == "raw_response_event" and isinstance(event.data, ResponseTextDeltaEvent):
|
|
print(event.data.delta, end="", flush=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|