Code Execution Toolpublic

Last verified 21 Sep 2026

Action Gateway gives applications and AI agents governed access to tens of thousands of tools through a managed MCP endpoint or SDK. See What You Can Build for example use cases of Action Gateway with Harness Runtime.

Action Gateway’s action_code meta tool gives your agent an ephemeral sandbox to run Python. Use it for calculations, parsing, or data processing without searching for or calling another tool.

Sandbox Execution

The agent supplies Python source in the code argument. The response contains standard output, standard error, and the exit code. Print the results the agent needs; variables are not automatically returned.

Each call starts a fresh sandbox. Files, variables, and installed packages do not persist between calls, even within the same Action Gateway session. An execution time limit applies, including time spent calling tools.

A session’s VPC attachment lets the sandbox access private resources, subject to their authentication and network controls.

Advanced: Programmatic Tool Calling

With programmatic tool calling, the agent writes Python that calls tools and processes their results before returning output to the model. For example, fetch issues, filter them by date, and print a summary instead of returning every issue. Fewer model round trips and fewer tool-result tokens can reduce latency and inference costs.

The sandbox provides invoke_digitalocean_tool(name, arguments) for these calls. Use Tool Search to find tool names and input schemas. Check each call’s success or failure before using its output.

Calls use the session’s tool policy, provider connections, and output views. Running Python does not bypass approvals or provider authorization. Completed tool actions are not rolled back if a later step fails; check retry and idempotency behavior before repeating writes.

Pricing

Code execution has separate compute and memory charges. Tools called from Python also incur their applicable invocation and provider charges. See Action Gateway Pricing.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.