MCPcopy Create free account
hub / github.com/google/adk-python / _create_agent_state_event

Method _create_agent_state_event

src/google/adk/agents/base_agent.py:197–219  ·  view source on GitHub ↗

Returns an event with current agent state set in the invocation context. Args: ctx: The invocation context. Returns: An event with the current agent state set in the invocation context.

(
      self,
      ctx: InvocationContext,
  )

Source from the content-addressed store, hash-verified

195 return state_type.model_validate(ctx.agent_states.get(self.name))
196
197 def _create_agent_state_event(
198 self,
199 ctx: InvocationContext,
200 ) -> Event:
201 """Returns an event with current agent state set in the invocation context.
202
203 Args:
204 ctx: The invocation context.
205
206 Returns:
207 An event with the current agent state set in the invocation context.
208 """
209 event_actions = EventActions()
210 if (agent_state := ctx.agent_states.get(self.name)) is not None:
211 event_actions.agent_state = agent_state
212 if ctx.end_of_agents.get(self.name):
213 event_actions.end_of_agent = True
214 return Event(
215 invocation_id=ctx.invocation_id,
216 author=self.name,
217 branch=ctx.branch,
218 actions=event_actions,
219 )
220
221 def clone(
222 self: SelfAgent, update: Mapping[str, Any] | None = None

Callers 6

_run_async_implMethod · 0.80
_run_async_implMethod · 0.80
_run_async_implMethod · 0.80
_run_async_implMethod · 0.80
run_llm_agent_as_nodeFunction · 0.80

Calls 3

EventActionsClass · 0.85
EventClass · 0.50
getMethod · 0.45

Tested by 1