Testing Strategy
Test Pyramid
Unit Testing Agents
Basic Agent Test
Mocking Operations
Testing Error Paths
Integration Testing Ensembles
Basic Ensemble Test
Observability Configuration
Conductor provides Cloudflare-first observability with structured logging, metrics via Analytics Engine, and optional OpenTelemetry export.Configuration in conductor.config.ts
Setting Up Analytics Engine
Add to yourwrangler.toml:
- Go to Workers & Pages → Analytics Engine
- Click Create dataset
- Name it
conductor-metrics
Telemetry vs Observability
Observability (logging, traces) is for debugging—understanding how your code executed. Telemetry is for analytics—tracking business metrics for billing, dashboards, and trend analysis.| Use Case | Tool |
|---|---|
| Debug failures, trace execution | logger, observability config |
| Track costs, revenue, conversion | telemetry operation |
logger to debug failures, use telemetry to track daily revenue and success rates.
Logging in Agents
Every agent receives a pre-configuredlogger and metrics recorder in its execution context:
Log Levels
| Level | Use For | Example |
|---|---|---|
debug | Detailed debugging | Input/output values, cache decisions |
info | Normal operations | Start/complete events, important milestones |
warn | Potential issues | Rate limits, fallback usage, slow queries |
error | Failures | Exceptions, validation errors, API failures |
YAML-Based Observability
Agent-Level Logging
Ensemble-Level Logging
Querying Metrics
Analytics Engine SQL API
Query your metrics using the Cloudflare dashboard or API:Production Monitoring
Cloudflare Workers Dashboard
View real-time metrics:- Workers & Pages → Your worker → Metrics
- Monitor:
- Requests per second
- Error rate
- CPU time
- Duration (p50, p95, p99)
Viewing Logs
Log Format
Conductor outputs structured JSON logs for Cloudflare Workers Logs:OpenTelemetry Integration
Export to external platforms like Datadog or Honeycomb:Debugging
Enable Debug Mode
Local Development
Trace Execution with Logger
Performance Testing
Load Testing
Best Practices
- Test Coverage - Aim for 80%+ coverage
- Mock External Calls - Don’t hit real APIs in tests
- Test Error Paths - Test failures and fallbacks
- Use Structured Logging - Always log as JSON with context
- Redact Sensitive Data - Configure
redactpatterns - Monitor Continuously - Track metrics in production
- Set Up Alerts - Alert on error rate spikes
- Sample in Production - Use
samplingRatefor high-volume traffic - Debug Locally First - Use
wrangler devbefore deploying - Review Logs Regularly - Check for patterns and anomalies
Next Steps
Creating Agents
Build testable agents
Writing Ensembles
Design robust workflows
Playbooks
Real-world examples
Operations Reference
All operations docs

