testInvocationContext

fun testInvocationContext(agent: BaseAgent = DummyAgent(), session: Session = testSession(), runConfig: RunConfig? = RunConfig(), invocationId: String = "test-invocation-id", branch: String? = null, sessionService: SessionService? = null, artifactService: ArtifactService? = null, memoryService: MemoryService? = null, resumabilityConfig: ResumabilityConfig? = null, userContent: Content? = null): InvocationContext

An InvocationContext populated with sensible defaults for tests.

Most tests only care about a single field (e.g. the agent, or a particular service); this helper lets the test specify just the fields it cares about and inherit the rest from a test-canonical baseline:

  • session = testSession() (("test_app_name", "test_user_id", "test_session_id"))

  • runConfig = RunConfig()

  • agent = DummyAgent() (defaults to name "test-agent")

  • invocationId = "test-invocation-id"

Service params (sessionService, artifactService, memoryService) default to null, matching the production InvocationContext defaults; tests that exercise a service should pass one explicitly (e.g. sessionService = InMemorySessionService()).

Override any default with a named argument:

val context = testInvocationContext(agent = myAgent, memoryService = recording)