Skip to content

Commit d6b928b

Browse files
DeanChensjcopybara-github
authored andcommitted
chore: Returns agent state regardless if ctx.is_resumable
This allows state to be passing across agents Co-authored-by: Shangjie Chen <deanchen@google.com> PiperOrigin-RevId: 828557989
1 parent 744f94f commit d6b928b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/google/adk/agents/base_agent.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,16 @@ def _load_agent_state(
164164
ctx: InvocationContext,
165165
state_type: Type[AgentState],
166166
) -> Optional[AgentState]:
167-
"""Loads the agent state from the invocation context, handling resumption.
167+
"""Loads the agent state from the invocation context.
168168
169169
Args:
170170
ctx: The invocation context.
171171
state_type: The type of the agent state.
172172
173173
Returns:
174-
The current state if resuming, otherwise None.
174+
The current state if exists, otherwise None.
175175
"""
176-
if not ctx.is_resumable:
177-
return None
178-
179-
if self.name not in ctx.agent_states:
176+
if ctx.agent_states is None or self.name not in ctx.agent_states:
180177
return None
181178
else:
182179
return state_type.model_validate(ctx.agent_states.get(self.name))

0 commit comments

Comments
 (0)