CreateEvent
Source:
src/AWS/BedrockAgentCore/CreateEvent.ts
Records an interaction event into a memory’s short-term store.
Bind a Memory inside a function runtime to get a callable that
appends conversational turns (or binary blobs) to an actor’s session.
Provide AgentCore.CreateEventHttp on the Function effect to implement
the binding over the AgentCore data-plane API.
Recording Events
Section titled “Recording Events”import * as AgentCore from "alchemy/AWS/BedrockAgentCore";
export default MyFunction.make( { main: import.meta.url, url: true }, Effect.gen(function* () { const memory = yield* AgentCore.Memory("AgentMemory", { eventExpiryDuration: "30 days", });
// init const createEvent = yield* AgentCore.CreateEvent(memory);
return { fetch: Effect.gen(function* () { // runtime const result = yield* createEvent({ actorId: "user-1", sessionId: "session-1", eventTimestamp: new Date(), payload: [ { conversational: { role: "USER", content: { text: "My favorite color is teal." }, }, }, ], }); return HttpServerResponse.json({ eventId: result.event.eventId }); }), }; }).pipe(Effect.provide(AgentCore.CreateEventHttp)),);