
Agent
AI-CoScientist
About this agent
An simple, reliable, and minimal implementation of the AI CoScientist Paper from Google "Towards an AI co-scientist" with Swarms Framework
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:
BASHpip3 install -U ai-coscientist
Quick Start
PYTHONfrom ai_coscientist import AIScientistFramework # Initialize the AI Co-scientist Framework ai_coscientist = AIScientistFramework( model_name="gpt-4o-mini", 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
PYTHONai_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
PYTHON# Save agent states ai_coscientist.save_state() # Load previous states ai_coscientist.load_state()
Results Analysis
PYTHONresults = 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 style
to format the codemake check_code_quality
to 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:
BIBTEX@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
Source: https://github.com/The-Swarm-Corporation/AI-CoScientist
Requirements
Package | Installation |
---|---|
requests | pip3 install swarms |
Agent Code
The main implementation code for this agent. You can view, copy, and use this code directly in your projects.
Agent Metadata (JSON)
All metadata and code for this agent, as a JSON object. Useful for programmatic use, export, or debugging.
{ "id": "57bef5a4-1e47-4957-b467-fe91c32ab920", "name": "AI-CoScientist", "title": "Agent", "description": "An simple, reliable, and minimal implementation of the AI CoScientist Paper from Google \"Towards an AI co-scientist\" with Swarms Framework\n\n\n\n# AI-CoScientist\n\n[](https://discord.gg/swarms-999382051935506503) [](https://www.youtube.com/@kyegomez3242) [](https://www.linkedin.com/in/kye-g-38759a207/) [](https://x.com/kyegomezb)\n\nA 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.\n\n## Features\n\n๐ง **Multi-Agent Architecture**: Specialized agents for hypothesis generation, peer review, ranking, evolution, and meta-analysis \n๐ **Tournament-Based Selection**: Elo rating system for hypothesis ranking through pairwise comparisons \n๐ **Comprehensive Review System**: Scientific soundness, novelty, testability, and impact assessment \n๐ **Iterative Refinement**: Meta-review guided evolution with strategic hypothesis improvement \n๐ฏ **Diversity Control**: Proximity analysis to maintain hypothesis diversity and reduce redundancy \n๐ **Execution Metrics**: Detailed performance tracking and agent timing analytics \n๐พ **State Persistence**: Save and resume research workflows with agent state management \n๐ก๏ธ **Robust Error Handling**: Graceful fallbacks and recovery mechanisms for production reliability\n\n## Installation\n\nYou can install the package using pip:\n\n\n```bash\npip3 install -U ai-coscientist\n```\n\n\n---\n\n\n## Quick Start\n\n```python\nfrom ai_coscientist import AIScientistFramework\n\n# Initialize the AI Co-scientist Framework\nai_coscientist = AIScientistFramework(\n model_name=\"gpt-4o-mini\",\n max_iterations=3,\n hypotheses_per_generation=10,\n tournament_size=8,\n evolution_top_k=3,\n verbose=True\n)\n\n# Define your research goal\nresearch_goal = \"Develop novel approaches for improving reasoning capabilities in large language models\"\n\n# Run the research workflow\nresults = ai_coscientist.run_research_workflow(research_goal)\n\n# Access the results\nprint(f\"Generated {len(results['top_ranked_hypotheses'])} top hypotheses\")\nfor i, hypothesis in enumerate(results['top_ranked_hypotheses'], 1):\n print(f\"{i}. {hypothesis['text']}\")\n print(f\" Elo Rating: {hypothesis['elo_rating']}\")\n print(f\" Win Rate: {hypothesis['win_rate']}%\")\n```\n\n## Architecture\n\nThe AI-CoScientist framework consists of 8 specialized agents:\n\n- **Generation Agent**: Creates novel research hypotheses\n- **Reflection Agent**: Peer review and scientific critique\n- **Ranking Agent**: Hypothesis ranking and selection\n- **Evolution Agent**: Hypothesis refinement and improvement\n- **Meta-Review Agent**: Cross-hypothesis insight synthesis\n- **Proximity Agent**: Similarity analysis and diversity control\n- **Tournament Agent**: Pairwise hypothesis comparison\n- **Supervisor Agent**: Workflow orchestration and planning\n\n## Advanced Usage\n\n### Custom Configuration\n\n```python\nai_coscientist = AIScientistFramework(\n model_name=\"claude-3-sonnet\",\n max_iterations=5,\n base_path=\"./custom_states\",\n verbose=True,\n tournament_size=12,\n hypotheses_per_generation=15,\n evolution_top_k=5,\n)\n```\n\n### State Management\n\n```python\n# Save agent states\nai_coscientist.save_state()\n\n# Load previous states\nai_coscientist.load_state()\n```\n\n### Results Analysis\n\n```python\nresults = ai_coscientist.run_research_workflow(research_goal)\n\n# Execution metrics\nmetrics = results['execution_metrics']\nprint(f\"Total time: {results['total_workflow_time']:.2f}s\")\nprint(f\"Hypotheses generated: {metrics['hypothesis_count']}\")\nprint(f\"Reviews completed: {metrics['reviews_count']}\")\nprint(f\"Tournament rounds: {metrics['tournaments_count']}\")\n\n# Meta-review insights\ninsights = results['meta_review_insights']\nprint(\"Strategic recommendations:\", insights.get('strategic_recommendations'))\n```\n\n## Code Quality ๐งน\n\n- `make style` to format the code\n- `make check_code_quality` to check code quality (PEP8 basically)\n- `black .`\n- `ruff . --fix`\n\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## Documentation\n\nFor detailed documentation, see [DOCS.md](DOCS.md).\n\n## Citation\n\nIf you use AI-CoScientist in your research, please cite:\n\n```bibtex\n@software{ai_coscientist,\n title={AI-CoScientist: A Multi-Agent Framework for Collaborative Scientific Research},\n author={The Swarm Corporation},\n year={2024},\n url={https://github.com/The-Swarm-Corporation/AI-CoScientist}\n}\n```\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Support\n\n- ๐ง Email: kye@swarms.world\n- ๐ฌ Discord: [Join our community](https://discord.gg/swarms-999382051935506503)\n- ๐ฆ Twitter: [@kyegomezb](https://x.com/kyegomezb)\n\n\nSource: https://github.com/The-Swarm-Corporation/AI-CoScientist", "tags": [ "agents", "ai", "ml", "multi-agent", "swarms", "googleai", "health-ai", "ml-agents", "multi-agent-systems", "opensource", "python", "google-ai-research", "health-agents", "swarms-framework" ], "requirements": [ { "package": "requests", "installation": "pip3 install swarms" } ], "usecases": [ { "title": "", "description": "" } ], "userId": "12fa3db5-0635-41b6-aa8c-71ece35a18db", "createdAt": "2025-07-11T16:58:18.604065+00:00", "links": [], "code": "from ai_coscientist import AIScientistFramework\nimport json\nfrom loguru import logger\n\nai_coscientist = AIScientistFramework(\n model_name=\"gemini/gemini-2.0-flash\", # Or \"gemini/gemini-2.0-flash\" if you have access\n max_iterations=2, # Reduced iterations for example run\n verbose=False, # Set to True for detailed logs\n hypotheses_per_generation=10,\n tournament_size=8,\n evolution_top_k=3,\n)\n\n# Define a research goal\nresearch_goal = \"Develop novel hypotheses for Incentivizing Reasoning Capability in LLMs via Reinforcement Learning\"\n\n# Run the research workflow\nresults = ai_coscientist.run_research_workflow(research_goal)\n\n# Output the results\nprint(\"\\n--- Research Workflow Results ---\")\nif \"error\" in results:\n print(f\"Error during workflow: {results['error']}\")\nelse:\n print(\"\\n--- Top Ranked Hypotheses ---\")\n for hy in results[\"top_ranked_hypotheses\"]:\n print(f\"- Hypothesis: {hy['text']}\")\n print(f\" Elo Rating: {hy['elo_rating']}\")\n print(f\" Score: {hy['score']:.2f}\")\n print(\n f\" Reviews: {hy['reviews'][-1].get('review_summary') if hy['reviews'] else 'No reviews'}\"\n ) # Print review summary\n print(\n f\" Similarity Cluster ID: {hy['similarity_cluster_id']}\"\n )\n print(\n f\" Win Rate: {hy['win_rate']}% (Matches: {hy['total_matches']})\"\n )\n print(\"-\" * 30)\n\n print(\"\\n--- Meta-Review Insights Summary ---\")\n meta_review_summary = results[\"meta_review_insights\"].get(\n \"meta_review_summary\", \"No meta-review summary available.\"\n )\n print(\n meta_review_summary[:500] + \"...\"\n if len(meta_review_summary) > 500\n else meta_review_summary\n ) # Print truncated or full summary\n\n print(\"\\n--- Execution Metrics ---\")\n print(json.dumps(results[\"execution_metrics\"], indent=2))\n print(\n f\"\\nTotal Workflow Time: {results['total_workflow_time']:.2f} seconds\"\n )\n\n if (\n ai_coscientist.verbose\n ): # Only print full history if verbose is on, can be very long\n print(\"\\n--- Conversation History (Verbose Mode) ---\")\n print(\n results[\"conversation_history\"][:1000] + \"...\"\n ) # Print first 1000 chars of history\n\n# Save agent states (optional)\ntry:\n ai_coscientist.save_state()\nexcept Exception as e:\n logger.error(f\"Exception during main execution: {e}\")\n" }
Comments & Discussion
Items You'd Like
Check out similar agents that match your interests