Skip to main content
agent.conversation() returns a Conversation object that tracks message history across turns. Each .send() (or .stream()) call sees prior context automatically — you don’t manage the items array yourself.

Multi-turn

agent = Agent(name="note-assistant", instructions="...", tools=[save_note, list_notes])

conv = agent.conversation()

await conv.send("My name is Alice. Remember that.")
await conv.send("Save a note: buy groceries")
r = await conv.send("What's my name, and what notes have I saved?")

print(r.output)             # references Alice and the note
print(len(conv.get_items()))  # full message history

Streaming inside a conversation

conv.stream(input) works the same as agent.stream(input) — but the conversation accumulates the streamed turn into its history once .result() resolves.
stream = conv.stream("Summarize everything we discussed.")
async for event in stream:
    if event.type == "text_delta":
        print(event.text, end="", flush=True)
result = await stream.result()

Resetting

conv.clear() empties the history and starts fresh. There is no built-in persistence — serialize conv.get_items() / conv.getItems() yourself if you need to resume across processes.