statelyai / agent

Create state-machine-powered LLM agents using XState
https://stately.ai/docs/agents
186 stars 12 forks source link

Correlation ID #40

Closed davidkpiano closed 4 months ago

davidkpiano commented 4 months ago

Correlation IDs are now provided as part of the result from agent.generateText(…) and agent.streamText(…):

const result = await agent.generateText({
  prompt: 'Write me a song',
  correlationId: 'my-correlation-id',
  // ...
});

result.correlationId; // 'my-correlation-id'

These correlation IDs can be passed to feedback:

// ...

agent.addFeedback({
  reward: -1,
  correlationId: result.correlationId,
});

Changes to agent feedback (the AgentFeedback interface):