Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

chore: minor changes #2490 (#2554)

Parth Sharmad461831c9d8e
diff --git a/examples/usecases/aci_mcp/README.md b/examples/usecases/aci_mcp/README.md
index 650e411a3..9897015c6 100644
--- a/examples/usecases/aci_mcp/README.md
+++ b/examples/usecases/aci_mcp/README.md
@@ -12,9 +12,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
-# CAMEL AI with ACI Integration Examples
-This repository contains two different approaches to integrate ACI (AI Compute Infrastructure) with CAMEL AI agents:
+# CAMEL-AI with ACI Integration Examples
+
+This repository contains two different approaches to integrate ACI.dev (AI Compute Infrastructure) with CAMEL-AI agents:
1. **Direct ACI Toolkit Integration** (`aci_toolkit_camel.py`)
2. **MCP Server Integration** (`camel_mcp_aci.py`)
@@ -42,20 +43,22 @@ This repository contains two different approaches to integrate ACI (AI Compute I
### Prerequisites
- Python 3.10+
-- ACI API access
+- ACI.dev API access
- Google Gemini API access
### Installation
1. **Clone the repository**:
+
```bash
- git clone <repository-url>
- cd camel-ai-aci-examples
+ git clone https://github.com/camel-ai/camel
+ cd camel/examples/usecases/aci_mcp/
```
2. **Install dependencies**:
+
```bash
- pip install camel-ai[all] rich aci-mcp
+ uv pip install camel-ai[all]==0.2.61 rich aci-mcp
```
3. **Set up environment variables**:
@@ -71,38 +74,41 @@ This repository contains two different approaches to integrate ACI (AI Compute I
Create a `.env` file with the following variables:
- `ACI_API_KEY`: Your ACI API key
-- `GOOGLE_API_KEY`: Your Google Gemini API key
-- `LINKED_ACCOUNT_OWNER`: Your linked account owner ID (e.g., GitHub username)
+- `GEMINI_API_KEY`: Your Google Gemini API key
+- `LINKED_ACCOUNT_OWNER_ID`: Your linked account owner ID (e.g., GitHub username)
You can get these from:
-- **ACI API Key**: Configure your apps and get your key at [ACI Platform](https://platform.aci.dev/apps)
+
+- **ACI API Key**: Configure your apps and get your key at [ACI.dev Platform](https://platform.aci.dev/apps)
- **Google API Key**: Get your Gemini API key from [Google AI Studio](https://aistudio.google.com/)
## 🎯 Usage
### Approach 1: Direct ACI Toolkit Integration
-This approach uses the ACI toolkit directly within the CAMEL AI framework:
+This approach uses the ACI toolkit directly within the CAMEL-AI framework:
```bash
python aci_toolkit_camel.py
```
**Features**:
+
- Direct integration with ACI toolkit
- Simpler setup and configuration
-- Immediate access to ACI tools
+- Immediate access to ACI.dev tools
- Rich console output with progress indicators
### Approach 2: MCP Server Integration
-This approach uses MCP (Model Context Protocol) servers to provide ACI functionality:
+This approach uses MCP (Model Context Protocol) servers to provide ACI.dev functionality:
```bash
python camel_mcp_aci.py
```
**Features**:
+
- Uses MCP protocol for tool integration
- More modular and extensible architecture
- Interactive user input for queries
@@ -114,7 +120,7 @@ python camel_mcp_aci.py
### Common Issues
1. **Missing API Keys**: Ensure all required environment variables are set in your `.env` file
-2. **ACI MCP Installation**: Make sure `aci-mcp` is properly installed for MCP approach
+2. **ACI.dev MCP Installation**: Make sure `aci-mcp` is properly installed for MCP approach
3. **Network Issues**: Check internet connectivity for API calls
4. **Permission Issues**: Ensure proper permissions for file creation (config.json)
@@ -125,4 +131,4 @@ Both scripts include comprehensive error handling with traceback information for
## Links
- [CAMEL-AI](https://github.com/camel-ai/camel) - Multi-agent framework
-- [ACI](https://github.com/aci-labs) - AI Compute Infrastructure
+- [ACI.dev](https://github.com/aci-labs) - AI Compute Infrastructure
diff --git a/examples/usecases/aci_mcp/aci_toolkit_camel.py b/examples/usecases/aci_mcp/aci_toolkit_camel.py
index 8ac5d8264..26e8187d0 100644
--- a/examples/usecases/aci_mcp/aci_toolkit_camel.py
+++ b/examples/usecases/aci_mcp/aci_toolkit_camel.py
@@ -29,11 +29,13 @@ def main():
rprint("[green]CAMEL AI with ACI Toolkit[/green]")
# get the linked account from env or use default
- linked_account = os.getenv("LINKED_ACCOUNT_OWNER", "parthshr370")
- rprint(f"Using account: [cyan]{linked_account}[/cyan]")
+ linked_account_owner_id = os.getenv("LINKED_ACCOUNT_OWNER_ID")
+ if not linked_account_owner_id:
+ raise ValueError("LINKED_ACCOUNT_OWNER_ID environment variable is required")
+ rprint(f"Using account: [cyan]{linked_account_owner_id}[/cyan]")
# setup aci toolkit
- aci_toolkit = ACIToolkit(linked_account_owner_id=linked_account)
+ aci_toolkit = ACIToolkit(linked_account_owner_id=linked_account_owner_id)
tools = aci_toolkit.get_tools()
rprint(f"Loaded [cyan]{len(tools)}[/cyan] tools")
@@ -41,8 +43,8 @@ def main():
model = ModelFactory.create(
model_platform=ModelPlatformType.GEMINI,
model_type=ModelType.GEMINI_2_5_PRO_PREVIEW,
- api_key=os.getenv("GOOGLE_API_KEY"),
- model_config_dict={"temperature": 0.5, "max_tokens": 4000},
+ api_key=os.getenv("GEMINI_API_KEY"),
+ model_config_dict={"temperature": 0.5, "max_tokens": 40000},
)
# create agent with tools
diff --git a/examples/usecases/aci_mcp/camel_mcp_aci.py b/examples/usecases/aci_mcp/camel_mcp_aci.py
index 394b11ef6..40ca25761 100644
--- a/examples/usecases/aci_mcp/camel_mcp_aci.py
+++ b/examples/usecases/aci_mcp/camel_mcp_aci.py
@@ -26,12 +26,13 @@ from camel.types import ModelPlatformType, ModelType
load_dotenv()
+
async def main():
try:
from create_config import create_config
-
+
rprint("[green]CAMEL AI Agent with MCP Toolkit[/green]")
-
+
# create config for mcp server
create_config()
@@ -40,34 +41,40 @@ async def main():
mcp_toolkit = MCPToolkit(config_path="config.json")
await mcp_toolkit.connect()
tools = mcp_toolkit.get_tools()
-
- rprint(f"Connected successfully. Found [cyan]{len(tools)}[/cyan] tools available")
+
+ rprint(
+ f"Connected successfully. Found [cyan]{len(tools)}[/cyan] "
+ "tools available"
+ )
# setup gemini model
model = ModelFactory.create(
model_platform=ModelPlatformType.GEMINI,
model_type=ModelType.GEMINI_2_5_PRO_PREVIEW,
- api_key=os.getenv("GOOGLE_API_KEY"),
- model_config_dict={"temperature": 0.7, "max_tokens": 4000},
+ api_key=os.getenv("GEMINI_API_KEY"),
+ model_config_dict={"temperature": 0.7, "max_tokens": 40000},
)
system_message = BaseMessage.make_assistant_message(
role_name="Assistant",
- content="You are a helpful assistant with access to search, GitHub, and arXiv tools.",
+ content="You are a helpful assistant with access to search, "
+ "GitHub, and arXiv tools.",
)
# create camel agent
agent = ChatAgent(
- system_message=system_message,
- model=model,
- tools=tools,
+ system_message=system_message,
+ model=model,
+ tools=tools,
)
rprint("[green]Agent ready[/green]")
-
+
# get user query
user_query = input("\nEnter your query: ")
- user_message = BaseMessage.make_user_message(role_name="User", content=user_query)
+ user_message = BaseMessage.make_user_message(
+ role_name="User", content=user_query
+ )
rprint("\n[yellow]Processing...[/yellow]")
response = await agent.astep(user_message)
@@ -80,7 +87,7 @@ async def main():
if response and hasattr(response, "msgs") and response.msgs:
rprint(f"\nFound [cyan]{len(response.msgs)}[/cyan] messages:")
for i, msg in enumerate(response.msgs):
- rprint(f"Message {i+1}: {msg.content}")
+ rprint(f"Message {i + 1}: {msg.content}")
elif response:
rprint(f"Response content: {response}")
else:
@@ -93,7 +100,9 @@ async def main():
except Exception as e:
rprint(f"[red]Error: {e}[/red]")
import traceback
+
rprint(f"[dim]{traceback.format_exc()}[/dim]")
+
if __name__ == "__main__":
asyncio.run(main())
\ No newline at end of file
diff --git a/examples/usecases/aci_mcp/create_config.py b/examples/usecases/aci_mcp/create_config.py
index 600380ac4..80c31aab3 100644
--- a/examples/usecases/aci_mcp/create_config.py
+++ b/examples/usecases/aci_mcp/create_config.py
@@ -25,6 +25,10 @@ def create_config():
if not aci_api_key:
raise ValueError("ACI_API_KEY environment variable is required")
+ linked_account_owner_id = os.getenv("LINKED_ACCOUNT_OWNER_ID")
+ if not linked_account_owner_id:
+ raise ValueError("LINKED_ACCOUNT_OWNER_ID environment variable is required")
+
config = {
"mcpServers": {
"aci_apps": {
@@ -34,7 +38,7 @@ def create_config():
"apps-server",
"--apps=BRAVE_SEARCH,GITHUB,ARXIV",
"--linked-account-owner-id",
- "<YOUR_LINKED_ACCOUNT_ID>",
+ linked_account_owner_id,
],
"env": {"ACI_API_KEY": aci_api_key},
}
diff --git a/examples/usecases/aci_mcp/env.example b/examples/usecases/aci_mcp/env.example
index bc36866e8..955eaec78 100644
--- a/examples/usecases/aci_mcp/env.example
+++ b/examples/usecases/aci_mcp/env.example
@@ -1,9 +1,9 @@
-# CAMEL-AI and ACI Environment Configuration Template
+# CAMEL-AI and ACI.dev Environment Configuration Template
# How to use:
# 1. Make a copy of this file and name it .env (e.g., `cp .env.template .env`)
# 2. Fill in the values for each variable below.
-# 3. Ensure the .env file is in the same directory as your main scripts (e.g., aci-portia/)
+# 3. Ensure the .env file is in the same directory as your main scripts (e.g., aci-camel/)
# or that your scripts load it correctly if it's located elsewhere.
#
# Add .env to your .gitignore file.
@@ -11,10 +11,10 @@
# --- Google Generative AI Configuration ---
# Required for CAMEL-AI to use Google's language models (e.g., Gemini).
# Paste your gemini api key here and configure the model in the config.py
-GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY_HERE"
+GEMINI_API_KEY="YOUR_GEMINI_API_KEY_HERE"
# --- ACI aipolabs app mcp server ---
-# Required for using ACI tools via the MCP (Model Contex Protocol) server.
+# Required for using ACI.dev tools via the MCP (Model Contex Protocol) server.
# How to get:
# configure your apps and get your aci key at - https://platform.aci.dev/apps
# Notes:
@@ -22,4 +22,4 @@ GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY_HERE"
# - Replace <YOUR_LINKED_ACCOUNT_OWNER_ID> with the ID you set during the OAuth flow.
# - Ensure 'uv' is installed: pip install uv
ACI_API_KEY="YOUR_ACI_API_KEY_HERE"
-
+LINKED_ACCOUNT_OWNER_ID ="YOUR_LINKED_ACCOUNT_OWNER_ID"