Code Agents vs Tool-Calling Agents

Two action paradigms: generating code to run vs producing structured tool calls.

There are two dominant paradigms for how agents take actions:

  • Code agents: the model writes code (variables, control flow, error handling) that is executed in a sandbox.
  • Tool-calling agents: the model emits structured calls (JSON / function call) to a fixed set of tools.

Trade-offs

  • Code agents can be more flexible and require fewer “tool steps”, but need strong isolation.
  • Tool-calling is simpler and more governable, but can be brittle if the tool set is incomplete.