P
Peekr Cloud
DemoAcme Agents

← Traces

agent.run

trace_id: trace_00002n · tenant: acme

4 spans·5378msok

Root cause: sequential execution of "messages.create"

3 "anthropic.messages.create" spans ran one after another — each started only after the previous one finished. Total: 5.3s, slowest single call: 1.8s. Running them concurrently saves 3.4s — a 2.9× speedup.

Now (sequential)After fix (parallel)

5.3s

~1.8s

Fix: run calls in parallel

fix.py
from concurrent.futures import ThreadPoolExecutor

# Before — sequential, each call blocks the next:
for item in items:
    result = process(item)

# After — all calls run concurrently:
with ThreadPoolExecutor(max_workers=8) as pool:
    results = list(pool.map(process, items))

# Cost unchanged. Output unchanged. Time = slowest single call.

Waterfall

agent › run

agent.run

user: u_708
anthropic › messages › create

anthropic.messages.create

claude-opus-4-7587 tok$0.023faithful 0.95user: u_708
Input

Summarize the Q3 earnings report attached. Focus on revenue, margin, and guidance.

Output

(answer to: Summarize the Q3 earnings report attache…)

anthropic › messages › create

anthropic.messages.create

claude-opus-4-7402 tok$0.016faithful 0.86user: u_708
Input

Given the customer ticket below, draft a refund response that follows policy P-204.

Output

(answer to: Given the customer ticket below, draft a…)

anthropic › messages › create

anthropic.messages.create

claude-opus-4-7529 tok$0.021faithful 0.98user: u_708
Input

Translate the user manual section to Japanese, preserving the table structure.

Output

(answer to: Translate the user manual section to Jap…)