Skip to main content
You can integrate Fiddler with Fireworks AI to observe, evaluate, and improve AI agents and LLM applications that run on open models. Fireworks serves open chat models behind an OpenAI-compatible API, and Fiddler records every model call, tool call, and agent step as a trace, then scores your application’s quality and safety. This page explains how Fireworks AI and Fiddler fit together, then walks you through a complete tutorial. You learn how to trace Fireworks model calls with the Fiddler OTel SDK, trace a tool-calling agent across a multi-turn conversation, test your instrumentation locally, run experiments with a Fireworks model as an LLM-as-a-Judge evaluator, and instrument a LangChain agent that runs on Fireworks.

Background

Fireworks AI is an inference and training platform for open models, such as Kimi, DeepSeek, GLM, Qwen, MiniMax, and gpt-oss. You can call models on shared serverless capacity and pay per token, or run them on dedicated deployments. You can also fine-tune models on your own data and serve the tuned model on the same platform. Because the Fireworks API is compatible with the OpenAI API, you use the official OpenAI client libraries and point them at the Fireworks base URL, https://api.fireworks.ai/inference/v1. Frameworks that support OpenAI-compatible providers, such as LangChain and LangGraph, work the same way. Fiddler complements Fireworks as the AI Control Plane for your Fireworks-powered applications and agents, from development through production:
  • Agentic observability: Trace every request through your agent, including the prompts, completions, token usage, and tool calls of each step, and group traces into conversations so you can understand every agent decision.
  • Evaluation: Score every trace for quality and safety with Fiddler Centor Models, which route each input automatically to the right evaluation model and return results in under 80ms, inside your environment, with no per-evaluation API calls. For criteria unique to your use case, bring your own judge model served on Fireworks.
  • Experiments: Test your application against a dataset of test cases, and compare models, prompts, and fine-tuned versions before you ship.
  • Monitoring: Track quality, safety, latency, and cost metrics in production, diagnose root causes down to the span, and get alerted when metrics change.
  • Guardrails and governance: Block unsafe inputs and outputs, such as PII leakage and jailbreak attempts, in real time with guardrails powered by Centor Models, and keep an audit trail of every enforcement decision for compliance reporting.

Key Concepts

Supported Models

The following serverless models support function calling and work with this tutorial. Fireworks adds and retires models regularly — for the current list, including models that you can run on dedicated deployments, see the Fireworks model library.

Tutorial: Trace and Evaluate a Fireworks Agent

In this tutorial, you instrument a customer support agent that runs on a Fireworks model and looks up orders with a tool. Then you send its traces to Fiddler and evaluate its answers.

Prerequisites

To complete this tutorial, you need:
  • A Fiddler GenAI application. In Fiddler, go to GenAI Applications, click Add Application, and copy the application ID. Then go to Settings > Credentials and copy your API key. To learn more, see the Fiddler OTel SDK documentation.
  • A Fireworks AI API key. To create one, go to API Keys in the Fireworks console.
  • Python 3.11, 3.12, 3.13, or 3.14.

Set Up the Environment

1

Install the dependencies

2

Set your environment variables

3

Create the Fiddler and Fireworks clients

The Fiddler client exports spans to your application. The Fireworks client is the standard OpenAI client pointed at the Fireworks base URL.

Trace a Fireworks Model Call

Decorate the function that calls Fireworks with @trace(as_type="generation"). The model and system arguments record the model ID and the provider on the span. Inside the function, get_current_span returns the span, so that you can record the prompts, the completion, and the token usage that Fireworks returns.

Trace a Tool-Calling Agent

An agent request contains several model calls and tool runs. In this section, you trace each model call as a generation span, each tool run as a tool span, and the whole request as a chain span. Fiddler nests the spans by call stack, so the trace shows every step that the agent took.
1

Define the tool and trace it

The model sees the tool’s name, description, and parameters, and returns a tool call when it wants to look up an order.
2

Trace each model call of the agent

The span records the model with set_model, the full conversation with set_messages, the response with set_output_messages, and the available tools with set_tool_definitions. Unlike the model argument of @trace, which is fixed when Python defines the function, set_model reads AGENT_MODEL on every call, so the spans stay accurate when you switch models to compare them.set_messages expects each tool call as a flat object with id, name, and arguments fields, but the OpenAI client nests the name and arguments under function. The for_fiddler helper flattens them, so the tool names appear on the span.
3

Run the agent loop inside a chain span

The agent calls the model, runs any tools that the model requests, sends the tool results back, and repeats until the model returns a final answer.
4

Run a two-turn conversation

set_conversation_id tags every span that follows with the same conversation ID, so that Fiddler shows both turns as one conversation.
The client exports spans in the background and flushes them when your program exits. Short scripts and notebooks should call force_flush to export the spans immediately.
5

View the traces in Fiddler

In Fiddler, open your application from GenAI Applications to see the traces. Each turn produces one trace with this structure:
Each generation span shows the messages, the tool definitions, and the token usage of that Fireworks call. Both turns appear under the same conversation.

Test Your Instrumentation Locally

To check your spans before you send them to Fiddler, create the client in offline mode instead of the client from Set Up the Environment. In offline mode, the client doesn’t need an API key or URL, and writes spans as OpenTelemetry Protocol (OTLP) JSON files to a local directory instead of exporting them.
Fiddler can also ingest these files from Amazon S3. To learn more, see S3 Trace Ingestion.

Run an Experiment with the Fiddler Evals SDK

Before you change a prompt, a model, or a fine-tuned version, run an experiment to measure the effect. An experiment runs your application on each test case in a dataset and scores the outputs with evaluators. This section uses the Fiddler Evals SDK.
1

Connect to Fiddler and create a dataset of test cases

The dataset belongs to the same application that receives your traces. A Python process shares one FiddlerClient, and the Evals SDK raises a ValueError if that client and the dataset belong to different applications.
Experiment runs produce real traces. Outside this tutorial, run experiments against a dedicated pre-production application so that they don’t mix with production traffic. See Keep Evaluation Traces Out of Production.
2

Create an LLM-as-a-Judge evaluator that runs on a Fireworks model

A custom evaluator subclasses Evaluator and returns a Score from its score method. This evaluator asks the judge model whether the agent’s answer agrees with the expected answer.
3

Run the experiment

The task function runs the agent on each test case. The Evals SDK gives each test case its own conversation ID and links its traces to the test case, so experiment runs don’t merge into the tutorial’s two-turn conversation. score_fn_kwargs_mapping tells each evaluator where to find its arguments.
To learn how the Evals SDK captures these traces and how evaluators can score them, see Capture Traces During Experiments.You can add Fiddler’s built-in evaluators, such as AnswerRelevance and Coherence, to the evaluators list. To learn which arguments and models they need, see the Fiddler Evals SDK.
4

Review and compare experiments

In Fiddler, open the experiment to review the score of each test case. To compare models, change AGENT_MODEL, run the experiment again with a different name_prefix, and compare the two experiments.

Use Fireworks with the Fiddler LangChain SDK

If you build agents with LangChain’s create_agent, use the Fiddler LangChain SDK to trace them automatically, and the langchain-fireworks package for the chat model. The instrumentor records the model calls, tool calls, and token usage of every agent that you create after you call instrument. ChatFireworks reads your Fireworks API key from the FIREWORKS_API_KEY environment variable.

Troubleshooting

Traces Are Missing in Fiddler

Call fiddler.force_flush() before a short script or notebook cell finishes. Check that FIDDLER_APPLICATION_ID is the UUID copied from GenAI Applications and that FIDDLER_URL has no trailing path. For more checks, see Fiddler OTel SDK troubleshooting.

Tool Calls Appear on Generation Spans Without a Name

Pass the messages through for_fiddler before you call set_messages or set_output_messages. The SDK reads the tool name from a flat name field, not from the OpenAI client’s nested function.name field.

Fireworks Returns a Model Not Found Error

Check the model ID against the Fireworks model library, and confirm that the model is available on serverless capacity. Models on a dedicated deployment use your deployment’s model ID instead.

Next Steps

  • Try other Fireworks models in the agent by changing AGENT_MODEL, and compare them in Fiddler experiments. See the Fireworks model library.
  • Fine-tune a model on Fireworks with conversations that score well in Fiddler, then compare the tuned model with the base model. To learn more, see Fine-tuning models.
  • Score your production traces automatically with Centor Models and evaluator rules.
  • Add more tools to the agent. To learn more about tool definitions, see Fireworks tool calling.