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

Function create_invocation_context

tests/unittests/testing_utils.py:77–106  ·  view source on GitHub ↗
(
    agent: Agent,
    user_content: str = '',
    run_config: RunConfig = None,
    plugins: list[BasePlugin] = [],
)

Source from the content-addressed store, hash-verified

75
76
77async def create_invocation_context(
78 agent: Agent,
79 user_content: str = '',
80 run_config: RunConfig = None,
81 plugins: list[BasePlugin] = [],
82):
83 invocation_id = 'test_id'
84 artifact_service = InMemoryArtifactService()
85 session_service = InMemorySessionService()
86 memory_service = InMemoryMemoryService()
87 invocation_context = InvocationContext(
88 artifact_service=artifact_service,
89 session_service=session_service,
90 memory_service=memory_service,
91 plugin_manager=PluginManager(plugins=plugins),
92 invocation_id=invocation_id,
93 agent=agent,
94 session=await session_service.create_session(
95 app_name='test_app', user_id='test_user'
96 ),
97 user_content=types.Content(
98 role='user', parts=[types.Part.from_text(text=user_content)]
99 ),
100 run_config=run_config or RunConfig(),
101 )
102 if user_content:
103 append_user_content(
104 invocation_context, [types.Part.from_text(text=user_content)]
105 )
106 return invocation_context
107
108
109def append_user_content(

Callers

nothing calls this directly

Calls 8

create_sessionMethod · 0.95
InvocationContextClass · 0.90
PluginManagerClass · 0.90
RunConfigClass · 0.90
append_user_contentFunction · 0.70

Tested by

no test coverage detected