How to Connect Langfuse to an AI Agent
Auth setup
1. Create project at cloud.langfuse.com. 2. Go to Settings > API Keys. 3. Use public_key as username, secret_key as password in Basic auth.
Key facts
| Base URL | https://cloud.langfuse.com/api/public/ |
| API version | v2 |
| Auth | Basic auth with public_key:secret_key. Generate keys at cloud.langfuse.com project settings. |
| Request body | application/json |
| Pagination | offset-based: page and limit params. Response includes totalItems. |
| Rate limit | Cloud: 1,000 req/min. Self-hosted: unlimited. Batch ingestion recommended. |
| Error format | JSON: {"error":"...","message":"..."} |
Key endpoints
| Method | Path | Description |
POST | /ingestion | Batch ingest traces, spans, events |
GET | /traces | List traces with pagination |
GET | /traces/{traceId} | Get trace details |
GET | /scores | List evaluation scores |
Quickstart
POST /api/public/ingestion
Authorization: Basic {base64(public_key:secret_key)}
{"batch":[{"type":"trace-create","body":{"name":"my-trace"}}]}
Agent pitfalls & tips
- Use Python/JS SDK for automatic tracing — much easier than raw API.
- Batch ingestion endpoint accepts up to 1000 events per request.
- Self-hosting available: docker compose up for local development.
- Integrates with LangChain, LlamaIndex, OpenAI SDK via callbacks.
- Scores can be attached to traces for evaluation — useful for quality monitoring.
Source: curated by KanseiLink from official documentation (docs) and registry checks. Last reviewed: 2026-04-07. Specs change — verify against the official docs before production use.
Frequently Asked Questions
What is Langfuse's AEO score?
▼
Langfuse has an AEO score of 0.90 and is rated AA (Strong agent support with minor gaps). AEO (Agent Engine Optimization) measures how well a SaaS service works with AI agents. Scores range from 0.00 to 1.00, with grades from AAA (best) to D (not agent-ready).
Is Langfuse AI-agent-ready?
▼
Langfuse is currently ✓ verified for AI agent use. It offers an official MCP (Model Context Protocol) server, which means AI agents can connect directly. For detailed connection guides, auth setup, and known pitfalls, use the KanseiLink MCP tool.
How does Langfuse compare to other AI & ML services?
▼
In the AI & ML category, Langfuse is rated AA. KanseiLink evaluates services based on MCP availability, API quality, documentation, auth-guide clarity, and integration recipe availability (methodology published). Visit the full rankings at kansei-link.com to see how Langfuse compares.
How can I integrate Langfuse with an AI agent?
▼
The fastest way to integrate Langfuse with an AI agent is through KanseiLink MCP. Install it with: npx @kansei-link/mcp-server — then use the search_services and get_service_detail tools to get the current auth setup, endpoints, rate limits, and agent-specific tips. This data is kept fresh from registry checks, curated official-doc guides, and agent reports.
How do I authenticate with Langfuse?
▼
Basic auth with public_key:secret_key. Generate keys at cloud.langfuse.com project settings. Setup: 1. Create project at cloud.langfuse.com. 2. Go to Settings > API Keys. 3. Use public_key as username, secret_key as password in Basic auth.
What are Langfuse's API rate limits?
▼
Cloud: 1,000 req/min. Self-hosted: unlimited. Batch ingestion recommended.