Skip to main content

Testing Strategy

Test Pyramid

Unit Tests: Test individual agents Integration Tests: Test ensembles end-to-end E2E Tests: Test full user journeys

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 your wrangler.toml:
Then create the dataset in Cloudflare Dashboard:
  1. Go to Workers & PagesAnalytics Engine
  2. Click Create dataset
  3. 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. For example, in a payment agent: use logger to debug failures, use telemetry to track daily revenue and success rates.

Logging in Agents

Every agent receives a pre-configured logger and metrics recorder in its execution context:

Log Levels


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:
  1. Workers & Pages → Your worker → Metrics
  2. 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

  1. Test Coverage - Aim for 80%+ coverage
  2. Mock External Calls - Don’t hit real APIs in tests
  3. Test Error Paths - Test failures and fallbacks
  4. Use Structured Logging - Always log as JSON with context
  5. Redact Sensitive Data - Configure redact patterns
  6. Monitor Continuously - Track metrics in production
  7. Set Up Alerts - Alert on error rate spikes
  8. Sample in Production - Use samplingRate for high-volume traffic
  9. Debug Locally First - Use wrangler dev before deploying
  10. 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