Skip to content
mentoor

Code execution as an agent's action

For engineers

Agents that write and run code instead of one tool call per turn: programmatic tool calling, code mode, sandboxes and risks

See where you stand

110 questions across four stages: Understand, Apply, Solve and Judge.

Try 5 questions

Practice items, not counted towards your mastery. No account needed.

Check yourself · 1 of 5

An agent must check 120 order IDs against a shipping API. Why is one script usually better than 120 separate tool-call turns?

Choose one answer

Check yourself · 2 of 5

What does programmatic tool calling change about how a model uses your tools?

Choose one answer

Check yourself · 3 of 5

An agent will run generated Python on a customer's uploaded file. Which network setting is the safest default?

Choose one answer

Check yourself · 4 of 5

What is wrong with wrapping every call in an agent's script in try/except and doing nothing on error?

Choose one answer

Check yourself · 5 of 5

Which task is the weakest fit for a code action?

Choose one answer

Topics

  1. Why code beats one call per turn4 min read · Loops, filtering and composing tools in code to cut model round trips and keep large intermediate data out of context
  2. Programmatic tool calling and code mode5 min read · Exposing tools as typed functions the model calls from a script, as in Claude programmatic tool calling, Cloudflare Code Mode and smolagents
  3. Sandboxing agent-written code5 min read · Containers, microVMs and hosted code-execution tools with filesystem, network, time and memory limits
  4. Failure modes of code-acting agents5 min read · Swallowed exceptions, partial outputs, data exfiltration through code and generated scripts nobody reviews

Start here

110 questions · last verified 2026-12