Skip to content

marcuskbra/neuro-diver-agents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

19 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NeuroDiverAgents Banner

Kaggle Agents Intensive - Capstone Project | Track: Agents for Good

GitHub Kaggle Python Google ADK


NeuroDiverAgents

AI-powered multi-agent system to support parents of neurodivergent children (ADHD + ASD Level 1) with behavioral understanding, evidence-based strategies, and activity planning.


๐ŸŽฏ Project Overview

This capstone project demonstrates 8+ capabilities from the 5-Day AI Agents Intensive Course:

Day Capability Implementation
1 Multi-agent hierarchical system Manager + 5 specialist agents
2 Tools & MCP GoogleSearchTool, Custom FunctionTools, AgentTools
3 Memory & Context Cross-session learning, personalization
1 Agent orchestration Manager delegates to specialists
2 Custom tools Behavior classifier, activity database, pattern analyzer
4 Session management Conversation context, state tracking
5 ParallelAgent Concurrent expert consultation (ADHD + ASD + Dev)
5 SequentialAgent Research pipeline (Research โ†’ Analyze โ†’ Synthesize)

๐Ÿ—๏ธ System Architecture

Multi-Agent Hierarchical Design

This project implements a hierarchical multi-agent system using Google ADK with type-safe Pydantic models throughout.

Run the cell below to see the interactive architecture diagram!

Agent Hierarchy Overview

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚            ๐ŸŽฏ PARENTING COORDINATOR                     โ”‚
                    โ”‚                   (Manager Agent)                       โ”‚
                    โ”‚  โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” โ”‚
                    โ”‚  โ€ข Orchestrates all specialist agents                   โ”‚
                    โ”‚  โ€ข Routes questions to appropriate experts              โ”‚
                    โ”‚  โ€ข Synthesizes multi-perspective responses              โ”‚
                    โ”‚  โ€ข Tools: All 5 specialists as AgentTools               โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                โ”‚
            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
            โ”‚               โ”‚                   โ”‚                   โ”‚                  โ”‚
            โ–ผ               โ–ผ                   โ–ผ                   โ–ผ                  โ–ผ
   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ”‚   ๐Ÿง  ADHD   โ”‚  โ”‚  ๐ŸŒˆ ASD     โ”‚   โ”‚  ๐Ÿ“Š DEV     โ”‚   โ”‚  ๐Ÿ’พ MEMORY  โ”‚   โ”‚  ๐Ÿ“… ACTIVITY    โ”‚
   โ”‚   Expert    โ”‚  โ”‚  Expert     โ”‚   โ”‚  Expert     โ”‚   โ”‚  Agent      โ”‚   โ”‚  Planner        โ”‚
   โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚   โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚   โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚   โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
   โ”‚ Executive   โ”‚  โ”‚ Sensory     โ”‚   โ”‚ Age-typical โ”‚   โ”‚ Pattern     โ”‚   โ”‚ Structured      โ”‚
   โ”‚ function    โ”‚  โ”‚ processing  โ”‚   โ”‚ milestones  โ”‚   โ”‚ learning    โ”‚   โ”‚ activity plans  โ”‚
   โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚   โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚   โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚   โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
   โ”‚ ๐Ÿ”ง Tools:   โ”‚  โ”‚ ๐Ÿ”ง Tools:   โ”‚   โ”‚ ๐Ÿ”ง Tools:   โ”‚   โ”‚ ๐Ÿ”ง Tools:   โ”‚   โ”‚ ๐Ÿ”ง Tools:       โ”‚
   โ”‚ โ€ข Search    โ”‚  โ”‚ โ€ข Search    โ”‚   โ”‚ โ€ข Search    โ”‚   โ”‚ โ€ข Pattern   โ”‚   โ”‚ โ€ข Activity      โ”‚
   โ”‚ โ€ข Behavior  โ”‚  โ”‚ โ€ข Behavior  โ”‚   โ”‚             โ”‚   โ”‚   Analyzer  โ”‚   โ”‚   Planner       โ”‚
   โ”‚   Classifierโ”‚  โ”‚   Classifierโ”‚   โ”‚             โ”‚   โ”‚             โ”‚   โ”‚                 โ”‚
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Specialist Agents

Agent Focus Area Tools Key Capabilities
๐Ÿง  ADHD Expert Executive function GoogleSearch, BehaviorClassifier Working memory, task initiation, impulse control
๐ŸŒˆ ASD Expert Sensory processing GoogleSearch, BehaviorClassifier Routines, social interaction, flexibility
๐Ÿ“Š Dev Expert Milestones GoogleSearch Age-appropriate expectations, typical development
๐Ÿ’พ Memory Agent Personalization PatternAnalyzer Session history, successful strategies
๐Ÿ“… Activity Planner Structured plans ActivityPlanner Materials, timing, success criteria

Type-Safe Design: All models use Pydantic v2 with strict type checking, discriminated unions for results, and comprehensive validation.

Agent Specializations

1. ADHD Expert

  • Executive function challenges (working memory, task initiation, organization)
  • Attention regulation and impulse control
  • Tools: GoogleSearchTool, BehaviorClassifier
  • Searches: CHADD, Russell Barkley research, ADDitude Magazine

2. ASD Expert

  • Sensory processing differences
  • Communication patterns and social interaction
  • Need for routine and predictability
  • Tools: GoogleSearchTool, BehaviorClassifier
  • Searches: Autism Speaks, CDC autism resources, Temple Grandin

3. Developmental Expert

  • Age-appropriate expectations for 8-year-olds
  • Typical developmental milestones
  • Distinguishing neurodivergent from age-typical behaviors
  • Tools: GoogleSearchTool
  • Searches: CDC milestones, AAP guidelines

4. Memory Agent

  • Pattern learning from session history
  • Identifying what works for THIS specific child
  • Personalized recommendations based on past successes
  • Tools: PatternAnalyzer (custom)

5. Activity Planner

  • Structured activity plans with materials and setup
  • Executive function, transitions, homework, engagement activities
  • Incorporates past successful approaches
  • Tools: ActivityPlanner (custom)

6. Parenting Coordinator (Manager)

  • Orchestrates all 5 specialist agents
  • Routes questions to appropriate specialists
  • Synthesizes insights from multiple perspectives
  • Maintains empathetic, supportive communication
  • Tools: All 5 specialists as AgentTools

ADK Orchestration Patterns

This project implements advanced ADK orchestration patterns for multi-agent coordination:

ParallelAgent: Concurrent Expert Consultation

from google.adk.agents import ParallelAgent
from capstone.agents import create_adhd_expert, create_asd_expert, create_developmental_expert

# Consult all three specialists simultaneously
expert_panel = ParallelAgent(
    name="parallel_expert_panel",
    description="Consults ADHD, ASD, and developmental experts in parallel",
    sub_agents=[create_adhd_expert(), create_asd_expert(), create_developmental_expert()],
)

Use Cases:

  • Get multiple perspectives on a behavior simultaneously
  • Reduce latency when consulting multiple specialists
  • Compare recommendations from different domains

SequentialAgent: Structured Research Pipeline

from google.adk.agents import SequentialAgent
from capstone.agents import create_adhd_expert, create_asd_expert, create_developmental_expert

# Create sequential research pipeline
# Flow: ADHD Expert โ†’ ASD Expert โ†’ Developmental Expert
pipeline = SequentialAgent(
    name="research_pipeline",
    description="Sequential pipeline: Research โ†’ Analyze โ†’ Synthesize",
    sub_agents=[create_adhd_expert(), create_asd_expert(), create_developmental_expert()],
)

Use Cases:

  • Deep investigation workflows requiring multiple stages
  • Building on previous analysis (Research โ†’ Analyze โ†’ Synthesize)
  • Structured problem-solving with clear stages

๐Ÿ“ Project Structure

neurodiveragents/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ capstone/
โ”‚       โ”œโ”€โ”€ models/
โ”‚       โ”‚   โ”œโ”€โ”€ behavior.py       # BehaviorInput, BehaviorAnalysis, Enums
โ”‚       โ”‚   โ”œโ”€โ”€ activity.py       # ActivityPlan, ActivityRequest
โ”‚       โ”‚   โ”œโ”€โ”€ strategy.py       # Strategy, BehaviorResponse
โ”‚       โ”‚   โ”œโ”€โ”€ memory.py         # SessionOutcome, BehaviorPattern
โ”‚       โ”‚   โ””โ”€โ”€ results.py        # ToolSuccess, ToolError, ToolResult
โ”‚       โ”œโ”€โ”€ tools/
โ”‚       โ”‚   โ”œโ”€โ”€ behavior_classifier.py   # Type-safe behavior analysis
โ”‚       โ”‚   โ”œโ”€โ”€ activity_planner.py      # Type-safe activity planning
โ”‚       โ”‚   โ””โ”€โ”€ pattern_analyzer.py      # Type-safe pattern recognition
โ”‚       โ”œโ”€โ”€ agents/
โ”‚       โ”‚   โ”œโ”€โ”€ coordinator.py           # Manager/coordinator agent
โ”‚       โ”‚   โ”œโ”€โ”€ specialist_factory.py    # Factory for specialist agents
โ”‚       โ”‚   โ”œโ”€โ”€ agent_configs.py         # Agent configurations and prompts
โ”‚       โ”‚   โ”œโ”€โ”€ tool_wrappers.py         # ADK tool wrapper functions
โ”‚       โ”‚   โ”œโ”€โ”€ tool_formatters.py       # Output formatting utilities
โ”‚       โ”‚   โ”œโ”€โ”€ specialist_helpers.py    # Specialist consultation helpers
โ”‚       โ”‚   โ””โ”€โ”€ retry_config.py          # API retry configuration
โ”‚       โ””โ”€โ”€ infrastructure/
โ”‚           โ””โ”€โ”€ agent_factory.py         # AgentFactory with caching
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ unit/                    # Unit tests (237 tests, 94% coverage)
โ”‚   โ””โ”€โ”€ conftest.py              # Test fixtures
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ api_reference.md         # Complete API documentation
โ”‚   โ”œโ”€โ”€ architecture_guide.md    # System architecture guide
โ”‚   โ”œโ”€โ”€ typing_guide.md          # Type safety patterns
โ”‚   โ”œโ”€โ”€ testing_guide.md         # Testing best practices
โ”‚   โ””โ”€โ”€ best_practices.md        # Python best practices
โ”œโ”€โ”€ demo_tools.py                # Demonstration of type-safe tools
โ”œโ”€โ”€ demo_agents.py               # Multi-agent system demo
โ”œโ”€โ”€ demo_comprehensive.py        # Full capability demonstration
โ”œโ”€โ”€ pyproject.toml               # Dependencies and configuration
โ””โ”€โ”€ README.md                    # This file

๐Ÿš€ Setup

Prerequisites

  • Python 3.12+
  • uv (recommended) or pip

Installation

# Install dependencies
uv sync

# Or with pip
pip install -e ".[dev]"

Set up Google API Key

export GOOGLE_API_KEY="your-api-key-here"

๐Ÿงช Demos

Demo 1: Type-Safe Tools

Run the foundational tools demo:

uv run python demo_tools.py

This demonstrates:

  1. Behavior Classification: Type-safe analysis of ADHD/ASD/age-typical factors
  2. Activity Planning: Structured activity plans with complete preparation
  3. Pattern Analysis: Learning from past session outcomes

Demo 2: Multi-Agent System (Standard)

Run the standard ADK multi-agent demo:

export GOOGLE_API_KEY="your-api-key-here"
uv run python demo_agents.py

This demonstrates:

  1. Scenario 1: Behavioral analysis with specialist consultation
  2. Scenario 2: Activity planning with memory integration
  3. Scenario 3: Pattern learning from session history

Duration: ~5 minutes | Scenarios: 3

Demo 3: Comprehensive System (Recommended for Presentations)

Run the comprehensive demo with all capabilities:

export GOOGLE_API_KEY="your-api-key-here"
uv run python demo_comprehensive.py

This demonstrates all 6 scenarios showcasing:

  1. Multi-Factor Analysis: ADHD vs ASD vs age-typical behavior
  2. Sensory Processing: ASD sensory meltdown analysis
  3. Activity Planning: Structured bedtime routine creation
  4. Pattern Learning: Memory agent analyzing session history
  5. Impulsivity Assessment: ADHD + developmental expert collaboration
  6. Complex Multi-Factor: ALL 5 specialists working together

Features:

  • ๐ŸŽจ Color-coded output for clarity
  • ๐Ÿ“Š Detailed metrics tracking (agents, tools, performance)
  • ๐Ÿ”ง All 3 custom tools demonstrated
  • ๐Ÿ‘ฅ All 5 specialist agents activated
  • โšก Smart retry handling and rate limit protection
  • ๐Ÿ“ˆ Comprehensive analytics summary

Duration: ~12 minutes | Scenarios: 6 | Full Capabilities: Yes

See: DEMO_GUIDE.md for complete demo documentation

Showcases:

  • Multi-agent hierarchical orchestration (Manager + 5 specialists)
  • AgentFactory dependency injection (no global state)
  • Custom function tools with Pydantic validation
  • Google Search integration (GoogleSearchTool)
  • Cross-session learning and personalization
  • Production-ready error handling and metrics

๐Ÿ” Type Safety Features

This project follows rigorous Python type safety best practices:

โœ… No Dict[str, Any]

All domain data uses Pydantic models with strict validation:

class BehaviorInput(BaseModel):
    description: str = Field(..., min_length=10, max_length=1000)
    time_of_day: TimeOfDay  # Enum, not string!
    activity_type: ActivityType  # Enum, not string!

โœ… Discriminated Unions for Results

Tool results are always Success OR Error, never mixed:

ToolResult = Union[ToolSuccess, ToolError]

result = classify_behavior(input)
if is_success(result):  # Type narrows to ToolSuccess
    print(result.data)
else:  # Type narrows to ToolError
    print(result.error_code, result.error_message)

โœ… Enums Instead of Strings

No typos, full autocomplete:

class ActivityType(str, Enum):
    HOMEWORK = "homework"
    TRANSITIONS = "transitions"
    BEDTIME_ROUTINE = "bedtime_routine"

โœ… Field Validation

Automatic validation on construction and assignment:

behavior = BehaviorInput(
    description="Hi",  # โŒ ValidationError: too short (min 10)
    time_of_day="morning",  # โŒ ValidationError: wrong type (needs enum)
)

๐Ÿ“Š Quality Checks

# Type check
uv run ty check src/

# Lint
uv run ruff check src/

# Format
uv run ruff format src/

# Run tests (when added)
uv run pytest

๐ŸŽฏ Use Cases

1. Behavioral Analysis

Input: Description of challenging behavior with context Output: ADHD/ASD/age-typical factor analysis + actionable strategies

2. Activity Planning

Input: Activity goal (homework, transitions, engagement) Output: Complete plan with materials, setup, timing, success criteria

3. Pattern Recognition

Input: Session history with outcomes Output: Identified patterns, successful strategies, common triggers


โš ๏ธ Disclaimer

This is a parenting support tool, NOT medical advice. Always consult healthcare professionals for medical concerns about your child's development or behavior.


โœ… Implemented Features

  1. โœ… Type-safe Pydantic models with strict validation
  2. โœ… Three custom tools (Behavior Classifier, Activity Planner, Pattern Analyzer)
  3. โœ… Five specialist agents (ADHD, ASD, Developmental, Memory, Activity Planner)
  4. โœ… Manager coordinator agent with orchestration logic
  5. โœ… Multi-agent hierarchical system with AgentTool pattern
  6. โœ… Google Search integration for evidence-based strategies (ADHD, ASD, Dev experts)
  7. โœ… Cross-session learning with pattern analysis
  8. โœ… Comprehensive demo scenarios
  9. โœ… ParallelAgent for concurrent expert consultation
  10. โœ… SequentialAgent for structured research pipelines
  11. โœ… 237 unit tests with 94% coverage

๐Ÿ““ Kaggle Notebook

Ready for submission! A complete Jupyter notebook demonstration is available at:

notebooks/kaggle_capstone_demo.ipynb

Features:

  • โœ… Complete setup instructions for Kaggle environment
  • โœ… API key configuration with Kaggle secrets
  • โœ… Three interactive demo scenarios
  • โœ… Architecture explanations with diagrams
  • โœ… Comprehensive capability showcase (6+ ADK features)
  • โœ… Results analysis and conclusions

To use on Kaggle:

  1. Upload the src/ directory to your Kaggle notebook
  2. Add your Google AI API key as a Kaggle secret (GOOGLE_API_KEY)
  3. Import the notebook file
  4. Enable internet access in settings
  5. Run all cells

See notebooks/README.md for detailed instructions.


๐Ÿ”ฎ Future Enhancements

  1. โœ… Create Kaggle notebook with inline demonstrations DONE
  2. โœ… Add comprehensive testing suite DONE (237 tests, 94% coverage)
  3. โœ… Document ADK capabilities showcase DONE
  4. โœ… Add real-world scenario examples DONE
  5. โœ… ParallelAgent & SequentialAgent patterns DONE
  6. ๐Ÿšง Performance evaluation and metrics
  7. ๐Ÿšง Video demonstration (optional)

๐Ÿ“ License

MIT License - This is an educational project for the Kaggle Agents Intensive Capstone.


๐Ÿ™ Acknowledgments

  • Google & Kaggle for the ADK framework and Agents Intensive Course
  • CHADD, Autism Speaks, CDC for evidence-based resources
  • Parents of neurodivergent children for inspiring this meaningful use case

About

AI-powered multi-agent system designed to support parents of neurodivergent children (ADHD + ASD Level 1)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors