@tool when the capability should execute inside the agent server.
For isolated Python execution, call an assigned Sandbox through context.sandboxes["<name>"].execute(code) or async aexecute(code). Your tool validates inputs and selects the result to return; its surrounding code runs on the agent server.
tools/lookup_order.py
description tells the model what the tool does and when to call it. It replaces the function docstring; omit it to use the docstring instead. Include argument descriptions in whichever you use. This works with ADK and LangGraph.
Tool properties
Export a typed function fromtools/<name>.py, with a clear description and validated return type. See tool declaration options for schema and permission settings. You can call the decorated function directly in unit tests.
Arguments and results must be structured. Convert unsupported custom objects to a Pydantic model or mapping at the tool boundary.
Declare filters, pagination, and ordering as typed parameters or separate tools. Both frameworks reject unknown arguments and return repair guidance without echoing their 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