mirror of
https://github.com/HKUDS/AutoAgent.git
synced 2025-10-09 13:41:35 +03:00
up
This commit is contained in:
79
README.md
79
README.md
@@ -48,8 +48,32 @@ Welcome to MetaChain! MetaChain is a **Fully-Automated** and highly **Self-Devel
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<span id='table-of-contents'/>
|
||||
|
||||
## 📑 Table of Contents
|
||||
|
||||
* <a href='#features'>✨ Features</a>
|
||||
* <a href='#news'>🔥 News</a>
|
||||
* <a href='#quick-start'>⚡ Quick Start</a>
|
||||
* <a href='#installation'>Installation</a>
|
||||
* <a href='#api-keys-setup'>API Keys Setup</a>
|
||||
* <a href='#start-with-cli-mode'>Start with CLI Mode</a>
|
||||
* <a href='#how-to-use'>🔍 How to Use MetaChain</a>
|
||||
* <a href='#user-mode'>1. User Mode (SOTA Open Deep Research)</a>
|
||||
* <a href='#agent-editor'>2. Agent Editor</a>
|
||||
* <a href='#workflow-editor'>3. Workflow Editor</a>
|
||||
* <a href='#todo'>☑️ Todo List</a>
|
||||
* <a href='#documentation'>📖 Documentation</a>
|
||||
* <a href='#community'>🤝 How to Join the Community</a>
|
||||
* <a href='#acknowledgements'>🙏 Acknowledgements</a>
|
||||
* <a href='#cite'>🌟 Cite</a>
|
||||
|
||||
<span id='quick-start'/>
|
||||
|
||||
## ⚡ Quick Start
|
||||
|
||||
<span id='installation'/>
|
||||
|
||||
### Installation
|
||||
|
||||
#### MetaChain Installation
|
||||
@@ -68,6 +92,8 @@ We use Docker to containerize the agent-interactive environment. So please insta
|
||||
docker pull tjbtech1/metachain:latest
|
||||
```
|
||||
|
||||
<span id='api-keys-setup'/>
|
||||
|
||||
### API Keys Setup
|
||||
|
||||
Create a environment variable file, just like `.env.template`, and set the API keys for the LLMs you want to use. Not every LLM API Key is required, use what you need.
|
||||
@@ -86,6 +112,8 @@ GROQ_API_KEY=
|
||||
XAI_API_KEY=
|
||||
```
|
||||
|
||||
<span id='start-with-cli-mode'/>
|
||||
|
||||
### Start with CLI Mode
|
||||
Just run the following command to start the CLI mode. (use shell script `cd path/to/MetaChain && sh playground/cli/metachain_cli.sh`)
|
||||
|
||||
@@ -119,8 +147,12 @@ After the CLI mode is started, you can see the start page of MetaChain:
|
||||
|
||||
More features coming soon! 🚀 **Web GUI interface** under development.
|
||||
|
||||
<span id='how-to-use'/>
|
||||
|
||||
## 🔍 How to Use MetaChain
|
||||
|
||||
<span id='user-mode'/>
|
||||
|
||||
### 1. `user mode` (SOTA 🏆 Open Deep Research)
|
||||
|
||||
MetaChain have a out-of-the-box multi-agent system, which you could choose `user mode` in the start page to use it. This multi-agent system is a general AI assistant, having the same functionality with **OpenAI's Deep Research** and the comparable performance with it in [GAIA](https://gaia-benchmark-leaderboard.hf.space/) benchmark.
|
||||
@@ -129,6 +161,7 @@ MetaChain have a out-of-the-box multi-agent system, which you could choose `user
|
||||
- 🔄 **Model Flexibility**: Compatible with any LLM (including Deepseek-R1, Grok, Gemini, etc.)
|
||||
- 💰 **Cost-Effective**: Open-source alternative to Deep Research's $200/month subscription
|
||||
- 🎯 **User-Friendly**: Easy-to-deploy CLI interface for seamless interaction
|
||||
- 📁 **File Support**: Handles file uploads for enhanced data interaction
|
||||
|
||||
<table>
|
||||
<tr align="center">
|
||||
@@ -149,6 +182,27 @@ MetaChain have a out-of-the-box multi-agent system, which you could choose `user
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr align="center">
|
||||
<td width="33%">
|
||||
<img src="./assets/user_mode/4-upload.png" alt="Input" width="100%"/>
|
||||
<br>
|
||||
<em>@Upload_files will help you upload the files.</em>
|
||||
</td>
|
||||
<td width="33%">
|
||||
<img src="./assets/user_mode/5-select.png" alt="Output" width="100%"/>
|
||||
<br>
|
||||
<em>Select the files you want to use.</em>
|
||||
</td>
|
||||
<td width="33%">
|
||||
<img src="./assets/user_mode/6-success.png" alt="Select Agent" width="100%"/>
|
||||
<br>
|
||||
<em>Successfully uploaded the files.</em>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<span id='agent-editor'/>
|
||||
|
||||
### 2. `agent editor` (Agent Creation without Workflow)
|
||||
|
||||
@@ -195,6 +249,8 @@ You can use `agent editor` as shown in the following figure.
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<span id='workflow-editor'/>
|
||||
|
||||
### 3. `workflow editor` (Agent Creation with Workflow)
|
||||
|
||||
You can also create the agent workflows using natural language description with the `workflow editor` mode, as shown in the following figure. (Tips: this mode does not support tool creation temporarily.)
|
||||
@@ -233,13 +289,28 @@ You can also create the agent workflows using natural language description with
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<span id='todo'/>
|
||||
|
||||
## ☑️ Todo List
|
||||
|
||||
MetaChain is continuously evolving! Here's what's coming:
|
||||
|
||||
- 📊 **More Benchmarks**: Expanding evaluations to **SWE-bench**, **WebArena**, and more
|
||||
- 🖥️ **GUI Agent**: Supporting *Computer-Use* agents with GUI interaction
|
||||
- 🔧 **Tool Platforms**: Integration with more platforms like **Composio**
|
||||
- 🏗️ **Code Sandboxes**: Supporting additional environments like **E2B**
|
||||
- 🎨 **Web Interface**: Developing comprehensive GUI for better user experience
|
||||
|
||||
Have ideas or suggestions? Feel free to open an issue! Stay tuned for more exciting updates! 🚀
|
||||
|
||||
<span id='documentation'/>
|
||||
|
||||
## 📖 Documentation
|
||||
|
||||
|
||||
|
||||
<span id='community'/>
|
||||
|
||||
## 🤝 How to Join the Community
|
||||
|
||||
OpenHands is a community-driven project, and we welcome contributions from everyone. We do most of our communication
|
||||
@@ -251,6 +322,7 @@ through Slack, so this is the best place to start, but we also are happy to have
|
||||
|
||||
See more about the community in [COMMUNITY.md](./COMMUNITY.md) or find details on contributing in [CONTRIBUTING.md](./CONTRIBUTING.md).
|
||||
|
||||
<span id='acknowledgements'/>
|
||||
|
||||
## 🙏 Acknowledgements
|
||||
|
||||
@@ -258,8 +330,15 @@ OpenHands is built by a large number of contributors, and every contribution is
|
||||
|
||||
For a list of open source projects and licenses used in OpenHands, please see our [CREDITS.md](./CREDITS.md) file.
|
||||
|
||||
<span id='cite'/>
|
||||
|
||||
## 🌟 Cite
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
assets/user_mode/4-upload.png
Normal file
BIN
assets/user_mode/4-upload.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 589 KiB |
BIN
assets/user_mode/5-select.png
Normal file
BIN
assets/user_mode/5-select.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 548 KiB |
BIN
assets/user_mode/6-success.png
Normal file
BIN
assets/user_mode/6-success.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 438 KiB |
53
playground/cli/file_select.py
Normal file
53
playground/cli/file_select.py
Normal file
@@ -0,0 +1,53 @@
|
||||
import tkinter as tk
|
||||
from tkinter import filedialog
|
||||
import shutil
|
||||
import os
|
||||
from rich.console import Console
|
||||
|
||||
def select_and_copy_files(dest_dir, console: Console):
|
||||
# 创建 tkinter 根窗口但隐藏它
|
||||
root = tk.Tk()
|
||||
root.withdraw()
|
||||
|
||||
# 打开文件选择对话框
|
||||
files = filedialog.askopenfilenames(
|
||||
title='Select files to copy',
|
||||
filetypes=[
|
||||
# ('Text files', '*.txt'),
|
||||
('All files', '*.*'),
|
||||
('PDF files', '*.pdf'),
|
||||
('Docx files', '*.docx'),
|
||||
('Txt files', '*.txt'),
|
||||
('Zip files', '*.zip'),
|
||||
('Text files', '*.txt'),
|
||||
]
|
||||
)
|
||||
|
||||
if not files:
|
||||
print("No files selected")
|
||||
return
|
||||
|
||||
# 选择目标文件夹
|
||||
# dest_dir = filedialog.askdirectory(
|
||||
# title='Select destination folder'
|
||||
# )
|
||||
|
||||
if not dest_dir:
|
||||
print("No destination folder selected")
|
||||
return
|
||||
|
||||
# 复制文件
|
||||
for file_path in files:
|
||||
file_name = os.path.basename(file_path)
|
||||
dest_path = os.path.join(dest_dir, file_name)
|
||||
try:
|
||||
shutil.copy2(file_path, dest_path)
|
||||
console.print(f"[bold green]Uploaded: {file_name}[/bold green]")
|
||||
except Exception as e:
|
||||
console.print(f"[bold red]Error uploading {file_name}: {e}[/bold red]")
|
||||
|
||||
console.print(f"[bold green]Successfully uploaded {len(files)} files[/bold green]")
|
||||
|
||||
if __name__ == "__main__":
|
||||
dest_dir = "/Users/tangjiabin/Documents/reasoning/metachain/workspace_meta_showcase/showcase_nl2agent_showcase/workplace"
|
||||
select_and_copy_files(dest_dir)
|
||||
@@ -34,6 +34,7 @@ from rich.panel import Panel
|
||||
import re
|
||||
from playground.cli.metachain_meta_agent import meta_agent
|
||||
from playground.cli.metachain_meta_workflow import meta_workflow
|
||||
from playground.cli.file_select import select_and_copy_files
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(description="working@tjb-tech")
|
||||
parser.add_argument('--container_name', type=str, default='gpu_test')
|
||||
@@ -107,6 +108,7 @@ def user_mode(model: str, context_variables: dict, debug: bool = True):
|
||||
agents = {system_triage_agent.name.replace(' ', '_'): system_triage_agent}
|
||||
for agent_name in system_triage_agent.agent_teams.keys():
|
||||
agents[agent_name.replace(' ', '_')] = system_triage_agent.agent_teams[agent_name]("placeholder").agent
|
||||
agents["Upload_files"] = "select"
|
||||
style = Style.from_dict({
|
||||
'bottom-toolbar': 'bg:#333333 #ffffff',
|
||||
})
|
||||
@@ -140,24 +142,35 @@ def user_mode(model: str, context_variables: dict, debug: bool = True):
|
||||
# print(word, end=' ')
|
||||
pass
|
||||
print()
|
||||
agent_name = agent.name
|
||||
console.print(f"[bold green][bold magenta]@{agent_name}[/bold magenta] will help you, be patient...[/bold green]")
|
||||
messages.append({"role": "user", "content": query})
|
||||
response = client.run(agent, messages, context_variables, debug=debug)
|
||||
messages.extend(response.messages)
|
||||
model_answer_raw = response.messages[-1]['content']
|
||||
|
||||
if hasattr(agent, "name"):
|
||||
agent_name = agent.name
|
||||
console.print(f"[bold green][bold magenta]@{agent_name}[/bold magenta] will help you, be patient...[/bold green]")
|
||||
messages.append({"role": "user", "content": query})
|
||||
response = client.run(agent, messages, context_variables, debug=debug)
|
||||
messages.extend(response.messages)
|
||||
model_answer_raw = response.messages[-1]['content']
|
||||
|
||||
# attempt to parse model_answer
|
||||
if model_answer_raw.startswith('Case resolved'):
|
||||
model_answer = re.findall(r'<solution>(.*?)</solution>', model_answer_raw, re.DOTALL)
|
||||
if len(model_answer) == 0:
|
||||
# attempt to parse model_answer
|
||||
if model_answer_raw.startswith('Case resolved'):
|
||||
model_answer = re.findall(r'<solution>(.*?)</solution>', model_answer_raw, re.DOTALL)
|
||||
if len(model_answer) == 0:
|
||||
model_answer = model_answer_raw
|
||||
else:
|
||||
model_answer = model_answer[0]
|
||||
else:
|
||||
model_answer = model_answer_raw
|
||||
else:
|
||||
model_answer = model_answer[0]
|
||||
console.print(f"[bold green][bold magenta]@{agent_name}[/bold magenta] has finished with the response:\n[/bold green] [bold blue]{model_answer}[/bold blue]")
|
||||
agent = response.agent
|
||||
elif agent == "select":
|
||||
code_env: DockerEnv = context_variables["code_env"]
|
||||
local_workplace = code_env.local_workplace
|
||||
files_dir = os.path.join(local_workplace, "files")
|
||||
os.makedirs(files_dir, exist_ok=True)
|
||||
select_and_copy_files(files_dir, console)
|
||||
else:
|
||||
model_answer = model_answer_raw
|
||||
console.print(f"[bold green][bold magenta]@{agent_name}[/bold magenta] has finished with the response:\n[/bold green] [bold blue]{model_answer}[/bold blue]")
|
||||
agent = response.agent
|
||||
console.print(f"[bold red]Unknown agent: {agent}[/bold red]")
|
||||
|
||||
|
||||
def tool_to_table(tool_dict: dict):
|
||||
table = Table(title="Tool List", show_lines=True)
|
||||
|
||||
Reference in New Issue
Block a user