agentleFS
dream-horizon-orgdream-horizon-org/pulse/.agents/skills/add-ai-sub-agent/SKILL.md

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/.

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
  1. Very specific:

    Add new constants to pulse_ai/constants.py:

    line 24
  2. Very specific:

    Create a new file at the pulse_ai/ root (e.g., pulse_ai/tools.py or pulse_ai/my_tool.py):

    line 37
  3. Very specific:

    Create a new file at the pulse_ai/ root (e.g., pulse_ai/planner.py):

    line 52
  4. Very specific:

    Update pulse_ai/agent.py to import and include the new sub-agent:

    line 69
  5. Very specific:

    Test via the ADK web UI at http://localhost:8000.

    line 101

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 agent

Step 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 health

Test via the ADK web UI at http://localhost:8000.

Agent Types Reference

TypeUse
Agent / LlmAgentLLM-powered agents with instructions + tools
SequentialAgentPipeline of sub-agents run in order
ParallelAgentSub-agents run concurrently
LoopAgentIterative refinement until exit condition
BaseAgentCustom routing logic

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.