safe-api-tool-calls
Skill9 starsChanged 17 days agoMITView on GitHub
Implement, adapt or review safe external API tools in Python and ADK projects, including selective retries, cooperative deadlines, idempotent writes and the write side of confirmation (a missing or rejected confirmation never runs the side effect; an approved write runs once). Use for unreliable API calls, ambiguous write outcomes, unsafe tool replay or setup failures blocking ADK API verification. Do not activate for model-only tuning or retries on the model's own 429 or quota errors (adk-model-and-output-contracts owns model settings), deciding which actions need human approval (adk-operational-guardrails), session continuation or memory (adk-memory-architecture), MCP or A2A connection wiring (adk-agent-interoperability), tool docstrings or error wording for the model (adk-tool-interface-design), general cloud deployment, UI-only changes or database query optimisation without an external-call safety problem.
- Reads credentials
In this repository25 other files it gives its agents.
- adk-agent-evaluationSkill
- adk-agent-instructionsSkill
- adk-agent-interoperabilitySkill
- adk-agent-observabilitySkill
- adk-agent-securitySkill
- adk-discoverySkill
- adk-engineerSkill
- adk-fastapi-backendSkill
- adk-frontend-integrationSkill
- adk-governance-packSkill
- adk-memory-architectureSkill
- adk-model-and-output-contractsSkill
- adk-operational-guardrailsSkill
- adk-portability-planningSkill
- adk-presenterSkill
- adk-release-engineeringSkill
- adk-sql-agent-engineeringSkill
- adk-system-designerSkill
- adk-tool-auth-and-secretsSkill
- adk-tool-interface-designSkill
- adk-workflow-designSkill
- deploy-adk-on-google-cloudSkill
- optimise-adk-on-google-cloudSkill
- practice-profileSkill
- protect-adk-sensitive-dataSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Read project instructions, dependency manifests and lockfiles, API adapters, tool registration, error contracts and relevant tests.
- Distinctive: line 62
Put retry policy in trusted code and make it provider-specific.
- Distinctive: line 81
Keep configuration examples synthetic and configurable.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Safe API tool calls
Deliver a small integration change or an actionable review that bounds API work, preserves operation identity and reports uncertain outcomes honestly. Work with the target's existing clients, tool interfaces, package manager and tests. The book and companion repository are not dependencies.
Inspect before choosing a mode
- Read project instructions, dependency manifests and lockfiles, API adapters, tool registration, error contracts and relevant tests. Trace one request from the public tool to the provider, including SDK retries and confirmation.
- Identify the actual Python, ADK and client versions using the project's existing interpreter and declared pins. Do not install, upgrade or downgrade packages to reproduce the historical example. Read compatibility and evidence before using version-dependent ADK or timeout behaviour.
- Establish whether the operation reads state or changes it. For writes, find the provider's replay contract, the trusted business identity, payload binding, authorisation and existing durable storage. An HTTP method, a UUID or a prompt is not enough evidence of safe replay.
- Record the permitted attempts, complete operation budget, cancellation behaviour, result schema and validation command. Ask only for missing decisions that cannot be inferred from source or authoritative provider documentation. Continue independent offline work while external prerequisites remain unresolved.
For a bounded, read-only inventory, resolve SKILL_DIR to this skill's installed directory and run the helper with an available Python 3.11+ interpreter (interpreters). If none is available, inspect manually without changing the target's Python version:
python "$SKILL_DIR/scripts/inspect_project.py" --project .The helper reads source and declarations without importing project code, loading .env, running commands or contacting services. Its signals direct inspection; they do not certify safety or report the installed dependency versions. Read inspection limits when using its output. A partial scan is a reason to inspect the omitted area, not a clean result.
Choose the relevant path
| Mode | Decision and reference |
| Read or replay-safe request | Read reads and deadlines; implement selective retries and separate transport, attempt and complete-operation budgets. |
| State-changing request or approval flow | Read writes and confirmation before enabling retries. If replay safety is unknown, retain a single attempt and an honest uncertain result; prepare reconciliation or a provider-contract question. |
| ADK integration setup, project migration or local runtime cleanup | Read ADK operations for configuration precedence, actual runtime identity, recoverable API activation and owned local state. This supplies no managed application deployment recipe. |
| Review or recommendation | Use the applicable reference above. Compare guarantees against actual control flow and tests; report concrete findings without changing code unless requested. |
A request may need both read and write paths. Keep them in the same skill; do not replace the application with a demonstration project or introduce a database solely because the chapter discusses one.
Implement the smallest coherent change
State a short plan naming the affected boundary and tests before broad edits. Reuse an existing retry layer, operation store and result contract where they can express the required guarantee. Change public interfaces only when necessary, identifying affected callers.
Put retry policy in trusted code and make it provider-specific. Distinguish internal attempts from a new tool invocation. A bounded tool call is not a bounded model conversation. Preserve caller cancellation and inspect the actual deadline object's state before attributing a timeout.
For a write, preserve the same authorised logical operation, canonical payload and provider replay identity across permitted retries; a workflow node that re-runs on resume (ADK 2.9.0 and later) is a retry in this sense, see writes and confirmation. Reconcile an ambiguous outcome; a later rejected attempt does not establish that earlier attempts had no effect. Durable recovery, exact money and business authorisation are production design requirements, not features supplied by this skill or by a mock test.
For ADK, test the real tool wrapper and chosen client/session path. Missing or rejected confirmation must not run the side effect. Rejection should be explained as cancellation with no attempt, separately from provider uncertainty. Confirmation does not authenticate the caller; prompt instructions do not deterministically block another approved tool call.
Permissions and consequential operations
<!-- shared:consequential-operations-brief -->Inspection is read-only, and code generation authorises no deployment, paid call or live test. Before any consequential operation (an API, billing or quota change, a billable resource, a secret, IAM, a data migration, a deployment, a deletion, or a paid or destructive test), read consequential operations, present the exact scope and limits, obtain explicit approval and end the turn to wait for it. Cleanup is a separate confirmed operation on resources this workflow created.
<!-- /shared:consequential-operations-brief -->Keep configuration examples synthetic and configurable.
Validate and finish
Read validation and reporting for the selected behaviour. Run the project's existing checks without network calls by default. Cover the public tool/client boundary, real cancellation or retry sleeps where relevant, transient recovery, terminal failure and the write/confirmation invariants. Do not substitute a print-only random demo for assertions.
For ADK HTTP/confirmation tests, live-call limit enforcement or latency diagnosis, also read ADK verification. It explains the concrete test boundaries and failure diagnosis behind the historical results.
On a second invocation, inspect existing changes and recorded state, rerun the relevant checks, and avoid duplicating wrappers, configuration, keys or resources. If the pinned version cannot support the chosen implementation, identify the incompatible API and stop that path; adapt within the existing version or request a version decision rather than silently changing dependencies.
Report files changed, commands and actual results, remaining actions, and unverified behaviour. Measure successful retrieval separately from response time, including error responses. Never promote a mock payment, a source syntax check or a historical test into production integration proof.
<!-- shared:evidence-labels-brief -->Label each result with its tier (offline, local, live or release) and
outcome (pass, fail, blocked or not run) as
evidence labels defines them;
earlier, vendor and documentation-only results are historical,
vendor-measured or guidance, never this session's evidence.
<!-- /shared:evidence-labels-brief -->Independent community project; not affiliated with or endorsed by Google.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

