@tool when the capability should execute inside the agent server.
When only part of a tool needs isolated Python execution, call an assigned Sandbox through context.sandboxes["<name>"].execute(code) or async aexecute(code). The model calls your business tool, not the sandbox directly; your tool validates inputs and chooses which result to return. The surrounding tool code still runs in the agent server.
tools/lookup_order.py
Tool properties
Arguments and results must be structured. Convert unsupported custom objects to a Pydantic model or mapping at the tool boundary.
Expose supported filters, pagination, and ordering as typed parameters or separate typed tools. Do not ask the model to invent undeclared options. Managed ADK and LangGraph reject unknown argument names before native framework coercion and return repair guidance without echoing argument values.
Runtime access
Credentials are private invocation capabilities. Do not expose them as model-generated arguments or ordinary context resources.
Use
permission= when trusted application code must select whether the tool is available for one invocation. An active principal denies an untagged tool. See Agent Runtime Principals.
Wait durably
Use an async durable tool when queued or external work must survive a request ending or a replica stopping:tools/request_report.py
durable=True resumes framework execution; it does not restore a Python frame. See Durable execution.
Add approval
- Every call
- After evaluation