Repository navigation
Support Anthropic's server-side code execution tool (code_execution_20250825) #14521
Replies: 2 comments
|
Strong +1 — with a working trace and one correction that makes the ask smaller. It already works end-to-end on the API side. I ran Block sequence returned: One correction, in your favour: you mention const ANTHROPIC_TOOL_BETAS = {
// …
code_execution_20250825: 'code-execution-2025-08-25',
// …
};and What's actually missing is only the trigger. In let enableWebSearch = mergedOptions.web_search; // ~L180
// …
const tools = []; // ~L356
if (enableWebSearch) {
tools.push({ type: 'web_search_20250305', name: 'web_search' });
// …
}and Demand data point: in a corporate deployment (~200 users onboarding), the single most repeated unmet request in the first week was a downloadable document — one user asked three times in the same conversation ("generate a PDF I can send to the board", then falling back to "can you generate an .html?"). The model correctly answers it has no file-creation tool. We enabled Artifacts as a stopgap (formatted HTML → browser print-to-PDF), which covers presentation documents but not spreadsheets or real file outputs. On your KVM point — worth adding that it isn't only a cloud-tier problem: the operational cost is also non-trivial. The official Compose is 8 services (api, service-worker, egress_gateway, tool_call_server, sandbox-runner, file_server + Redis + MinIO), 6 of them built from source with no published images, production path via Helm. For an on-prem single-host deployment whose policy is "pinned image tags only, never local builds", that's a hard blocker independent of KVM — while the provider-side sandbox needs zero infrastructure. Happy to test a branch against our deployment if that helps. |
|
@danny-avila would you take a PR for this? I'd keep the first version small: a |
Uh oh!
There was an error while loading. Please reload this page.
The request
Support Anthropic's server-side code execution tool (
code_execution_20250825) on the Anthropic endpoint, alongside theweb_search_20250305integration that already exists — ideally exposed per modelSpec the waywebSearchis, rather than as a global switch.Current state
Anthropic ships several server-side tools on the Messages API. LibreChat wires exactly one of them today:
web_search_20250305is the only Anthropic*_2025xxxxtool identifier present in the shipped image, andcode_execution_2025*does not appear anywhere in this repository.Why this doesn't compete with the built-in Code Interpreter
The bundled Code Interpreter is a genuinely good piece of engineering, and where the hardware allows it, it stays the better option — code and data never leave the operator's own infrastructure. This request isn't about replacing it.
The problem is that a large group of self-hosters can't run it in a form its own authors consider safe. All three Compose files in
ClickHouse/code-interpreterrequire/dev/kvm, and its README is unusually candid about the alternative:Shared-vCPU cloud instances generally don't expose
/dev/kvm. Measured on a Hetzner Cloud CX instance: no/dev/kvmdevice, novmx/svmCPU flags. The same applies to comparable tiers at other providers. For those deployments the real choice isn't "built-in interpreter vs. Anthropic's" — it's "code execution or none", unless the operator rents dedicated hardware purely to host a sandbox.Supporting Anthropic's server-side tool would close that gap for KVM-less deployments without taking anything away from operators who can run the hardened sandbox.
Shape
It reuses the plumbing web search already goes through — same
toolsarray, sameserver_tool_use/ tool-result flow:{ "type": "code_execution_20250825", "name": "code_execution" }File input and output run over the Files API via a
container_uploadcontent block with theanthropic-beta: files-api-2025-04-14header — which this repository already references elsewhere.Docs: https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool
Two notes that may matter for prioritisation
web_search_20260209/web_fetch_20260209or newer are present in the same request. For anyone already running web search, the added cost would be token cost only.builtInToolsmechanism for custom endpoints, using xAI as the example — wherecode_executionis among the supported built-ins. It doesn't cover the first-party Anthropic endpoint and has been idle since April. Mentioning it in case the two are worth reconciling rather than solving twice.Happy to test against a self-hosted instance if that's useful.
All reactions