🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(in-app-agent): store metadata on each observation for session fil… (#17409)
Nimar3d3aa120e663
diff --git a/worker/src/features/in-app-agent/runtime/instrumentation.test.ts b/worker/src/features/in-app-agent/runtime/instrumentation.test.tsindex fd6cdf3c9f..79fe17c38b 100644--- a/worker/src/features/in-app-agent/runtime/instrumentation.test.ts+++ b/worker/src/features/in-app-agent/runtime/instrumentation.test.ts@@ -962,6 +962,20 @@ describe("InAppAgentInstrumentation", () => {});instrumentation.end({});+ for (const [, observation] of mocks.handler.langfuse.enqueue.mock.calls) {+ expect(observation).toMatchObject({+ userId: "user-1",+ sessionId: "conversation-1",+ metadata: {+ langfuse_project_id: "project-1",+ langfuse_user_email: "[email protected]",+ langfuse_user_project_role: "ADMIN",+ langfuse_user_is_admin: true,+ approval_continuation_count: 2,+ },+ });+ }+const parentTraceId = getInAppAgentInstrumentationTraceId("root-run-1");const parentObservationId =getInAppAgentInstrumentationObservationId("root-run-1");@@ -1012,7 +1026,7 @@ describe("InAppAgentInstrumentation", () => {startTime: new Date(approvalRequestedAt),endTime: new Date(approvalDecidedAt),output: `User ${status} tool langfuse_createTextPrompt`,- metadata: approvalMetadata,+ metadata: expect.objectContaining(approvalMetadata),}),);expect(mocks.handler.langfuse.enqueue).toHaveBeenCalledWith(diff --git a/worker/src/features/in-app-agent/runtime/instrumentation.ts b/worker/src/features/in-app-agent/runtime/instrumentation.tsindex da4ed7d4a2..96cb5ce6be 100644--- a/worker/src/features/in-app-agent/runtime/instrumentation.ts+++ b/worker/src/features/in-app-agent/runtime/instrumentation.ts@@ -913,6 +913,7 @@ export class InAppAgentInstrumentation {...body,userId: this.userId,sessionId: this.sessionId,+ metadata: { ...this.metadata, ...body.metadata },});}