Skip to main content
Workflows emit a root span for every run and child spans for each step (including human interactions). Enable telemetry globally, per instance, or per run.

Enable at build time

With telemetry: true, AI Kit:
  • creates a root span named after the workflow id;
  • automatically records input, output, and metadata (recordInputs/recordOutputs);
  • attaches ai_kit.workflow.* attributes for easier filtering in Langfuse or OTEL.
Provide an object to customise the trace:
When userId is provided, it is exported as langfuse.user.id, user.id, and ai_kit.workflow.user_id.

Update an existing instance

Per-run overrides

Overrides merge with the global configuration (recordInputs, recordOutputs, metadata, …).

Associate a user

The user ID surfaces in Langfuse and in trace attributes. Combine it with extra metadata (tenantId, plan, …) for richer filters.

Plug into Langfuse

Each step records:
  • ai_kit.workflow.step.kind (automatic or human);
  • ai_kit.workflow.step.occurrence (iteration counter for loops);
  • ai_kit.workflow.step.branch_id / next_step_id when conditions are involved.
Human interactions reuse the same span between request and resume. human.requested / human.completed events are emitted for easier tracking.
If you don’t use autoFlush: "process", call provider.forceFlush() / provider.shutdown() when your app shuts down.