This project explores the application of hierarchical multi-agent systems to complex cognitive tasks, specifically academic writing. By decomposing the writing process into specialized agent roles, the system demonstrates how emergent behaviors can arise from structured agent interactions while maintaining coherence through typed constraints.
The system employs a hierarchical agent architecture based on three key theoretical principles:
-
Specialized Sub-agents
- Each agent operates within a specifically defined domain
- Decision-making is constrained by explicit schemas
- Information flow is structured through typed interfaces
-
Hierarchical Coordination
- Agents interact through a mediator-based architecture
- Higher-level agents provide strategic direction
- Lower-level agents handle tactical execution
-
Constrained Generation with Schema Validation
- Output generation is bounded by formal specifications
- Cross-validation occurs at agent boundaries
- Schema enforcement ensures coherent composition
The Future of Work: Why AI Won't Replace Humans Hierarchical Methods for Planning in Multi-Agent Systems: A Path Towards Efficiency and Cooperation
This guide will help you set up the necessary environment and credentials for the Writing Agents project.
- Python 3.7 or higher
- A Google Cloud Platform account
- An OpenAI API key
- A Perplexity API key
-
Clone this repository
-
Create a virtual environment (recommended):
conda create -n writing-agents python=3.9 conda activate writing-agents
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.env
file in the root directory:OPENAI_API_KEY=your_openai_key_here PERPLEXITY_API_KEY=your_perplexity_key_here
-
Google Cloud Setup:
- Create a new project in Google Cloud Console
- Enable the Google Docs API and Google Drive API
- Create a service account:
- Go to IAM & Admin > Service Accounts
- Click "Create Service Account"
- Give it a name and grant it the following roles:
- Google Docs API > Docs Editor
- Google Drive API > Drive Editor
- Create and download the service account key (JSON)
- Place the JSON key file in
./keys/NAME_OF_THE_SERVICE_ACCOUNT.json
See writing.ipynb
for usage.