Skip to content

Commit 68b61e6

Browse files
committed
docs: update ReadOnlyContext.state to use MappingProxyType with an improved docstring
1 parent c906245 commit 68b61e6

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/google/adk/agents/readonly_context.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@ def agent_name(self) -> str:
5353
return self._invocation_context.agent.name
5454

5555
@property
56-
def state(self) -> Mapping[str, Any]:
57-
"""The state of the current session. READONLY field."""
56+
def state(self) -> MappingProxyType[str, Any]:
57+
"""The state of the current session. READONLY field.
58+
59+
Note: This property returns a merged view of ephemeral request_state and
60+
persistent session.state using ChainMap. Changes to the underlying
61+
request_state or session.state dictionaries will be reflected through
62+
this view, but direct writes through this property are prevented.
63+
"""
5864
return MappingProxyType(
5965
ChainMap(
6066
self._invocation_context.request_state,

0 commit comments

Comments
 (0)