Skip to Content
Launching the open-source gateway

Flue (tracing)

Flue  is a TypeScript agent harness framework for autonomous agents and AI workflows. Use @respan/instrumentation-flue to subscribe to Flue runtime events and emit canonical Respan spans.

Set up Respan

Create an account at platform.respan.ai  and grab an API key .

Paste this into your coding agent:

Help me set up Respan tracing with the Flue integration. Follow https://www.respan.ai/docs/integrations/flue.md

Setup

Install packages

Terminal
npm install @flue/runtime @respan/respan @respan/tracing @respan/instrumentation-flue

Set environment variables

Terminal
export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

Initialize Respan before Flue handles activity

TypeScript
import * as FlueRuntime from "@flue/runtime"; import { Respan } from "@respan/respan"; import { FlueInstrumentor } from "@respan/instrumentation-flue"; const respan = new Respan({ apiKey: process.env.RESPAN_API_KEY, baseURL: process.env.RESPAN_BASE_URL, appName: "flue-tracing", instrumentations: [ new FlueInstrumentor({ runtimeModule: FlueRuntime, workflowName: "Flue App.workflow", }), ], }); await respan.initialize();

Register the instrumentor once during application startup, before Flue handles workflow or agent activity.

Run Flue activity inside a Respan workflow

TypeScript
await respan.propagateAttributes( { trace_group_identifier: "Flue App.workflow", metadata: { service: "agent-runtime", framework: "flue", }, }, async () => { await respan.withWorkflow({ name: "Flue App" }, async () => { // Run your Flue agent, workflow, or runtime activity here. }); } );

View your trace

Open the Traces page  to see Flue workflow runs, agent sessions, model turns, tool executions, tasks, shell operations, compaction events, and structured logs.

Captured data

DataDescription
Workflow runsFlue run lifecycle events, inputs, outputs, duration, and errors.
Direct agentsAgent lifecycle events for direct Flue agent sessions.
Model turnsModel request, response, usage, provider, API type, and reasoning metadata.
ToolsTool names, arguments, outputs, durations, and errors.
TasksDelegated task prompts, agents, results, durations, and failures.
Shell operationsShell command operations and command failure details.
CompactionContext compaction metadata including before/after message counts.
Structured logsFlue application logs emitted through the runtime context.

Attributes

Use Respan attributes to group Flue runs by user, trace group, or deployment.

TypeScript
await respan.propagateAttributes( { customer_identifier: "user_123", thread_identifier: "flue-session-abc", trace_group_identifier: "Support Agent.workflow", metadata: { environment: "production", channel: "support", }, }, async () => { await respan.withWorkflow({ name: "Support Agent" }, runFlueAgent); } );
AttributeTypeDescription
customer_identifierstringIdentifies the end user in Respan analytics.
thread_identifierstringGroups related Flue activity into a session.
trace_group_identifierstringGroups related spans into a named trace group.
metadataobjectCustom key-value pairs attached to spans.

Notes

  • @respan/instrumentation-flue listens to Flue’s runtime observe() event stream.
  • Pass runtimeModule when your app imports @flue/runtime directly. This ensures the instrumentor observes the same runtime module instance your application uses.
  • The TypeScript examples are deterministic and emit representative Flue workflow, agent, model-turn, tool, task, compaction, log, and recovery events without calling an external LLM provider.