CodSpeed uses Claude Managed Agents with Blaxel sandboxes | Blaxel Blog

CodSpeed is the software performance platform that autonomously suggests optimizations and catches performance regressions before they land. It offers an AI agent that takes customer code, measures it using CodSpeed's CPU simulation approach — which delivers consistent, noise-free performance measurements even inside virtualized environments — and iterates: modifying code, re-running benchmarks, and comparing results until it can propose a measured set of performance improvements, complete with diffs and a pull request.

To achieve this goal, a CodSpeed agent needs to call tools, execute commands, work with files and directories, write code, and perform computations. This is best achieved with a managed agent harness. At the same time, considering the sensitive nature of the customer code it works with, CodSpeed also needs complete control over the execution environment in which their agent runs.

With the launch of Anthropic's Claude Managed Agents, CodSpeed explored a new approach: self-hosting the sandbox layer with Blaxel while keeping the agent loop entirely within Anthropic's platform.

“Claude Managed Agents + Blaxel moves two pieces off our plate: scaling the agent harness processes (and their observability) and the handling of secure sandboxes, since we now don’t need to provision them directly. This reduces the overall friction significantly for us.” - Arthur Pastel, CodSpeed

How it works

When a CodSpeed session starts, Claude Managed Agents loads the system prompt and the CodSpeed MCP server, then requests a Blaxel sandbox provisioned from CodSpeed's custom image.

The agent clones the repository once, then iterates in place: edit code, run benchmarks, compare results, repeat. Because benchmarks run under CodSpeed's CPU simulation, measurements stay consistent and reproducible even though the code executes in a virtualized environment where wall-clock benchmarking would be far too noisy to trust.

On top of each measurement, CodSpeed automatically generates profiling data of the benchmarked code. The agent retrieves this data through the CodSpeed MCP server to pinpoint bottlenecks precisely, letting it target the right code paths and iterate much faster. The agent stops when something measurable and impactful is found.

When the agent stops, results are submitted back via CodSpeed's internal MCP server as structured data: the performance impact, the code diff, and before/after benchmarks. CodSpeed surfaces this data in its UI and, if the user approves, a second agent opens a pull request with the recommended changes.

Here's a sequence diagram of the architecture:

Choosing Blaxel as the sandbox provider

For CodSpeed, selecting Blaxel as its sandbox provider made sense for multiple reasons:

The best of both: managed agents + self-hosted execution

This approach demonstrated that CodSpeed could have the best of both worlds: the agent harness, authentication, and lifecycle is handled by the Claude Platform, while the execution environment for customer code remains within their sphere of control and observability via Blaxel. The combination removes two concerns for CodSpeed: scaling the agent harness processes and their observability, and direct provisioning of sandboxes.

The combination of Claude Managed Agents and self-hosted Blaxel sandboxes creates an agentic solution that's faster to operate and easier to maintain, while still allowing full configuration and control over the sandbox execution layer.

For any team running agents on sensitive code with specialized execution requirements, this split - managed agent harness, self-hosted sandbox execution layer - is worth considering. To learn more, check out our tutorial on using Claude Managed Agents with Blaxel.