Limits and best practices

Code tools run in a restricted sandbox. Knowing the limits helps you design a tool that stays fast, predictable, and safe for an AI Agent to run mid-conversation.

Limits

Every run is sandboxed, with these limits:

  • Language: a sandboxed subset of Python. Importable modules are json, re, datetime, math, os, pathlib, sys, and typing, plus built-in helpers for hashing, Base64, URL-encoding, and UUIDs; no classes. See Supported Python.
  • Compute time: about 5 seconds per run.
  • Total time: a roughly 65-second ceiling end to end, including any network calls.
  • Result type: text, a number, true/false, a list, or an object. A code tool cannot return files or images.
  • Network access: deny-by-default. Code makes requests with the fetch function, reaching only the domains on your allowed-domains list plus your own Ada instance. Internal and metadata addresses are always blocked, and redirects are not followed. Up to 10 requests and a 1 MB response each per run.

Best practices

  • Keep each tool small and single-purpose. One tool should do one thing: reshape a response, run a calculation, or format a value. Small tools are easier to test and reuse across Playbooks.
  • Return only what the Agent needs. Trim the result to the specific fields the AI Agent will use. A smaller, well-named result is easier for the Agent to use correctly and keeps replies accurate.
  • Keep secrets in environment variables. Store API keys and other credentials as environment variables rather than in the code. Secrets are stored redacted. See Inputs, outputs, and environment.
  • Write a specific description. Describe exactly what the tool does and what it returns. A precise description helps the Agent choose the tool at the right moment and use its output as intended.