Measure multi‑agent performance by combining deterministic tracing (LangSmith, AutoGen telemetry) with statistical latency analysis on a controlled workload.
Apply the same instrumentation across all agents, then compare 95th‑percentile latency, throughput, and token‑cost against predefined SLA thresholds.
1. Define SLA metrics – set p95 latency < 200 ms, throughput ≥ 500 req/s, token cost ≤ $0.0005 per request.
2. Instrument every agent – enable LangSmith for LangChain, crewai‑monitor for CrewAI, and autogen‑telemetry for AutoGen. Use the same sampling rate (e.g., 1 % of calls) to keep overhead comparable.
3. Run a synthetic workload – use locust or k6 to fire 10 k requests with realistic prompt variations; record start/end timestamps from the tracing payload.
4. Aggregate metrics – pull JSON traces, compute:
- latency_ms = end_ts - start_ts
- p95 = np.percentile(latencies,95)
- throughput = total_requests / total_time
- cost = sum(tokens) * $0.0005/1k
5. Benchmark against baselines – store results in a time‑series DB (Prometheus) and compare to previous releases.
6. Continuous monitoring – push live traces to Grafana Loki; set alerts when p95_latency > 200 or cost_per_req > $0.0005.
| Framework | Built‑in tracing | Export format | Typical overhead |
|-----------|-----------------|---------------|------------------|
| LangChain | LangSmith API | JSON/CSV | ~2 % |
| CrewAI | crewai‑monitor | JSON | ~1.5 % |
| AutoGen | autogen‑telemetry| OpenTelemetry | ~1 % |
| Custom | None | – | – |
from langchain import LLMChain
from langsmith import Client, trace
client = Client(api_key="YOUR_LANGSMITH_KEY")
@trace
def run_chain(input_text):
chain = LLMChain(...)
return chain.run(input_text)
# Pull latency stats for a specific run
stats = client.get_run_metrics(run_id, metric="latency_ms")
p95 = stats.percentile(95)import autogen
autogen.enable_telemetry(endpoint="http://otel-collector:4317")
agent = autogen.Assistant(...)