Overview
LoopOS AI includes comprehensive observability to monitor:- Agent performance and behavior
- Token usage and costs
- Request latency and throughput
- Error rates and patterns
- User interactions and conversations
Langfuse Integration
LoopOS AI uses Langfuse for observability:Automatic Tracing
All agent runs are automatically traced with input/output.
Token Tracking
Monitor token usage and costs per request and session.
Session Correlation
Track conversations across multiple requests.
Performance Metrics
Latency, throughput, and error rate monitoring.
Tracing
Every agent execution is traced in Langfuse:Trace Structure
Trace Data
Each trace includes:- Input: Request data, context, messages
- Output: Agent response, structured output
- Metadata: Service name, session ID, user ID
- Performance: Latency, token counts, costs
Token Tracking
Token usage is tracked at multiple levels:Input Tokens
Tokens in prompts, context, and messages sent to LLM.
Output Tokens
Tokens generated by LLM in responses.
Cached Tokens
Tokens that hit cache (counted but not charged).
Reasoning Tokens
Tokens used for reasoning (if model supports it).
Cost Monitoring
Costs are calculated based on:- Model pricing (per million tokens)
- Token counts (input + output)
- Image processing costs (if applicable)
- Per request
- Per session
- Per service
- Per model
Session Tracking
Sessions track conversations across requests:Performance Metrics
Key metrics monitored:Latency
Time from request to response (mean, P95, P99).
Throughput
Requests per second, tokens per second.
Error Rate
Percentage of failed requests.
Success Rate
Percentage of successful requests.
Logging
Structured logging for all operations:Log Levels
- INFO: Normal operations, request/response
- WARNING: Non-critical issues, fallbacks
- ERROR: Errors with stack traces
- DEBUG: Detailed debugging information
Log Format
Monitoring Best Practices
Accessing Observability Data
Langfuse Dashboard
Access Langfuse dashboard to view:- Traces and runs
- Token usage and costs
- Performance metrics
- Error patterns
API Access
Observability data can be accessed via:- Langfuse API
- Database queries (for advanced analysis)
- Log aggregation tools
Related Documentation
- Architecture - System architecture
- Services - Service patterns
- AI Hub: Best Practices - Best practices for monitoring