A FastAPI-based dynamic agent system that leverages the ReACT methodology for building autonomous and human-in-the-loop agents. This mono repo contains multiple standalone modules, each focusing on different aspects of agent implementation.
- Dynamic agent loading and execution
- Multiple agent support with dedicated endpoints
- Agent listing and discovery endpoint
- Health check endpoint
- Error handling
- Comprehensive test suite
- Token-based authorization (for math agent)
- Advanced text processing (classifier and summarizer agents)
This project is structured as a mono repo with multiple standalone modules:
The recommended starting point for creating your own agents. This module provides the core framework for FastAPI Agents with minimal configuration required. It includes:
- Core agent execution framework
- Pre-built agents (Quote and Classifier)
- Dynamic agent execution
- Organized Swagger UI
- Comprehensive test suite (8 tests)
- No
.envfile required for setup
A collection of simple agents that demonstrate basic functionality. This module includes:
- Hello World agent
- Goodbye agent
- Echo agent
- Time agent
- Joke agent
- Quote agent
- Math agent with token verification
- Organized routes and agent information
- No
.envfile required for setup
Advanced agents leveraging DSPy for complex text processing tasks. This module includes:
- DSPy integration for advanced AI capabilities
- Classifier agent for text classification
- Summarizer agent for text summarization
- TextRank summarizer agent
- All simple agents from the starter module
- Comprehensive test suite (30 tests)
- No
.envfile required for setup
Specialized agents that implement the Module Context Protocol (MCP) for enhanced context sharing and state management between agents. MCP enables agents to maintain context across multiple interactions and coordinate with each other for complex tasks. This module includes:
- MCP adapter for context sharing between agents
- Calculator agent for arithmetic expression evaluation
- Multi-step reasoning agent for iterative hypothesis refinement
- Workflow coordinator agent for sub-agent orchestration
- Workflow decisioning agent for task-based agent selection
- Comprehensive test suite with mocking and error handling
- Requires
.envfile with MCP configuration
Advanced language processing agents leveraging OpenAI and Gemini for sophisticated text generation and analysis. This module includes:
- OpenAI and Gemini integration for advanced language capabilities
- Dynamic provider selection between different LLM providers
- Basic LLM agents for simple text generation
- Advanced LLM agents for sentiment analysis, summarization, question answering, and more
- Multi-step agents for complex tasks like research and analysis
- Comprehensive test suite for all agent types
- Requires
.envfile with API keys for LLM providers
This repository is actively expanding and in development with the following planned modules:
- MIPROv2 Agents: Will implement the MIPROv2 framework for multi-step reasoning and planning in complex environments.
- Meta Dynamic Agents: Will implement agents that are created based on a knowledge graph format.
- Supabase Agents: Will implement the dynamically generated agents based on descriptions from a database.
- Omega AGI Agents: Will implement agents for translation to the Omega AGI neural symbolic language for advanced reasoning.
- Additional Advanced Agents: More specialized agents for various domains and use cases.
- Omega AGI Chain of Thought Agents: Will implement advanced agents coordination and swarm deployment using Omega AGI, MIPROV2, LLM (potential).
- AGI Agents: Will implement agents for advanced AGI applications (potential).
- One Time Created Agents: Will implement agents conceived, planned, and implemented for single use cases (potential).
This project follows a mono repo style architecture:
- You can clone the entire repository to access all modules
- Each folder is designed to be modular and standalone
- Modules can be run independently with their own dependencies
fastapi-agents/
├─ base-framework/ # Core framework with minimal agents
├─ starter/ # Simple agents with basic functionality
├─ dspy/ # Advanced agents with DSPy integration
├─ mcp/ # Agents with Module Context Protocol for context sharing
├─ llm/ # Agents leveraging various LLMs (OpenAI, Gemini)
├─ (future) miprov2/ # Agents using MIPROv2 framework
└─ README.md # Main documentation
- Clone the repository:
git clone https://github.com/bar181/fastapi-agents.git
cd fastapi-agents- Choose a module and navigate to its directory:
cd dspy # or starter, base-framework, mcp, llm- Install dependencies:
pip install -r requirements.txt- Run the server:
# Using the Python -m flag for proper module resolution
python -m uvicorn app.main:app --reload- Test the endpoints:
Core Endpoints:
- Welcome message: GET /
- Health check: GET /health
- List all agents: GET /agents
Agent endpoints vary by module. Check each module's README.md for specific details.
Example Usage:
# Test an endpoint (replace SERVER_URL with your server address)
curl SERVER_URL/agent/hello_world
# Test with parameters
curl "SERVER_URL/agent/math?token=MATH_SECRET&expression=3*(4%2B2)"Navigate to the specific module directory and run:
# Using the Python -m flag for proper module resolution
python -m pytest tests- Each module contains its own
/docsdirectory with detailed documentation /plansdirectories contain step-by-step instructions for development/logsdirectories track development progress
Our development process followed a rigorous Documentation First approach:
-
Brainstorm and Design:
Initial ideas and designs were discussed and documented to establish project goals. -
Required Documentation:
All technical and implementation documents were created and saved in the/docsdirectory. -
Phase Plans:
Detailed plans for each development phase were created and are available in the/plansfolder. -
Step-by-Step Execution:
Development followed the step-by-step outlines provided in each phase, including comprehensive tests. -
Tracking and Logging:
Every step of the process was tracked and logged in the/logsdirectory for transparency. -
Testing and Updates:
Appropriate tests were implemented and documentation was continuously updated to reflect the current state of the project.
https://gist.github.com/bar181/7fc0286841a38c72848ed037d0e561fd
This project is licensed under the MIT License - see the LICENSE file for details.