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

Method __init__

tests/unittests/testing_utils.py:221–269  ·  view source on GitHub ↗

Initializes the InMemoryRunner. Args: root_agent: The root agent to run, won't be used if app is provided. response_modalities: The response modalities of the runner. plugins: The plugins to use in the runner, won't be used if app is provided. app: The app to use

(
      self,
      root_agent: Optional[Union[Agent, LlmAgent]] = None,
      response_modalities: list[str] = None,
      plugins: list[BasePlugin] = [],
      app: Optional[App] = None,
      node: Any = None,
  )

Source from the content-addressed store, hash-verified

219 """InMemoryRunner that is tailored for tests."""
220
221 def __init__(
222 self,
223 root_agent: Optional[Union[Agent, LlmAgent]] = None,
224 response_modalities: list[str] = None,
225 plugins: list[BasePlugin] = [],
226 app: Optional[App] = None,
227 node: Any = None,
228 ):
229 """Initializes the InMemoryRunner.
230
231 Args:
232 root_agent: The root agent to run, won't be used if app is provided.
233 response_modalities: The response modalities of the runner.
234 plugins: The plugins to use in the runner, won't be used if app is
235 provided.
236 app: The app to use in the runner.
237 node: The root node to run.
238 """
239 if node:
240 self.app_name = node.name
241 self.root_agent = None
242 self.runner = Runner(
243 node=node,
244 artifact_service=InMemoryArtifactService(),
245 session_service=InMemorySessionService(),
246 memory_service=InMemoryMemoryService(),
247 plugins=plugins,
248 )
249 elif not app:
250 self.app_name = 'test_app'
251 self.root_agent = root_agent
252 self.runner = Runner(
253 app_name='test_app',
254 agent=root_agent,
255 artifact_service=InMemoryArtifactService(),
256 session_service=InMemorySessionService(),
257 memory_service=InMemoryMemoryService(),
258 plugins=plugins,
259 )
260 else:
261 self.app_name = app.name
262 self.root_agent = app.root_agent
263 self.runner = Runner(
264 app=app,
265 artifact_service=InMemoryArtifactService(),
266 session_service=InMemorySessionService(),
267 memory_service=InMemoryMemoryService(),
268 )
269 self.session_id = None
270
271 @property
272 def session(self) -> Session:

Callers

nothing calls this directly

Calls 4

RunnerClass · 0.90

Tested by

no test coverage detected