add-ai-sub-agent
Skill44 starsChanged 5 months agoApache-2.0View on GitHub
Step-by-step workflow for adding a new sub-agent or tool to the Pulse AI system. Use when creating a new ADK agent, tool, or extending the AI pipeline in pulse_ai/.
In this repository20 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- product/CLAUDE.mdCLAUDE.md
- pulse-web-otel/CLAUDE.mdCLAUDE.md
- add-alert-metricSkill
- add-api-endpointSkill
- add-ui-componentSkill
- add-ui-screenSkill
- clickhouse-migrationSkill
- deploy-serviceSkill
- fatal-fiveSkill
- integrate-pulse-web-sdkSkill
- pr-reviewSkill
- pulse-prd-authorSkill
- pulse-prd-reviewSkill
- web-otel-spec-audit-orchestratorSkill
- web-otel-spec-implementation-auditSkill
- web-sdk-e2e-matrixSkill
- web-sdk-instrumentSkill
- web-sdk-shipSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Add new constants to pulse_ai/constants.py:
- Very specific: line 37
Create a new file at the pulse_ai/ root (e.g., pulse_ai/tools.py or pulse_ai/my_tool.py):
- Very specific: line 52
Create a new file at the pulse_ai/ root (e.g., pulse_ai/planner.py):
- Very specific: line 69
Update pulse_ai/agent.py to import and include the new sub-agent:
- Very specific: line 101
Test via the ADK web UI at http://localhost:8000.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
Add AI Sub-Agent or Tool
Current State
The AI agent has a flat structure — a single root LlmAgent in agent.py with constants in constants.py. Sub-agents, tools, and registries do not exist yet. Follow this workflow when adding new capabilities.
Workflow
- [ ] Step 1: Define constants
- [ ] Step 2: Create tool function (if needed)
- [ ] Step 3: Create the sub-agent
- [ ] Step 4: Wire into root agent
- [ ] Step 5: Test the agentStep 1: Constants
Add new constants to pulse_ai/constants.py:
MY_NEW_CONSTANT = "my_value"For environment-based config, follow the existing pattern:
import os
MY_VALUE = os.getenv("MY_ENV_KEY", "default")Step 2: Create Tool
Create a new file at the pulse_ai/ root (e.g., pulse_ai/tools.py or pulse_ai/my_tool.py):
from google.adk.tools import FunctionTool
from google.adk.tools.tool_context import ToolContext
def my_tool(tool_context: ToolContext) -> dict:
result = do_something()
return {"status": "success", "data": result}
my_function_tool = FunctionTool(my_tool)Step 3: Create Sub-Agent
Create a new file at the pulse_ai/ root (e.g., pulse_ai/planner.py):
from google.adk.agents.llm_agent import Agent
from constants import agent_model
planner_agent = Agent(
model=agent_model,
name="planner_agent",
description="Plans the analysis approach.",
instruction="Your instructions here.",
tools=[my_function_tool],
)Step 4: Wire Into Root Agent
Update pulse_ai/agent.py to import and include the new sub-agent:
from planner import planner_agent
root_agent = Agent(
model=agent_model,
name='root_agent',
description='...',
instruction='...',
sub_agents=[planner_agent],
)Or use SequentialAgent / ParallelAgent for pipeline orchestration:
from google.adk.agents import SequentialAgent
pipeline = SequentialAgent(
name="pipeline",
sub_agents=[planner_agent, executor_agent, summary_agent],
)Step 5: Test
cd pulse_ai && ./setup.sh restart # rebuild Docker container
./setup.sh logs # check for startup errors
curl -sf http://localhost:8000/health # verify healthTest via the ADK web UI at http://localhost:8000.
Agent Types Reference
| Type | Use |
Agent / LlmAgent | LLM-powered agents with instructions + tools |
SequentialAgent | Pipeline of sub-agents run in order |
ParallelAgent | Sub-agents run concurrently |
LoopAgent | Iterative refinement until exit condition |
BaseAgent | Custom routing logic |
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.

