Skip to content

Commit 0d1d247

Browse files
authored
Enhance documentation for stateful conversations (#38247)
Add recommendation for session_service_factory in stateful conversations.
1 parent bfa7fb9 commit 0d1d247

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

sdks/python/apache_beam/ml/inference/agent_development_kit.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ class ADKAgentModelHandler(ModelHandler[str | genai_Content,
9696
batch. By default every invocation uses a fresh, isolated session (stateless).
9797
Stateful multi-turn conversations can be achieved by passing a ``session_id``
9898
key inside ``inference_args``; elements sharing the same ``session_id`` will
99-
continue the same conversation history.
99+
continue the same conversation history. When using stateful conversations,
100+
it is recommended to use a custom session_service_factory to provide a session
101+
service implementation which can be managed across multiple workers (e.g.
102+
:class:`~google.adk.sessions.DatabaseSessionService`). The default
103+
:class:`~google.adk.sessions.InMemorySessionService` will not correctly track
104+
the same session across multiple workers.
100105
101106
Args:
102107
agent: A pre-constructed :class:`~google.adk.agents.Agent` instance, or a

0 commit comments

Comments
 (0)