MCPcopy Index your code
hub / github.com/google/adk-python / _TestingAgent

Class _TestingAgent

tests/unittests/agents/test_parallel_agent.py:35–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34
35class _TestingAgent(BaseAgent):
36
37 delay: float = 0
38 """The delay before the agent generates an event."""
39
40 def event(self, ctx: InvocationContext):
41 return Event(
42 author=self.name,
43 branch=ctx.branch,
44 invocation_id=ctx.invocation_id,
45 content=types.Content(
46 parts=[types.Part(text=f'Hello, async {self.name}!')]
47 ),
48 )
49
50 @override
51 async def _run_async_impl(
52 self, ctx: InvocationContext
53 ) -> AsyncGenerator[Event, None]:
54 await asyncio.sleep(self.delay)
55 yield self.event(ctx)
56 if ctx.is_resumable:
57 ctx.set_agent_state(self.name, end_of_agent=True)
58
59
60async def _create_parent_invocation_context(

Callers 3

test_run_asyncFunction · 0.70
test_run_async_branchesFunction · 0.70

Calls

no outgoing calls

Tested by 3

test_run_asyncFunction · 0.56
test_run_async_branchesFunction · 0.56