A modular, scalable framework for building autonomous AI agents
Project description
CortexAi Framework
CortexAi is a modular, extensible framework for building autonomous AI agents capable of solving complex tasks through collaboration and specialized capabilities. It's designed with a focus on scalability, flexibility, and robust planning.
Key Features
- Modular Architecture: Clean separation of concerns between agents, memory, planning, and tools.
- Multi-Agent Collaboration: Coordinate specialized agents to tackle complex tasks efficiently.
- Adaptive Planning: Dynamic planning capabilities that can revise plans based on execution results.
- Extensible Tool System: Easy integration of custom tools and capabilities.
- Flexible Memory Implementation: Support for different memory storage strategies.
- Provider-Agnostic: Works with various LLM providers through a consistent interface.
Architecture Overview
CortexAi is built around these core components:
CortexAi/
├── agent/ # Agent implementations
│ ├── core/ # Core components (base agent, memory, prompts)
│ ├── planning/ # Planning strategies
│ ├── providers/ # LLM provider interfaces
│ ├── tools/ # Tool implementations
│ ├── autonomous_agent.py # Enhanced agents with autonomous capabilities
│ ├── specialized_agent.py # Domain-specific agents
│ └── multi_agent_system.py # Collaboration between agents
└── examples/ # Usage examples
Components
- BaseAgent: Core agent implementation with ReAct (Reason-Act-Observe) cycle
- Memory: Stores conversation history and context
- Planner: Creates and manages execution plans
- Provider: Interface to language models
- Tools: Capabilities agents can use (web scraping, database operations, etc.)
- Specialized Agents: Agents with domain-specific knowledge (research, coding, writing, etc.)
- Multi-Agent System: Coordinates teams of specialized agents
Getting Started
Installation
# Install from PyPI
pip install CortexAi
Development Installation
For development or the latest unreleased features:
git clone https://github.com/damian87x/CortexAi.git
cd CortexAi
pip install -e .
Basic Usage
import asyncio
from CortexAi.agent.providers.mock_provider import MockProvider
from CortexAi.agent.core.base_agent import BaseAgent
async def main():
# Create a provider (use MockProvider for testing without API keys)
provider = MockProvider()
# Create a basic agent with the ReAct cycle
agent = BaseAgent(provider=provider, name="MyAgent")
# Run a task and get the result
result = await agent.run_task("Explain what AI agents are in simple terms")
print(result)
if __name__ == "__main__":
asyncio.run(main())
Using Specialized Agents
from CortexAi.agent.specialized_agent import ResearchAgent
# Create a specialized research agent with domain-specific capabilities
research_agent = ResearchAgent(provider=your_provider)
# Run a domain-specific task
result = await research_agent.run_task(
"Investigate recent developments in renewable energy storage."
)
Multi-Agent Collaboration
from CortexAi.agent.multi_agent_system import AgentTeam
# Create a pre-configured team of specialized agents for software development
dev_team = AgentTeam.create_software_team(provider=your_provider)
# Run a complex task that requires collaboration between multiple agents
result, execution_data = await dev_team.run(
"Design and implement a RESTful API for a todo app"
)
# The result contains the final output, while execution_data provides details
# about which agents were involved and what subtasks they completed
Advanced Features
Customizing Memory
from CortexAi.agent.core.memory import VectorMemory
from CortexAi.agent.autonomous_agent import AutonomousAgent
# Create an agent with vector-based memory for improved context retrieval
agent = AutonomousAgent(
provider=your_provider,
memory=VectorMemory(embedding_provider=your_embedding_provider),
name="AdvancedAgent"
)
Adding Custom Tools
from CortexAi.agent.tools.base_tool import BaseTool
class MyCustomTool(BaseTool):
name = "MyCustomTool"
description = "A custom tool that does something useful"
async def execute(self, param1: str, param2: int = 10) -> str:
# Tool implementation logic goes here
return f"Processed {param1} with parameter {param2}"
def get_schema(self) -> dict:
return {
"type": "object",
"properties": {
"param1": {"type": "string", "description": "First parameter"},
"param2": {"type": "integer", "description": "Second parameter"}
},
"required": ["param1"]
}
# Add the custom tool to an agent's toolkit
agent.tools.add_tool(MyCustomTool())
Project Status
CortexAi is currently in early development (v0.1.0). The API may change in future versions.
Roadmap
- Add integration with real LLM providers (OpenAI, Anthropic, etc.)
- Implement additional specialized agents
- Add persistent storage for memory
- Improve planning with hierarchical goal decomposition
- Add monitoring and observability tools
- Create documentation website
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
CortexAi is inspired by various agent frameworks and research, including:
- OpenManus
- LangChain
- ReAct paper: Reasoning and Acting in Language Models
- AutoGPT and similar autonomous agent systems
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cortexai-0.1.0.tar.gz.
File metadata
- Download URL: cortexai-0.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a095fbd83394e970f8aa4ff09774e566dbe03df7b664639fac15ac13f167fc6c
|
|
| MD5 |
bf3d1eb85d16ad92e8e6dca1618b29a3
|
|
| BLAKE2b-256 |
f52ca84fdbaba0598fd237390ffac5f9ac946791c201ddbbbc022ca44b5dab6f
|
File details
Details for the file cortexai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cortexai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5ea252b564b02545468a1dd78d8e7f04f9867ca20fc5dc2073b4ee3b28e75a3
|
|
| MD5 |
41a5f7071c7aabef17f16dca936d13e9
|
|
| BLAKE2b-256 |
829a3e2f843d82d3aebf3a8a32480a09345f30ce895f4472ded5392a6c8bff66
|