Skip to content

feat(observability): use Effect AI Telemetry for model and tool spans - #57

Merged
systemfsoftware-bot merged 2 commits into
mainfrom
feat/telemetry-effect-ai
Nov 26, 2026
Merged

systemfsoftware-bot merged 2 commits into
mainfrom
feat/telemetry-effect-ai

Conversation

@systemfsoftware-bot

Copy link
Copy Markdown
Contributor

Routes model and Tool telemetry through the pinned effect/ai/Telemetry primitives.

  • Model calls compose Telemetry.CurrentSpanTransformer: a host-provided transformer runs first, then the library identity (gen_ai.agent.*, gen_ai.conversation.id, effect_agent.run, effect_agent.thread, effect_agent.turn), written with addGenAIAnnotations and addSpanAttributes. The chat <model> span rename and the custom Tracer are gone, so model spans keep Effect AI's LanguageModel.streamText name.
  • Tool attributes are built once and applied with addSpanAttributes to the canonical Tool span; the same map is annotated on the terminal Tool log.
  • Duplicate unprefixed attributes are dropped; effect_agent.tool.parent_call.id remains.

BEHAVIOR CHANGE: consumers reading chat <model> spans or the unprefixed agentId, threadId, runId, turnId, toolCallId, toolName, parentToolCallId, sequenceIndex, toolExecutionClass, or toolOutcome attributes should read the gen_ai.* and effect_agent.* equivalents.

Checks run on this head:

  • pnpm typecheck — exit 0, 0 errors
  • pnpm lint — 0 warnings, 0 errors
  • pnpm format:check — clean
  • pnpm build — exit 0
  • pnpm --filter @systemfsoftware/agent test — 39 files, 161 tests passed

Compose `Telemetry.CurrentSpanTransformer` around each model call, running a
host-provided transformer first, so model spans keep Effect AI's span name and
the library identity is written through `addGenAIAnnotations` and
`addSpanAttributes`.

Build tool attributes once and apply the same map to the canonical Tool span
and its terminal log, dropping duplicated unprefixed keys.
The package exports check requires `Effect.withSpan` at an allowlisted
operation boundary. Create each `execute_tool` span at its call site and let a
separate helper annotate the current span through `addSpanAttributes`, so the
shared attribute map still reaches the Tool span.
@systemfsoftware-bot
systemfsoftware-bot merged commit 741b7d8 into main Nov 26, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant