(
agent: Agent,
user_content: str = '',
run_config: RunConfig = None,
plugins: list[BasePlugin] = [],
)
| 75 | |
| 76 | |
| 77 | async 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 | |
| 109 | def append_user_content( |
nothing calls this directly
no test coverage detected