generate-python-runnability-test
Skill11k starsChanged 44 days agoApache-2.0View on GitHub
Generates a lightweight `tests/test_runnability.py` for a Python recipe. The test just imports the recipe's agent module and asserts that `root_agent is not None` (and `app is not None` if the module defines one). The skill parses agent.py with `ast` to figure out which import-time side effects need mocking (`vertexai.init`, `google.auth.default`) and which env vars need setting (`GOOGLE_CLOUD_PROJECT`, `INTEGRATION_TEST`), and only emits the boilerplate the recipe actually needs. Runs in dry-run (report + preview) and apply (write to disk) modes. Use when the user wants to "add a runnability test", "generate test_runnability.py", "create a smoke test for the recipe", or fix the missing-required-file failure from `python-validate-recipe.yml`.
1 other project uses a version of this.
Trending
More talk lately.about the whole repository
Most recently taken up by
- google/adk-recipesword for word, first seen Sep 28, 2026
Who's talking about google/adk-samples
- @stephanjanssen.be“Google just open sourced a Python Agent Development Kit @ github.com/google/adk-p... Native Streaming and …”Bluesky · Apr 9, 2025 · 12 likes
- google/adk-python“stream_query and HTTP Streaming to Vertex AI Agent Return Empty/Exhausted Responses (Works via ADK Web)”GitHub · Jul 8, 2025 · 5 reactions
- google/adk-recipes“Support running agents fully locally without Vertex AI (offline mode)”GitHub · Apr 14, 2025 · 4 reactions
- google/adk-recipes“[BUG]: Deployment of Data Science agent to Agent Engine fails ”GitHub · Oct 1, 2025 · 3 reactions
- A Hacker News story“CaMeL-Powered Secure Agent Demo with ADK”Hacker News · Aug 9, 2025 · 3 points
The biggest 5 of 32 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 32
Talked about on GitHub, Bluesky, Hacker News and Stack Overflow (32 times).
On GitHub · 23
- Jul 8, 2025stream_query and HTTP Streaming to Vertex AI Agent Return Empty/Exhausted Responses (Works via ADK Web) — google/adk-python5 reactions
- Apr 14, 2025Support running agents fully locally without Vertex AI (offline mode) — google/adk-recipes4 reactions · 7 comments
- Oct 1, 2025[BUG]: Deployment of Data Science agent to Agent Engine fails — google/adk-recipes3 reactions · 1 comment
- Oct 28, 2026docs: fix 5 broken internal anchor links and 1 dead external link — google-gemini/gemini-cli1 reaction · 4 comments
- Oct 20, 2026Update adk-samples references and python/agents discovery paths for google/adk-recipes restructure — google/agents-cli1 reaction · 2 comments
18 more on GitHub
- Oct 12, 2026list: scan the template dir we cloned, not the clone root — GoogleCloudPlatform/agent-starter-pack1 reaction
- Feb 12, 2026interrupted sometimes didn't work — google/adk-python1 reaction · 10 comments
- Jan 8, 2026Implement 5 ADK agent projects that can be easily run by newbies — addyosmani/adk-product-engineers1 reaction
- Nov 20, 2025[BUG]: deep-search/gemini-fullstack: Wrong prompt to access session state — google/adk-recipes1 reaction
- Jun 21, 2025unable to import StdioServerParameters — google/adk-recipes1 reaction · 2 comments
- Jun 17, 2025VertexAiRagRetrieval needs llama-index package — google/adk-recipes1 reaction · 3 comments
- Jun 5, 2025Bug: display_name in file uploads causes error with Google.GenAI backend (non-Vertex) — google/adk-python1 reaction · 6 comments
- May 18, 2025Missing Image — google/adk-recipes1 reaction
- Apr 11, 2025Duplicate key name — google/adk-recipes1 reaction · 1 comment
- Oct 18, 2026Fix(audit,#17387): Day4 Track2 tranche 1 -- Lab8/Lab9 reformulations honnetes, cures accents — jsboige/CoursIA0 reactions · 14 comments
- Sep 17, 2026Rename sample references to recipe across repository — google/adk-recipes0 reactions
- Sep 12, 2026docs(deep-search): fix cloud deployment instructions and scaffold path (#2575) — google/adk-recipes0 reactions · 4 comments
- Sep 12, 2026docs: fix 404 link to relocated Deep Search sample — google/adk-docs0 reactions · 1 comment
- Sep 9, 2026Add repo skills instructions and documentation links to AI issue response workflow — google/adk-recipes0 reactions
- Jul 24, 2026Fix broken adk-samples links from deleted sample agents and notebooks — google/adk-docs0 reactions · 1 comment
- Jun 12, 2026ci: run the spam-detection bot via the adk-samples reusable workflow — google/adk-go0 reactions · 1 comment
- May 27, 2026Add Deep Search Agent project to portfolio showcase — asafsilner/silner-showcase-prime0 reactions
- Feb 12, 2026fix: path typo in story teller example — google/adk-recipes0 reactions · 3 comments
On Bluesky · 4
- Apr 9, 2025Google just open sourced a Python Agent Development Kit @ github.com/google/adk-p... Native Streaming and #MCP support out of the box 👀… — @stephanjanssen.be12 likes and reposts
- Jul 12, 2026Exploring the ADK Samples repo from Google—it’s like a guidebook for building intelligent agents. Seeing multi-language support reflects… — @iam.slys.dev1 likes and repost
- Dec 9, 2025📦 google / adk-samples ⭐ 6,900 (+67) 🗒 Python A collection of sample agents built with Agent Development Kit (ADK) — @github-trending.bsky.social1 likes and repost
- May 20, 2025Explore practical use-cases & build! 🧪 Hands-on Patent Search Codelab: codelabs.developers.google.com/patent-searc... 📚 Check out sample… — @kweinmeister.bsky.social0 likes and reposts · 1 reply
On Hacker News · 3
- Aug 9, 2025CaMeL-Powered Secure Agent Demo with ADK3 points · 1 comment
- Jun 13, 2025A collection of sample agents built with Agent Development (ADK)2 points
- Aug 13, 2025CaMeL agent to protect against indirect prompt injection1 point · 1 comment
On Stack Overflow · 2
- Aug 30, 2025Google ADK SequentialAgent sub_agents not waiting for user input1 vote
- Aug 29, 2025Issue with deploying ADK Agent on Google Agent Engine0 votes
Other versions1 project uses a version of this.
Word for word · 1
- google/adk-recipes★ 11k100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository43 other files it gives its agents.
- AGENTS.mdAGENTS.md
- contrib/kotlin/llm-auditor/AGENTS.mdAGENTS.md
- core/python/adk-voice-agent/AGENTS.mdAGENTS.md
- core/python/adk-voice-agent/sandbox/home/AGENTS.mdAGENTS.md
- core/python/adk-voice-agent/tests/eval/fixtures/alex/repos/portland-trip/AGENTS.mdAGENTS.md
- core/python/ambient-expense-agent/AGENTS.mdAGENTS.md
- core/python/ambient-quality-agent/AGENTS.mdAGENTS.md
- core/python/cross-session-memory/AGENTS.mdAGENTS.md
- core/python/deep-search/AGENTS.mdAGENTS.md
- core/python/genmedia-for-commerce/AGENTS.mdAGENTS.md
- core/python/long-horizon-harness/AGENTS.mdAGENTS.md
- core/python/oauth-user-consent-flow/AGENTS.mdAGENTS.md
- core/python/rag-agent-search/AGENTS.mdAGENTS.md
- core/python/rag-vector-search/AGENTS.mdAGENTS.md
- core/python/safety-plugins/AGENTS.mdAGENTS.md
- core/python/adk-voice-agent/sandbox/home/CLAUDE.mdCLAUDE.md
- core/python/genmedia-for-commerce/CLAUDE.mdCLAUDE.md
- align-recipe-pyprojectSkill
- extract-python-environment-variablesSkill
- generate-manifestSkill
- github-pr-reviewSkill
- make-python-recipe-deployableSkill
- prepare-python-recipeSkill
- repo-oracleSkill
- scaffold-python-recipeSkill
- blog-writerSkill
- content-research-writerSkill
- approvalsSkill
- coding-workflowSkill
- connected-apps-mcpSkill
- deliverablesSkill
- filesystemSkill
- recommendationsSkill
- agents-cli-aquaSkill
- custom-investigationSkill
- rcaSkill
- bootstrap-google-toolsSkill
- find-skillsSkill
- google-workspaceSkill
- policySkill
- routinesSkill
- retail-product-searchSkill
- retail-virtual-tryonSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Use this skill to create the tests/test_runnability.py file that every Python recipe under core/python/, contrib/python/, or …
- Very specific: line 67
No files outside the target recipe directory are read (beyond the recipe's own .py files) or written.
- Very specific: line 79
Ask for the recipe directory: if the user hasn't given one.
- Distinctive: line 89
Offer to apply: after a dry-run. Do NOT paste the raw command as a copy-and-paste snippet for the user.
- Distinctive: line 154
Do not dump raw JSON. Render a compact table summarising the action and the detections, then include the generated file's content as a …
≈ “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
Generate Python Runnability Test
Use this skill to create the tests/test_runnability.py file that every Python recipe under core/python/, contrib/python/, or plugins/<vertical>/<solution>/ must ship (see python-validate-recipe.yml Check 4). The generated test is deliberately minimal — it just verifies the agent module imports and defines the expected globals. Business-logic testing lives elsewhere.
What This Skill Does
Runs scripts/generate_runnability_test.py against a recipe directory. Steps:
- Locate
agent.py. Walks the recipe safely (excludes.venv,venv,env,build,dist,__pycache__,node_modules,tests,*.egg-info, and dot-directories) and picks the shallowestagent.pymatch. If none is found, errors out and suggests--agent-file. Only one file is generated per invocation. - Parse
agent.pyAND every ancestor package__init__.pywithastto detect:- Top-level assignments (agent.py only, per convention) — is
root_agent = ...present? Isapp = ...present? - Import-time calls (agent.py + every ancestor
__init__.py) — doesvertexai.init(...)fire at module load? Doesgoogle.auth.default()? Every ancestor__init__.pyis checked because Python runs each of them in order when the test doesimport a.b.agent(a/__init__.py, thena/b/__init__.py, then the module), so a side effect in any of them matters as much as one inagent.py. Historical bug closed by this: cross-session-memory has_, project_id = google.auth.default()in__init__.py; before, the scanner missed it and the generated test crashed in CI without ADC. Detection usesast.walk(any depth), so it is intentionally broad — a call nested in a function body still flags the recipe; the resulting patch is a harmless no-op if it never fires at import time, whereas a missed import-time call would crash the generated test. - Env-var access (agent.py + every ancestor
__init__.py) — does the code readGOOGLE_CLOUD_PROJECTviaos.getenv/os.environ.get/os.environ["…"]? Only reads count: anos.environ["…"] = valuewrite means the recipe sets its own value and doesn't depend on the test providing one, so it's ignored.
- Top-level assignments (agent.py only, per convention) — is
- Scan all source
.pyfiles in the recipe directory tree (same safe walker) forINTEGRATION_TESTenv-var reads. This is a per-package convention:agent.pyoften calls a helper (e.g.retrievers.create_search_tool) at module load, and THAT helper — which may live anywhere in the recipe tree, not necessarily besideagent.py— is what readsINTEGRATION_TEST. Restricting the scan toagent.pywould miss it. Emit the test. Two shapes:
- Minimal (no side effects detected) — module-level
import <module>+assert root_agent is not None(andapp is not Noneif present). - Guarded (any side effect detected) — env-var
setdefaultcalls at the top of the test function; awith patch(...):block around the import listing every patch needed (patch("vertexai.init")when vertexai is used,patch("google.auth.default", return_value=(MagicMock(), "test-project"))when the recipe touchesgoogle.auth); and assertions outside thewithblock (the patches are only needed during import; keeping them active around assertions would be misleading).
The
google.auth.defaultpatch is what makes the test survive a recipe that callsgoogle.auth.default()unconditionally at import time (like cross-session-memory's__init__.py). Just settingGOOGLE_CLOUD_PROJECTisn't enough for that pattern — the call still fires and still needs valid ADC — hence the patch.Emission is post-processed through
ruff formatwhen available, so multi-patchwith (...):blocks come out already wrapped per the repo's ruff config.- Minimal (no side effects detected) — module-level
Check that the import can actually resolve. The generated test does
import <module_name>, which only works if the RECIPE ROOT is onsys.path. That is not automatic — under pytest's defaultprependimport mode only the test file's own directory (<recipe>/tests) is inserted. The recipe root gets there in one of these ways, reported asimport_support:import_supportMeaning installablepyproject.tomldeclares a[build-system], souv syncinstalls the project and the package is importable.pythonpath-ini[tool.pytest.ini_options].pythonpathincludes".".existing-conftestA conftest.pysits at the recipe root (sufficient whatever it contains — pytest puts each conftest's own directory onsys.path, and for that one it IS the recipe root), or atests/conftest.pythat demonstrably extendssys.path.generated-conftestNone of the above held, so the skill wrote tests/conftest.pywith a path shim.A
tests/conftest.pyis judged by AST, not text search: it counts only if it really touchessys.path, so a comment or docstring that merely mentionssys.pathcannot wrongly certify it.Historical bug closed by this: the recipe root being importable was assumed rather than checked. A recipe with no
[build-system]— common for vertical plugins underplugins/, where code lives in a plainscripts/directory rather than an installed package — got a test that always died withModuleNotFoundError, whileprepare-python-recipe'spy_compileverification still reported success.Adding a
[build-system]is the better fix; the generated conftest says so and tells the maintainer to delete it once they do.- Write it to
<recipe-dir>/tests/test_runnability.py(creatingtests/if needed), plustests/conftest.pywhen step 5 called for it. Refuses to clobber an existing file unless--overwriteis passed.
Edit safety
- No files outside the target recipe directory are read (beyond the recipe's own
.pyfiles) or written. - Existing
tests/test_runnability.pyis never silently overwritten. The user must explicitly opt in with--overwrite. - An existing
tests/conftest.pyis never overwritten, not even with--overwrite— the skill reportsconftest_action: skippedand warns instead. A conftest it did not write may do something clobbering would break. tests/directory is created if missing (mkdir -pequivalent). No other directory or file is added.- Ruff-clean by construction — the generated file passes
ruff checkandruff format --checkunder the root config.
Rules for the Agent
- Always use the script — never hand-write
tests/test_runnability.pyyourself. The skill exists to keep the boilerplate consistent across recipes. - Ask for the recipe directory if the user hasn't given one. Recipe roots live under
core/python/<name>/,contrib/python/<name>/, orplugins/<vertical>/<solution>/. - Always start with
--dry-rununless the user has explicitly said "apply", "generate it", "just do it", or equivalent. Show them what would land before writing. - Report only what matters. Render a compact 3-column Markdown table (Rule / Status / Details) summarising the action plus the detections. Do NOT dump the raw JSON or the raw generated Python. Include the generated file's content as a fenced code block below the table so the user can review before deciding.
- If action is
refused_overwrite, tell the user the file already exists and offer to re-run with--overwrite. Don't do it silently. - If action is
error, surface the message verbatim and stop. Common cases: noagent.pyfound (suggest--agent-file), parse error inagent.py. - Offer to apply after a dry-run. Do NOT paste the raw command as a copy-and-paste snippet for the user; ask something like "Want me to write this file?" and if they agree, run apply yourself.
After apply mode succeeds, remind the user to run the test locally to confirm it passes:
cd <RECIPE_DIR> && uv run pytest tests/test_runnability.py -v- Do not commit any changes. Show the diff or file contents; let the user commit.
Input
| Field | Required | Description |
--recipe-dir | Yes | Path to the recipe root (e.g. core/python/cross-session-memory, contrib/python/my-recipe, plugins/retail/store-ops). |
--dry-run | No | Print the JSON report (with the generated content in test_content) without writing any file. |
--overwrite | No | Overwrite an existing tests/test_runnability.py. Default: refuse and exit 1. |
--agent-file | No | Override auto-detection of the entry-point file. Path is relative to --recipe-dir (or absolute). Use when the recipe uses a non-standard layout (rare — <2% of recipes). |
Run
Dry-run (start here)
uv run --no-project python3 .agents/skills/generate-python-runnability-test/scripts/generate_runnability_test.py \
--recipe-dir <RECIPE_DIR> --dry-runOutput on stdout: JSON with agent_file, module_name, detections, import_support, conftest_path, conftest_action (would_write / wrote / skipped / null), test_content, action (would_write / refused_overwrite / error), message, and warnings (a list — surface every entry to the user). Exit code 0.
Note: no --with flags are needed — the script only uses Python's stdlib (ast, argparse, json, pathlib, dataclasses, os, sys, subprocess, textwrap). uv run --no-project python3 is used (rather than a bare python3) to guarantee a modern managed interpreter, consistent with the other Python recipe skills; the system python3 on macOS can still be an old version. Dry-runs remain cheap and side-effect-free.
Apply
uv run --no-project python3 .agents/skills/generate-python-runnability-test/scripts/generate_runnability_test.py \
--recipe-dir <RECIPE_DIR>Writes <RECIPE_DIR>/tests/test_runnability.py. Refuses if the file exists (exit 1).
Apply with overwrite
uv run --no-project python3 .agents/skills/generate-python-runnability-test/scripts/generate_runnability_test.py \
--recipe-dir <RECIPE_DIR> --overwriteOverride the entry-point file (rare)
uv run --no-project python3 .agents/skills/generate-python-runnability-test/scripts/generate_runnability_test.py \
--recipe-dir <RECIPE_DIR> --agent-file some/other/entry.py --dry-runPath is relative to --recipe-dir or absolute. The generated import uses the module path derived from the relative location (e.g. some/other/entry.py → import some.other.entry).
Respond
Do not dump raw JSON. Render a compact table summarising the action and the detections, then include the generated file's content as a fenced code block below.
Table shape
| Rule | Status | Details |
- Rule — a short label for what's being reported:
agent-file,module,detections,write. Use backticks for clarity. - Status —
ok/would_write/wrote/refused_overwrite/error. No emoji unless the user has asked. - Details — compact prose. For
detections, list only what was found (e.g. "root_agent, app, needs vertexai patch + GCP project env + INTEGRATION_TEST env"). Don't list what was NOT found.
After the table
- Show the generated
test_contentas a fenced Python code block so the user can review it before deciding.
Closing action
would_write(dry-run) — offer to apply yourself. Do NOT paste the raw command. Ask "Want me to write this file?" If the user agrees, run the apply command yourself and render the resulting report as another compact confirmation. If they decline, stop.refused_overwrite— tell the user the file already exists and offer to re-run with--overwrite. Do NOT overwrite silently. If they agree, run with--overwrite.error— surface the message verbatim and stop. Do not attempt to work around it.wrote(apply) — end with:Next steps: cd <RECIPE_DIR> && uv run pytest tests/test_runnability.py -v git diff # review before committing
Then stop. Do not commit. Do not run any further tools. End your turn.
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.

