Skip to content

Sunbird-Serve/serve-agentic-stack

Repository files navigation

SERVE AI Platform

A multi-agent volunteer management platform designed to support the lifecycle of volunteers and needs in the SERVE ecosystem. Built as a Digital Public Good aligned with DPGA.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          SERVE AI Platform                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                                       β”‚
β”‚  β”‚ serve-ai-ui  β”‚  React Frontend                                       β”‚
β”‚  β”‚  Port 3000   β”‚                                                       β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜                                                       β”‚
β”‚         β”‚ HTTP                                                          β”‚
β”‚         β–Ό                                                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                                   β”‚
β”‚  β”‚ serve-orchestratorβ”‚  Coordination Layer                              β”‚
β”‚  β”‚    Port 8001      β”‚                                                   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                                   β”‚
β”‚         β”‚ HTTP                                                          β”‚
β”‚         β–Ό                                                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                         β”‚
β”‚  β”‚ serve-onboarding-agent-    β”‚  Onboarding Agent                       β”‚
β”‚  β”‚ service    Port 8002       β”‚  (future agents added here)             β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                         β”‚
β”‚         β”‚ HTTP                                                          β”‚
β”‚         β–Ό                                                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                 β”‚
β”‚  β”‚ serve-agentic-mcp-service  │────────▢│  PostgreSQL β”‚                 β”‚
β”‚  β”‚        Port 8003           β”‚         β”‚  Port 5432  β”‚                 β”‚
β”‚  β”‚   MCP Capabilities + DB    β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                 β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                         β”‚
β”‚                                                                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Project Structure

/app/
β”œβ”€β”€ serve-ai-ui/                      # React Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ package.json
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ serve-orchestrator/               # Coordination Service
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”œβ”€β”€ schemas/
β”‚   β”‚   └── clients/
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ serve-onboarding-agent-service/   # Onboarding Agent
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”œβ”€β”€ schemas/
β”‚   β”‚   └── clients/
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ serve-agentic-mcp-service/        # MCP + Database
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”œβ”€β”€ schemas/
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   └── db/
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ docker-compose.yml                # All services + Postgres
β”œβ”€β”€ .env.example                      # Environment template
└── README.md

Services

Service Port Description
serve-ai-ui 3000 React frontend with role-based views
serve-orchestrator 8001 Central coordination layer
serve-onboarding-agent-service 8002 Onboarding agent with LLM
serve-agentic-mcp-service 8003 MCP capabilities + database
postgres 5432 PostgreSQL with persistent volume

Quick Start

Prerequisites

  • Docker & Docker Compose

Running

# Clone the repository
git clone <repo-url>
cd serve-ai

# Create environment file
cp .env.example .env
# Edit .env and add your EMERGENT_LLM_KEY

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Access the application
open http://localhost:3000

Stop Services

docker-compose down

Reset Database

docker-compose down -v  # Removes volumes
docker-compose up -d

Service Responsibilities

serve-orchestrator

  • Channel-agnostic coordination layer
  • Receives interaction requests from UI or channel adapters
  • Resolves or creates sessions via MCP
  • Determines workflow and active agent
  • Routes requests to agent services via HTTP
  • Does NOT perform conversational logic
  • Does NOT access database directly

serve-onboarding-agent-service

  • Implements onboarding conversational logic
  • Receives session context from orchestrator
  • Generates responses using LLM (Claude Sonnet 4.5)
  • Calls MCP capabilities over HTTP
  • Returns structured agent responses
  • Does NOT access database directly

serve-agentic-mcp-service

  • Exposes domain capabilities as HTTP APIs
  • Owns ALL database access and persistence
  • Stores sessions, profiles, messages, events
  • Returns structured capability responses

serve-ai-ui

  • React frontend with Tailwind CSS
  • Role-based views (Volunteer, Ops, Admin)
  • Calls orchestrator via HTTP

API Endpoints

Endpoint Method Description
/interact POST Process chat interaction
/session/{id} GET Get session state
/sessions GET List all sessions
/health GET Health check

Onboarding Agent (http://localhost:8002/api)

Endpoint Method Description
/turn POST Process agent turn
/health GET Health check
Endpoint Method Description
/start-session POST Create new session
/resume-context POST Resume existing session
/advance-state POST Advance to next state
/save-confirmed-fields POST Save profile fields
/get-missing-fields POST Get missing required fields
/save-message POST Save conversation message
/log-event POST Log telemetry event
/session/{id} GET Get full session
/sessions GET List all sessions
/telemetry/{id} GET Get telemetry events

Database Schema

Core Tables

Table Description
sessions Interaction lifecycle tracking
session_events State transitions and routing
volunteer_profiles Volunteer information
conversation_messages Chat history
memory_summaries Long-term context
handoff_events Agent transitions
telemetry_events Operational telemetry

Onboarding States

State Description
init Initial welcome
intent_discovery Understanding motivation
purpose_orientation Introducing SERVE
eligibility_confirmation Gathering basic info
capability_discovery Exploring skills
profile_confirmation Reviewing info
onboarding_complete Finished
paused Session paused

Environment Variables

Root (.env)

EMERGENT_LLM_KEY=your-key-here

serve-orchestrator

Variable Description
MCP_SERVICE_URL URL to MCP service
ONBOARDING_AGENT_URL URL to onboarding agent
CORS_ORIGINS Allowed CORS origins

serve-onboarding-agent-service

Variable Description
MCP_SERVICE_URL URL to MCP service
LLM_PROVIDER LLM provider (claude/openai/gemini)
LLM_MODEL Model name
EMERGENT_LLM_KEY LLM API key

serve-agentic-mcp-service

Variable Description
DATABASE_URL PostgreSQL connection string
CORS_ORIGINS Allowed CORS origins

Adding Future Agents

To add a new agent (e.g., Selection Agent):

  1. Create serve-selection-agent-service/ following the onboarding pattern
  2. Add service to docker-compose.yml
  3. Register agent URL in orchestrator's agent client
  4. Implement MCP capabilities for the new domain

Tech Stack

  • Frontend: React, Tailwind CSS, shadcn/ui
  • Backend: Python 3.11, FastAPI
  • Database: PostgreSQL with SQLAlchemy
  • LLM: Claude Sonnet 4.5 (configurable)
  • Infrastructure: Docker Compose

License

Digital Public Good - DPGA Aligned

About

Prototype repo for serve agentic ai covering UI, orchestration, agent workflow and MCP integrations. Used for rapid experimentation before splitting into production grade services.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors