$npx -y skills add GoogleCloudPlatform/cxas-scrapi --skill adkParsing and ingestion directives for the Python-based Agent Development Kit (ADK) conversational agent framework.
| 1 | # ADK Framework Ingestor Skill |
| 2 | |
| 3 | This skill standardizes how agents ingest, parse, and extract conversational |
| 4 | behaviors and Critical User Journeys (CUJs) from Python workspaces built on the |
| 5 | Agent Development Kit (ADK) framework. |
| 6 | |
| 7 | -------------------------------------------------------------------------------- |
| 8 | |
| 9 | ## 1. ADK Workspace Layout |
| 10 | |
| 11 | An ADK workspace typically consists of multiple decoupled microservices, each |
| 12 | containing its own python project. The structure below is illustrative; actual |
| 13 | directory and file names may vary: |
| 14 | |
| 15 | ``` |
| 16 | <workspace_root>/ |
| 17 | ├── <service_name>/ # Individual project directory (e.g., router, auth, useraccount) |
| 18 | │ ├── main.py # Fast API or WebSocket entry point |
| 19 | │ ├── ReadMe.md # Setup and configuration details |
| 20 | │ ├── pyproject.toml # Dependency list |
| 21 | │ ├── vitals.yaml # Health check parameters |
| 22 | │ └── app/ # Core application module |
| 23 | │ ├── agents/ # Individual conversational agent definitions |
| 24 | │ │ └── <agent_name>/ |
| 25 | │ │ ├── agent.py # Configures the agent, lists tools, and declares child agents |
| 26 | │ │ ├── prompt.py # Defines raw prompt strings and formatting logic |
| 27 | │ │ └── tools.py # Implements agent-specific tool methods |
| 28 | │ ├── config/ # Environment configuration module |
| 29 | │ │ ├── app.py # General settings and global prompts |
| 30 | │ │ └── state.py # Defines state machine keys and initializer dictionaries |
| 31 | │ └── services/ # Back-end service integrations |
| 32 | ``` |
| 33 | |
| 34 | -------------------------------------------------------------------------------- |
| 35 | |
| 36 | ## 2. Ingestion & Parsing Directives |
| 37 | |
| 38 | Unlike declarative frameworks, ADK agent behaviors are defined procedurally in |
| 39 | Python. The parser MUST dynamically discover and extract conversational behaviors |
| 40 | following these directives (do not assume the specific names in the examples below |
| 41 | are present in the target codebase): |
| 42 | |
| 43 | ### A. Agent Registry Parsing |
| 44 | |
| 45 | 1. **Root Agent Discovery**: Identify the primary entry agent by inspecting the |
| 46 | application entry points (e.g., `main.py` or the main router service). Locate |
| 47 | its definition file (typically under `app/agents/<root_agent_name>/agent.py`) |
| 48 | and extract the root agent class declaration. |
| 49 | 2. **Sub-Agent Mapping**: Trace how child agents are registered. Look for |
| 50 | dictionaries or lists mapping states to agents (common patterns include |
| 51 | variables like `state_agents`, `sub_agents`, or transition mappings) to |
| 52 | establish the agent hierarchy. |
| 53 | 3. **Registered Tools Identification**: Map python tool functions passed to the |
| 54 | agent constructor (typically via a `tools=[...]` argument or decorator). Trace |
| 55 | their parameter structures in the corresponding `tools.py` or imported modules. |
| 56 | * **Rule**: If a python tool function invokes helper methods from an external |
| 57 | toolset (e.g., `tools.<toolset_name>_<operation>`), classify this tool as |
| 58 | a **Webhook**. Recursively extract its parameter/response schemas from the |
| 59 | associated OpenAPI specification (typically found in |
| 60 | `toolsets/<toolset_name>/open_api_toolset/open_api_schema.yaml` or similar). |
| 61 | |
| 62 | ### B. Prompt & Constraint Extraction |
| 63 | |
| 64 | Read the prompt definition files (typically `prompt.py` or `prompts.py`) associated |
| 65 | with each discovered agent: |
| 66 | |
| 67 | 1. **Primary Prompt Text**: Locate the core prompt string variables containing |
| 68 | system instructions (e.g., variables ending in `_PROMPT`). |
| 69 | 2. **Custom Verbalization Rules**: Extract programmatic formatting blocks or |
| 70 | string concatenations that append mandatory verbal instructions (e.g., rules |
| 71 | forcing the agent to relay messages verbatim or format specific outputs). |
| 72 | |
| 73 | ### C. State Machine & Variable Mapping |
| 74 | |
| 75 | Because state transitions are written in Python, you MUST map the context |
| 76 | variables used for flow control (typically defined in `app/config/state.py` or |
| 77 | equivalent state configuration files): |
| 78 | |
| 79 | 1. **Context Variables**: Catalog all state keys or context variables (e.g., |
| 80 | session variables, flags, or status codes) that act as triggers for branching. |
| 81 | 2. **Transition Conditions**: Analyze the agent's decision logic (e.g., in |
| 82 | `callbacks.py` or transition handler methods) to map conditional checks |
| 83 | directing flows to other agents (e.g., checking if a user is authenticated |
| 84 | before transferring to a secure agent). |
| 85 | |
| 86 | -------------------------------------------------------------------------------- |
| 87 | |
| 88 | ## 3. Dialogue Simulation Guidelines |
| 89 | |
| 90 | When simulating natural dialogue transcripts from parsed ADK models, follow |
| 91 | these guidelines: |
| 92 | |
| 93 | 1. **Dialogue Entry Triggers**: Start the dialogue with a `User` turn that |
| 94 | naturally triggers the entry conditions for the target state or agent being |
| 95 | t |