Run call is stateless — the agent has no memory of previous turns.
Use it for chat UIs, support bots, or any agent where the user sends several prompts in one session.
Enable
PassWithConversation with a conversation.Config:
Use
conversation.DefaultConfig(conv) for SDK defaults with no overrides.
Conversation history is prepended to every LLM call. Token usage grows with each turn — keep
Size as low as your task allows and call Clear at session end.Conversation ID
When conversation is enabled, pass the same session ID on every call to share history:Backends
Redis setup (local dev):
Remote workers
Use Redis on both the agent and worker processes. Pass the sameconversation.Config to NewAgent and NewAgentWorker. Set SaveOnIteration: true on the worker if external consumers need live history mid-run. See Distributed Execution for the full setup.
Lifecycle
You own the conversation store. CallClear(ctx, id) when ending a session — the agent never clears history for you.
With
SaveOnIteration: true on the worker, history is written after each tool round so external consumers can read it mid-run. Without it, history is written only when the run completes. Set it on the worker, not the agent.Custom backend
Implementinterfaces.Conversation:
IsDistributed() to true for any backend that can be shared across processes. The SDK uses this to validate compatibility with remote-worker deployments. Pass the implementation in conversation.Config.Conversation.
Example
Conversation
Redis-backed multi-turn history
Stream + Conversation
Streaming with persisted history
Related
Memory
Long-term facts across separate runs
Distributed Execution
Redis conversation with remote workers