Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions python/packages/hosting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ agent = OpenAIChatClient().as_agent(name="Assistant")
state = AgentState(agent, session_store=FileSessionStore("storage/sessions"))
session = await state.get_or_create_session("conversation-1")
result = await (await state.get_target()).run("Hello", session=session)
await state.set_session("conversation-1", session)
```

`get_or_create_session(...)` returns a working copy. Save the updated session after
each successful run so the next request with the same id retains its state.

If a protocol mints a new continuation id on every response, store the session
explicitly after `run(...)` returns. `run(...)` may update the session, so store
the post-run object:
Expand Down
Loading