---
title: "Move an agent optimization workflow from Langfuse to Caveman"
description: "Start with the workflow you want to improve. If it is expensive repeated context, add Caveman locally and leave Langfuse in place. If it is the analysis and evaluation workflow itself, arrange a Cavem"
canonical: https://caveman.so/switch/langfuse
last-updated: 2026-09-07
---

# Move an agent optimization workflow from Langfuse to Caveman

Start with the workflow you want to improve. If it is expensive repeated context, add Caveman locally and leave Langfuse in place. If it is the analysis and evaluation workflow itself, arrange a Caveman Platform pilot before changing production telemetry.

There is no universal Langfuse-to-Caveman import command. Prompt versions, score definitions, datasets, and historical traces have different roles. Treat each as a migration item with its own acceptance check.

## Inventory what your application depends on

Make a list of Langfuse SDK instrumentation, OpenTelemetry exporters, prompt fetches, dataset references, scoring jobs, and dashboards. Include CI checks and review links that point to historical trace IDs.

A dependency in the inference path deserves particular attention. Removing a tracing wrapper may be harmless to the answer; removing the prompt client that supplies the production prompt is not. Keep prompt delivery stable during the telemetry trial.

Record your SDK version and deployment configuration. Follow [Langfuse's documentation](https://langfuse.com/docs) for the APIs and export options your version supports. Preserve access to historical records rather than assuming they can all be recreated elsewhere.

## Save a useful baseline

Choose tasks with known answers or executable checks. Include a normal run, a tool failure, a retry, a long context, and a multi-step session. Save the inputs under your existing data policy and retain the grader configuration.

For each run, record the root trace and task identifier, provider and model, token fields, status, timing, and final result. Distinguish missing usage from zero usage. Keep cached-token semantics visible because different providers report them differently.

## Test local compression first when that is the goal

On a developer machine with a supported coding agent:

```bash
npm install -g @caveman-ai/cli
caveman setup --install
caveman doctor claude
caveman claude
```

Run the same task once directly and once through the wrapper in fresh sessions. Ask for a detail omitted from an eligible compressed result to exercise recovery. Existing application instrumentation remains a separate integration; a coding-agent wrapper does not automatically forward every event to Langfuse or Caveman Platform.

Follow [the coding-agent guide](/guides/coding-agent-setup) for other supported launchers. Keep direct runs available until the complete task comparison passes.

## Map the Platform ingestion path

For a provisioned pilot, agree with Caveman on the source, authentication, supported fields, and capture settings. If your traffic already uses LiteLLM, [the integration overview](/switch/litellm) is a starting point. Do not replace an exporter URL with a guessed Caveman endpoint.

| Evidence | Check in the candidate |
| --- | --- |
| Trace and parent IDs | Related steps remain connected |
| Task or workflow ID | Repeated attempts remain distinct and attributable |
| Provider usage | Input, output, and cache fields preserve their meaning |
| Errors and retries | Failures remain visible and are not counted twice |
| Captured content | Redaction and retention match the agreed policy |
| Evaluation results | Cases, grader versions, and outcomes remain inspectable |

Do not dual-instrument the same provider call with overlapping SDK wrappers without checking for duplicate spans. Duplicate telemetry can inflate apparent activity and costs.

## Keep prompt and evaluation dependencies until replaced

A trace destination change does not migrate a prompt registry. Leave Langfuse prompt delivery in place until the candidate can resolve the required version, labels, variables, and fallback behavior. Apply the same rule to datasets and scoring jobs.

Compare a sample of both destinations against provider records and the final task artifact. Then test exporter failure: the application should behave according to its existing reliability policy, with telemetry loss visible to operators.

## Cut over one consumer and retain rollback

Move a staging dashboard or one investigation workflow first. Change production collection only after the supported mapping passes and the team can still investigate a failed run.

Rollback means restoring the saved exporter configuration and any affected client initialization. Retain Langfuse history through your required review period. Remove credentials only after the last consumer has moved.

Read [Caveman vs Langfuse](/compare/langfuse) for the decision boundary and [agent observability](/guides/agent-observability) for the evidence model.
