AI-CoScientist
A multi-agent AI framework for collaborative scientific research, implementing the "Towards an AI Co-Scientist" methodology with tournament-based hypothesis evolution, peer review systems, and intelligent agent orchestration.
Features
🧠 Multi-Agent Architecture: Specialized agents for hypothesis generation, peer review, ranking, evolution, and meta-analysis
🏆 Tournament-Based Selection: Elo rating system for hypothesis ranking through pairwise comparisons
📊 Comprehensive Review System: Scientific soundness, novelty, testability, and impact assessment
🔄 Iterative Refinement: Meta-review guided evolution with strategic hypothesis improvement
🎯 Diversity Control: Proximity analysis to maintain hypothesis diversity and reduce redundancy
📈 Execution Metrics: Detailed performance tracking and agent timing analytics
💾 State Persistence: Save and resume research workflows with agent state management
🛡️ Robust Error Handling: Graceful fallbacks and recovery mechanisms for production reliability
Installation
You can install the package using pip:
pip install -e .
Or install dependencies directly:
pip install swarms loguru python-dotenv
Quick Start
from ai_coscientist import AIScientistFramework
# Initialize the AI Co-scientist Framework
ai_coscientist = AIScientistFramework(
model_name="gpt-4",
max_iterations=3,
hypotheses_per_generation=10,
tournament_size=8,
evolution_top_k=3,
verbose=True
)
# Define your research goal
research_goal = "Develop novel approaches for improving reasoning capabilities in large language models"
# Run the research workflow
results = ai_coscientist.run_research_workflow(research_goal)
# Access the results
print(f"Generated {len(results['top_ranked_hypotheses'])} top hypotheses")
for i, hypothesis in enumerate(results['top_ranked_hypotheses'], 1):
print(f"{i}. {hypothesis['text']}")
print(f" Elo Rating: {hypothesis['elo_rating']}")
print(f" Win Rate: {hypothesis['win_rate']}%")
Architecture
The AI-CoScientist framework consists of 8 specialized agents:
- Generation Agent: Creates novel research hypotheses
- Reflection Agent: Peer review and scientific critique
- Ranking Agent: Hypothesis ranking and selection
- Evolution Agent: Hypothesis refinement and improvement
- Meta-Review Agent: Cross-hypothesis insight synthesis
- Proximity Agent: Similarity analysis and diversity control
- Tournament Agent: Pairwise hypothesis comparison
- Supervisor Agent: Workflow orchestration and planning
Advanced Usage
Custom Configuration
ai_coscientist = AIScientistFramework(
model_name="claude-3-sonnet",
max_iterations=5,
base_path="./custom_states",
verbose=True,
tournament_size=12,
hypotheses_per_generation=15,
evolution_top_k=5,
)
State Management
# Save agent states
ai_coscientist.save_state()
# Load previous states
ai_coscientist.load_state()
Results Analysis
results = ai_coscientist.run_research_workflow(research_goal)
# Execution metrics
metrics = results['execution_metrics']
print(f"Total time: {results['total_workflow_time']:.2f}s")
print(f"Hypotheses generated: {metrics['hypothesis_count']}")
print(f"Reviews completed: {metrics['reviews_count']}")
print(f"Tournament rounds: {metrics['tournaments_count']}")
# Meta-review insights
insights = results['meta_review_insights']
print("Strategic recommendations:", insights.get('strategic_recommendations'))
Code Quality 🧹
make styleto format the codemake check_code_qualityto check code quality (PEP8 basically)black .ruff . --fix
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Documentation
For detailed documentation, see DOCS.md.
Citation
If you use AI-CoScientist in your research, please cite:
@software{ai_coscientist,
title={AI-CoScientist: A Multi-Agent Framework for Collaborative Scientific Research},
author={The Swarm Corporation},
year={2024},
url={https://github.com/The-Swarm-Corporation/AI-CoScientist}
}
License
MIT License - see LICENSE file for details.
Support
- 📧 Email: kye@swarms.world
- 💬 Discord: Join our community
- 🐦 Twitter: @kyegomezb
Metadata
Release files for ai-coscientist 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ai_coscientist-1.0.0.tar.gz | 21.6 kB | Without provenance | Details for ai_coscientist-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ai_coscientist-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for ai_coscientist-1.0.0-py3-none-any.whl |
Total release size: 42.2 kB
Release files / ai_coscientist-1.0.0.tar.gz
| Download URL | ai_coscientist-1.0.0.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6279b69bb2fb12058f2b642a0ed1f7b5d87ad5b42f1d14f95d97da567ce0dbed
|
|
BLAKE2b-256 checksum How to use checksums |
11444b8295ef9a9473d90a6ca7baf70de372052972b7c26899392e80f74b2073
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.3 Darwin/24.5.0
|
Release files / ai_coscientist-1.0.0-py3-none-any.whl
| Download URL | ai_coscientist-1.0.0-py3-none-any.whl |
|---|---|
| Size | 20.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5865dc907b1a9c67e30332ad6a5e88153f5c1877bdb73e31b52d433158c55dea
|
|
BLAKE2b-256 checksum How to use checksums |
3ff31fba68ad0883e1a95d7014f182672ead2fcaef8487d9fab82e0733410942
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.3 Darwin/24.5.0
|
Security for ai-coscientist 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.