Restate Agents + Langfuse example
April 9, 2026 ยท View on GitHub
This example shows how to get full observability over your agentic workflows by combining Restate with Langfuse. We use LiteLLM to abstract away the LLM calls.
It implements an insurance claim processor that mixes LLM agent steps (document parsing, claim analysis) with regular workflow steps (currency conversion, reimbursement). Restate orchestrates the workflow durably and exports OpenTelemetry traces. A Restate tracing processor attaches the LiteLLM spans to the Restate trace, so everything shows up as a single unified trace in Langfuse: LLM calls with their prompts, model config, and outputs alongside the durable workflow steps.
Running the example
Prerequisites:
Install Restate via brew or other installation methods:
brew install restatedev/tap/restate-server restatedev/tap/restate
Download the example:
restate example python-restate-agent-examples
cd python-restate-agent-examples/langfuse
Add your API keys to an .env file:
echo 'LANGFUSE_PUBLIC_KEY=pk-lf-...' > .env
echo 'LANGFUSE_SECRET_KEY=sk-lf-...' >> .env
echo 'LANGFUSE_OTEL_HOST=https://cloud.langfuse.com' >> .env
echo 'OPENAI_API_KEY=sk-proj-...' >> .env
Start the agent service:
uv run --env-file .env .
Start Restate:
# Export Langfuse API keys
source .env
export RESTATE_TRACING_HEADERS__AUTHORIZATION="Basic $(echo -n "${LANGFUSE_PUBLIC_KEY}:${LANGFUSE_SECRET_KEY}" | base64)"
restate-server --tracing-endpoint otlp+https://cloud.langfuse.com/api/public/otel/v1/traces
Restate exports OTEL traces. By setting the tracing endpoint and headers, we can export traces to Langfuse.
Now register the service, so Restate knows where it is running:
restate deployments add localhost:9080
Send a request:
curl localhost:8080/ClaimReimbursement/process \
--json '{"message": "Process my hospital bill of 2024-10-01 for 3000USD for a broken leg at General Hospital."}'
Send the request to Restate (localhost:8080) which persists it and then forwards it to the agent.
You can now inspect the trace in Langfuse.