InvokeAgentRuntime
Source:
src/AWS/BedrockAgentCore/InvokeAgentRuntime.ts
Sends a request to an agent hosted in an AgentCore Runtime and receives the (optionally streaming) response.
Bind a Runtime inside a function runtime to invoke the hosted
agent with session isolation (requests with the same runtimeSessionId
land on the same sandbox). Provide AgentCore.InvokeAgentRuntimeHttp on
the Function effect to implement the binding.
Invoking an Agent
Section titled “Invoking an Agent”// initconst invoke = yield* AgentCore.InvokeAgentRuntime(runtime);
return { fetch: Effect.gen(function* () { // runtime const response = yield* invoke({ runtimeSessionId: "session-0000000000000000000000000000000001", payload: JSON.stringify({ prompt: "hello" }), }); return HttpServerResponse.json({ contentType: response.contentType }); }),};