Rift is a Redis-backed multi-agent collaboration system built with FastAPI and WebSocket. Rift features agents that share context and collaborate on tasks by leveraging Redis as shared memory. Each agent specializes in a specific function and interacts with others to complete workflows efficiently.
- TechAgent: Performs data analysis and stores results in Redis.
- ConceptAgent: Reads analysis results from Redis and generates narratives.
- TaskAgent: Tracks task progress and determines task completion.
- WebSocket Interface: Enables real-time communication with agents.
- Redis Integration: Acts as a shared memory layer for inter-agent collaboration.
project_root/
├── app/
│ ├── __init__.py # Initializes the app module
│ ├── main.py # FastAPI entry point and WebSocket logic
│ ├── agents/
│ │ ├── __init__.py # Initializes the agents module
│ │ ├── base_agent.py # Base class for all agents
│ │ ├── tech_agent.py # TechAgent implementation
│ │ ├── concept_agent.py # ConceptAgent implementation
│ │ ├── task_agent.py # TaskAgent implementation
│ └── utils/
│ ├── __init__.py # Initializes the utils module
│ ├── redis_memory.py # RedisMemory class for shared memory
│ ├── query_processor.py # QueryProcessor for natural language queries
├── static/
│ └── index.html # Frontend WebSocket client (optional)
├── requirements.txt # Python dependencies
└── README.md # Project documentation (this file)
- Python 3.10+
- Redis Server
pip
(Python package manager)
-
Clone the repository:
git clone https://github.com/Bluebull7/rift cd rift
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Start the Redis server:
redis-server
-
Run the FastAPI server:
cd app uvicorn main:app --reload
-
Test the WebSocket connection using
websocat
:websocat ws://127.0.0.1:8000/ws
Interact with the agents through the WebSocket interface:
-
Analyze Data (TechAgent):
Analyze data for task 101 with data: ["data1", "data2", "data3"]
-
Generate Narrative (ConceptAgent):
Generate a narrative for task 101
-
Track Progress (TaskAgent):
Check progress for task 101
-
TechAgent:
{"task_id": "101", "summary": "Analyzed 3 items"}
-
ConceptAgent:
The analysis for task 101 concluded: Analyzed 3 items.
-
TaskAgent:
{"task_id": "101", "status": "completed"}
TechAgent:analysis:<task_id>
: Stores analysis results.ConceptAgent:narrative:<task_id>
: Stores generated narratives.TaskAgent:progress:<task_id>
: Tracks task progress.
shared:task_context:<task_id>
: Stores metadata for task-level collaboration.- Example fields:
TechAgent_analysis
ConceptAgent_narrative
- Example fields:
shared:notifications
: Redis list for inter-agent notifications.
-
Notification System:
- Implement Redis Pub/Sub for real-time agent notifications.
-
Advanced Analytics:
- Add agents for data visualization and reporting.
-
Role-Based Access Control:
- Differentiate between admin and user roles for WebSocket interactions.
-
Frontend Dashboard:
- Build a user-friendly frontend for interacting with agents.
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add new feature"
- Push to the branch:
git push origin feature-name
- Open a pull request.
This project is licensed under the MIT License. See LICENSE
for details.
- FastAPI: For the web framework.
- Redis: For shared memory.
- websocat: For WebSocket debugging.