100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.
docs: slim ai_self_evolving_agent README to match the shipped example
Shubhamsabooa794f646f92c
diff --git a/advanced_ai_agents/multi_agent_apps/ai_self_evolving_agent/README.md b/advanced_ai_agents/multi_agent_apps/ai_self_evolving_agent/README.mdindex 67be45d2..b587c9d6 100644--- a/advanced_ai_agents/multi_agent_apps/ai_self_evolving_agent/README.md+++ b/advanced_ai_agents/multi_agent_apps/ai_self_evolving_agent/README.md@@ -1,270 +1,57 @@-<h2 align="center">- Building a Self-Evolving Ecosystem of AI Agents-</h2>--<div align="center">--[](https://evoagentx.org/)-[](https://EvoAgentX.github.io/EvoAgentX/)-[](https://discord.gg/SUEkfTYn)-[](https://x.com/EvoAgentX)-[](https://star-history.com/#EvoAgentX/EvoAgentX)-[](https://github.com/EvoAgentX/EvoAgentX/fork)-[](https://github.com/EvoAgentX/EvoAgentX/blob/main/LICENSE)-<!-- [](https://EvoAgentX.github.io/EvoAgentX/) -->-<!-- [](https://huggingface.co/EvoAgentX) -->-</div>--<h4 align="center">- <i>An automated framework for evaluating and evolving agentic workflows.</i>-</h4>---## π₯ Latest News-- **[May 2025]** π **EvoAgentX** has been officially released!--## β‘ Get Started-- [π₯ Latest News](#-latest-news)-- [β‘ Get Started](#-get-started)-- [Installation](#installation)-- [LLM Configuration](#llm-configuration)- - [API Key Configuration](#api-key-configuration)- - [Configure and Use the LLM](#configure-and-use-the-llm)-- [Automatic WorkFlow Generation](#automatic-workflow-generation)-- [Demo Video](#demo-video)-- [Evolution Algorithms](#evolution-algorithms)- - [π Results](#-results)-- [Applications](#applications)-- [Tutorial and Use Cases](#tutorial-and-use-cases)-- [π― Roadmap](#-roadmap)-- [π Support](#-support)- - [Join the Community](#join-the-community)- - [Contact Information](#contact-information)-- [π Contributing to EvoAgentX](#-contributing-to-evoagentx)-- [π Acknowledgements](#-acknowledgements)-- [π License](#-license)--## Installation--We recommend installing EvoAgentX using `pip`:--```bash-pip install git+https://github.com/EvoAgentX/EvoAgentX.git-```--<details>-<summary>Example (optional, for local development):</summary>--```bash-git clone https://github.com/EvoAgentX/EvoAgentX.git-cd EvoAgentX-# Create a new conda environment-conda create -n evoagentx python=3.10--# Activate the environment-conda activate evoagentx--# Install the package-pip install -r requirements.txt-# OR install in development mode-pip install -e .-```-</details>--## LLM Configuration--### API Key Configuration--To use LLMs with EvoAgentX (e.g., OpenAI), you must set up your API key.--<details>-<summary>Option 1: Set API Key via Environment Variable</summary>--- Linux/macOS:-```bash-export OPENAI_API_KEY=<your-openai-api-key>-```--- Windows Command Prompt:-```cmd-set OPENAI_API_KEY=<your-openai-api-key>-```--- Windows PowerShell:-```powershell-$env:OPENAI_API_KEY="<your-openai-api-key>" # " is required-```--Once set, you can access the key in your Python code with:-```python-import os-OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")-```-</details>--<details>-<summary>Option 2: Use .env File</summary>--- Create a .env file in your project root and add the following:-```bash-OPENAI_API_KEY=<your-openai-api-key>-```--Then load it in Python:-```python-from dotenv import load_dotenv-import os--load_dotenv() # Loads environment variables from .env file-OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")-```-</details>-<!-- > π Tip: Don't forget to add `.env` to your `.gitignore` to avoid committing secrets. -->--### Configure and Use the LLM-Once the API key is set, initialise the LLM with:--```python-from evoagentx.models import OpenAILLMConfig, OpenAILLM--# Load the API key from environment-OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")--# Define LLM configuration-openai_config = OpenAILLMConfig(- model="gpt-4o-mini", # Specify the model name- openai_key=OPENAI_API_KEY, # Pass the key directly- stream=True, # Enable streaming response- output_response=True # Print response to stdout-)--# Initialize the language model-llm = OpenAILLM(config=openai_config)--# Generate a response from the LLM-response = llm.generate(prompt="What is Agentic Workflow?")-```--## Automatic WorkFlow Generation-Once your API key and language model are configured, you can automatically generate and execute multi-agent workflows in EvoAgentX.--π§© Core Steps:-1. Define a natural language goal-2. Generate the workflow with `WorkFlowGenerator`-3. Instantiate agents using `AgentManager`-4. Execute the workflow via `WorkFlow`--π‘ Minimal Example:-```python-from evoagentx.workflow import WorkFlowGenerator, WorkFlowGraph, WorkFlow-from evoagentx.agents import AgentManager--goal = "Generate html code for the Tetris game"-workflow_graph = WorkFlowGenerator(llm=llm).generate_workflow(goal)--agent_manager = AgentManager()-agent_manager.add_agents_from_workflow(workflow_graph, llm_config=openai_config)--workflow = WorkFlow(graph=workflow_graph, agent_manager=agent_manager, llm=llm)-output = workflow.execute()-print(output)-```--You can also:-- π Visualise the workflow: `workflow_graph.display()`-- πΎ Save/load workflows: `save_module()` / `from_file()`--> π For a complete working example, check out the [`workflow_demo.py`](https://github.com/EvoAgentX/EvoAgentX/blob/main/examples/workflow_demo.py)---## Demo Video---[](https://www.youtube.com/watch?v=Wu0ZydYDqgg)--<div align="center">- <video src="https://github.com/user-attachments/assets/8f65d1af-9398-40c3-a625-4f493e13e5a5.mp4" autoplay loop muted playsinline width="600">- Your browser does not support the video tag.- </video>-</div>--In this demo, we showcase the workflow generation and execution capabilities of EvoAgentX through two examples:--- Application 1: Intelligent Job Recommendation from Resume-- Application 2: Visual Analysis of A-Share Stocks---## Evolution Algorithms--We have integrated some existing agent/workflow evolution algorithms into EvoAgentX, including [TextGrad](https://www.nature.com/articles/s41586-025-08661-4), [MIPRO](https://arxiv.org/abs/2406.11695) and [AFlow](https://arxiv.org/abs/2410.10762).--To evaluate the performance, we use them to optimize the same agent system on three different tasks: multi-hop QA (HotPotQA), code generation (MBPP) and reasoning (MATH). We randomly sample 50 examples for validation and other 100 examples for testing.--> Tip: We have integrated these benchmark and evaluation code in EvoAgentX. Please refer to the [benchmark and evaluation tutorial](https://github.com/EvoAgentX/EvoAgentX/blob/main/docs/tutorial/benchmark_and_evaluation.md) for more details.--### π Results--| Method | HotPotQA<br>(F1%) | MBPP<br>(Pass@1 %) | MATH<br>(Solve Rate %) |-|----------|--------------------|---------------------|--------------------------|-| Original | 63.58 | 69.00 | 66.00 |-| TextGrad | 71.02 | 71.00 | 76.00 |-| AFlow | 65.09 | 79.00 | 71.00 |-| MIPRO | 69.16 | 68.00 | 72.30--Please refer to the `examples/optimization` folder for more details.--## Applications--We use our framework to optimize existing multi-agent systems on the [GAIA](https://huggingface.co/spaces/gaia-benchmark/leaderboard) benchmark. We select [Open Deep Research](https://github.com/huggingface/smolagents/tree/main/examples/open_deep_research) and [OWL](https://github.com/camel-ai/owl), two representative multi-agent framework from the GAIA leaderboard that is open-source and runnable.--We apply EvoAgentX to optimize their prompts. The performance of the optimized agents on the GAIA benchmark validation set is shown below.--> Full Optimization Reports: [Open Deep Research](https://github.com/eax6/smolagents) and [OWL](https://github.com/TedSIWEILIU/owl).--## Tutorial and Use Cases--π We're actively working on expanding our library of use cases and optimization strategies. **More coming soon β stay tuned!**--## π― Roadmap-- [ ] **Modularize Evolution Algorithms**: Abstract optimization algorithms into plug-and-play modules that can be easily integrated into custom workflows.-- [ ] **Develop Task Templates and Agent Modules**: Build reusable templates for typical tasks and standardized agent components to streamline application development.-- [ ] **Integrate Self-Evolving Agent Algorithms**: Incorporate more recent and advanced agent self-evolution across multiple dimensions, including prompt tuning, workflow structures, and memory modules.-- [ ] **Enable Visual Workflow Editing Interface**: Provide a visual interface for workflow structure display and editing to improve usability and debugging.--## π Support--### Join the Community--π’ Stay connected and be part of the **EvoAgentX** journey!-π© Join our community to get the latest updates, share your ideas, and collaborate with AI enthusiasts worldwide.--- [Discord](https://discord.gg/SUEkfTYn) β Chat, discuss, and collaborate in real-time.-- [X (formerly Twitter)](https://x.com/EvoAgentX) β Follow us for news, updates, and insights.-- [WeChat](https://github.com/EvoAgentX/EvoAgentX/blob/main/assets/wechat_info.md) β Connect with our Chinese community.--### Contact Information--If you have any questions or feedback about this project, please feel free to contact us. We highly appreciate your suggestions!--- **Email:** [email protected]--We will respond to all questions within 2-3 business days.--## π Contributing to EvoAgentX-Thanks go to these awesome contributors--<a href="https://github.com/EvoAgentX/EvoAgentX/graphs/contributors">- <img src="https://contrib.rocks/image?repo=EvoAgentX/EvoAgentX" />-</a>--We appreciate your interest in contributing to our open-source initiative. We provide a document of [contributing guidelines](https://github.com/EvoAgentX/EvoAgentX/blob/main/CONTRIBUTING.md) which outlines the steps for contributing to EvoAgentX. Please refer to this guide to ensure smooth collaboration and successful contributions. π€π--[](https://www.star-history.com/#EvoAgentX/EvoAgentX&Date)---## π Acknowledgements-This project builds upon several outstanding open-source projects: [AFlow](https://github.com/FoundationAgents/MetaGPT/tree/main/metagpt/ext/aflow), [TextGrad](https://github.com/zou-group/textgrad), [DSPy](https://github.com/stanfordnlp/dspy), [LiveCodeBench](https://github.com/LiveCodeBench/LiveCodeBench), and more. We would like to thank the developers and maintainers of these frameworks for their valuable contributions to the open-source community.--## π License--Source code in this repository is made available under the MIT License.+# 𧬠Self-Evolving AI Agent++A multi-agent app built on [EvoAgentX](https://github.com/EvoAgentX/EvoAgentX) that turns a+single natural-language goal into a working program. It **automatically generates a+multi-agent workflow**, executes it to produce code, then **verifies and repairs** that code+with a second model β no manual agent wiring required.++The included example takes the goal *"Generate HTML code for a Tetris game that can be played+in the browser"* and writes a ready-to-play `index.html`.++## β¨ What It Demonstrates++- **Automatic workflow generation** β `WorkFlowGenerator` designs the agents and steps from a plain-English goal.+- **Multi-agent execution** β `AgentManager` + `WorkFlow` instantiate and run the generated agents.+- **Cross-model code verification** β generation runs on OpenAI `gpt-4o-mini`; a separate Anthropic Claude pass verifies and fixes the output.+- **Self-evolving by design** β the workflow is built and refined by the system itself rather than hand-coded.++## π οΈ How to Get Started++1. **Clone the repository**+ ```bash+ git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git+ cd awesome-llm-apps/advanced_ai_agents/multi_agent_apps/ai_self_evolving_agent+ ```++2. **Install dependencies**+ ```bash+ pip install -r requirements.txt+ pip install git+https://github.com/EvoAgentX/EvoAgentX.git+ ```++3. **Set your API keys**+ ```bash+ export OPENAI_API_KEY=<your-openai-api-key>+ export ANTHROPIC_API_KEY=<your-anthropic-api-key>+ ```+ (Or place them in a `.env` file in this folder.)++4. **Run the agent**+ ```bash+ python ai_Self-Evolving_agent.py+ ```+ The generated game is written to `examples/output/tetris_game/index.html` β open it in a browser to play.++## π§ How It Works++1. **Define a goal** in natural language (e.g. build a Tetris game).+2. **Generate a workflow** β `WorkFlowGenerator` produces a multi-agent graph for the goal.+3. **Run the workflow** β `AgentManager` builds the agents and `WorkFlow` executes them with `gpt-4o-mini`.+4. **Verify the output** β a Claude model (via LiteLLM) reviews and repairs the generated code through `CodeVerification`.+5. **Save the result** β the final code is extracted and written to the output directory.++## π Learn More++This example is powered by the open-source **EvoAgentX** framework. For docs, tutorials, and+additional optimizers (TextGrad, AFlow, MIPRO), see the+[EvoAgentX repository](https://github.com/EvoAgentX/EvoAgentX).