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

Auto-update documentation after merge [skip ci]

camel-docs-bote21d6f33819f
diff --git a/docs/key_modules/Benchmark.md b/docs/key_modules/Benchmark.md
index a873ff6bc..2c793e416 100644
--- a/docs/key_modules/Benchmark.md
+++ b/docs/key_modules/Benchmark.md
@@ -1,6 +1,9 @@
---
title: "BenchMarks"
description: "Learn about CAMEL's Benchmark module."
+
+doc_code_map:
+ - "camel/benchmarks/**/*.py"
---
## Overview
diff --git a/docs/key_modules/agents.md b/docs/key_modules/agents.md
index 9a97f0d7b..773a06c57 100644
--- a/docs/key_modules/agents.md
+++ b/docs/key_modules/agents.md
@@ -2,6 +2,9 @@
title: "Agents"
description: "Learn about CAMEL's agent types, with a focus on ChatAgent and advanced agent architectures for AI-powered automation."
icon: user-helmet-safety
+
+doc_code_map:
+ - "camel/agents/**/*.py"
---
diff --git a/docs/key_modules/browsertoolkit.md b/docs/key_modules/browsertoolkit.md
index bc91e83ca..4e2b73f4a 100644
--- a/docs/key_modules/browsertoolkit.md
+++ b/docs/key_modules/browsertoolkit.md
@@ -1,6 +1,10 @@
---
title: "Browser Toolkit"
icon: "globe"
+
+doc_code_map:
+ - "camel/toolkits/hybrid_browser_toolkit/**/*.py"
+ - "camel/toolkits/hybrid_browser_toolkit_py/**/*.py"
---
<Note type="info" title="What is the HybridBrowserToolkit?">
diff --git a/docs/key_modules/datagen.md b/docs/key_modules/datagen.md
index d3816ea31..52c15ebad 100644
--- a/docs/key_modules/datagen.md
+++ b/docs/key_modules/datagen.md
@@ -2,6 +2,9 @@
title: "Datagen"
description: "CAMEL’s data generation modules for high-quality, instruction-tuned, and reasoning-rich datasets."
icon: arrow-progress
+
+doc_code_map:
+ - "camel/datagen/**/*.py"
---
This page introduces CAMEL's **data generation modules** for creating high-quality training data with explicit reasoning, diverse instructions, and advanced automated refinement.
diff --git a/docs/key_modules/embeddings.md b/docs/key_modules/embeddings.md
index 6a3927f02..a6bd197cd 100644
--- a/docs/key_modules/embeddings.md
+++ b/docs/key_modules/embeddings.md
@@ -1,6 +1,9 @@
---
title: "Embeddings"
icon: vector-square
+
+doc_code_map:
+ - "camel/embeddings/**/*.py"
---
<Card title="What Are Embeddings??" icon="file-vector">
diff --git a/docs/key_modules/interpreters.md b/docs/key_modules/interpreters.md
index f90576db4..596f5811f 100644
--- a/docs/key_modules/interpreters.md
+++ b/docs/key_modules/interpreters.md
@@ -2,6 +2,9 @@
title: "Interpreters"
description: "Execute code safely and flexibly with CAMEL’s suite of interpreters: local, isolated, and cloud-based execution environments."
icon: terminal
+
+doc_code_map:
+ - "camel/interpreters/**/*.py"
---
Interpreters allow CAMEL agents to **execute code snippets** in various secure and flexible environments—from local safe execution to isolated Docker containers and managed cloud sandboxes.
@@ -184,4 +187,3 @@ print(result)
</ul>
</Accordion>
</AccordionGroup>
-```
diff --git a/docs/key_modules/loaders.md b/docs/key_modules/loaders.md
index 628d040ac..709a20690 100644
--- a/docs/key_modules/loaders.md
+++ b/docs/key_modules/loaders.md
@@ -1,12 +1,15 @@
---
title: "Loaders"
icon: loader
+
+doc_code_map:
+ - "camel/loaders/**/*.py"
---
<Card title="What are Loaders?" icon="loader">
CAMEL’s Loaders provide flexible ways to ingest and process all kinds of data
structured files, unstructured text, web content, and even OCR from images.
- They power your agent’s ability to interact with the outside world. itionally,
+ They power your agent’s ability to interact with the outside world. Additionally,
several data readers were added, including `Apify Reader`, `Chunkr Reader`,
`Firecrawl Reader`, `Jina_url Reader`, and `Mistral Reader`, which enable
retrieval of external data for improved data integration and analysis.
@@ -80,7 +83,7 @@ from camel.loaders import create_file_from_raw_bytes
# Read a pdf file from disk
with open("test.pdf", "rb") as file:
-file_content = file.read()
+ file_content = file.read()
# Use the create_file function to create an object based on the file extension
@@ -128,13 +131,24 @@ print(("\n\n".join([str(el) for el in elements])))
<strong>2. Clean unstructured text data:</strong>
<CodeGroup>
- ```python unstructured_io_clean.py example_dirty_text = ("\x93Some dirty text
- ’ with extra spaces and – dashes.") options = [ ('replace_unicode_quotes',{" "}
- {}), ('clean_dashes', {}), ('clean_non_ascii_chars', {}),
- ('clean_extra_whitespace', {}), ] cleaned_text =
- uio.clean_text_data(text=example_dirty_text, clean_options=options)
- print(cleaned_text) ``` ```markdown cleaned_text.md >>> Some dirty text with
- extra spaces and dashes. ```
+```python unstructured_io_clean.py
+example_dirty_text = "\u201cSome dirty text\u201d with extra spaces and \u2013 dashes."
+options = [
+ ("replace_unicode_quotes", {}),
+ ("clean_dashes", {}),
+ ("clean_non_ascii_chars", {}),
+ ("clean_extra_whitespace", {}),
+]
+cleaned_text = uio.clean_text_data(
+ text=example_dirty_text,
+ clean_options=options,
+)
+print(cleaned_text)
+````
+
+```markdown cleaned_text.md
+>>> "Some dirty text" with extra spaces and dashes.
+````
</CodeGroup>
<br />
@@ -165,8 +179,8 @@ print(extracted_text)
chunks = uio.chunk_elements(elements=elements, chunk_type="chunk_by_title")
for chunk in chunks:
-print(chunk)
-print("\n" + "-" \* 80)
+ print(chunk)
+ print("\n" + "-" * 80)
````
```markdown chunked_content.md
diff --git a/docs/key_modules/memory.md b/docs/key_modules/memory.md
index 91e941da1..26f5f0e2a 100644
--- a/docs/key_modules/memory.md
+++ b/docs/key_modules/memory.md
@@ -1,6 +1,9 @@
---
title: "Memory"
icon: memory
+
+doc_code_map:
+ - "camel/memories/**/*.py"
---
<Card title="What is Memory?" icon="memory">
diff --git a/docs/key_modules/messages.md b/docs/key_modules/messages.md
index 4adff636f..ab4cf7ae1 100644
--- a/docs/key_modules/messages.md
+++ b/docs/key_modules/messages.md
@@ -1,6 +1,9 @@
---
title: "Messages"
icon: messages
+
+doc_code_map:
+ - "camel/messages/**/*.py"
---
<Card title="What is BaseMessage?" icon="message">
diff --git a/docs/key_modules/models.md b/docs/key_modules/models.md
index e67ce8afe..76664ac38 100644
--- a/docs/key_modules/models.md
+++ b/docs/key_modules/models.md
@@ -2,6 +2,9 @@
title: "Models"
description: "CAMEL-AI: Flexible integration and deployment of top LLMs and multimodal models like [OpenAI](https://openai.com/), [Mistral](https://mistral.ai/), [Gemini](https://ai.google.dev/gemini-api/docs/models), [Llama](https://www.llama.com/), [Nebius](https://nebius.com/), and more."
icon: gear-code
+
+doc_code_map:
+ - "camel/models/**/*.py"
---
<Note type="info" title="What is a Model in CAMEL?">
diff --git a/docs/key_modules/prompts.md b/docs/key_modules/prompts.md
index 4b1dd9ccf..7fdb60817 100644
--- a/docs/key_modules/prompts.md
+++ b/docs/key_modules/prompts.md
@@ -1,6 +1,9 @@
---
title: "Prompts"
icon: message-pen
+
+doc_code_map:
+ - "camel/prompts/**/*.py"
---
<Card title="What is the Prompt Module?" icon="lightbulb">
diff --git a/docs/key_modules/retrievers.md b/docs/key_modules/retrievers.md
index 133185baa..161c39f78 100644
--- a/docs/key_modules/retrievers.md
+++ b/docs/key_modules/retrievers.md
@@ -1,6 +1,9 @@
---
title: "Retrievers"
icon: code-compare
+
+doc_code_map:
+ - "camel/retrievers/**/*.py"
---
## What Are Retrievers?
diff --git a/docs/key_modules/runtimes.md b/docs/key_modules/runtimes.md
index 977fb3ef0..fc083b087 100644
--- a/docs/key_modules/runtimes.md
+++ b/docs/key_modules/runtimes.md
@@ -2,6 +2,9 @@
title: "Runtimes"
description: "Flexible, secure, and scalable code execution with CAMEL’s runtime environments: guardrails, Docker, remote, and cloud sandboxes."
icon: server
+
+doc_code_map:
+ - "camel/runtimes/**/*.py"
---
CAMEL’s **runtime module** enables the secure, flexible, and isolated execution of tools and code. Runtimes allow agents to safely run functions in controlled environments—from in-process security checks to Docker isolation and remote/cloud sandboxes.
@@ -9,53 +12,64 @@ CAMEL’s **runtime module** enables the secure, flexible, and isolated executio
## What are Runtimes?
<Note type="info" title="Runtime Concept">
- Modern agent systems often require more than a simple interpreter. <b>Runtimes</b> provide safe, scalable execution via guardrails, isolation, or remote/cloud endpoints—ideal for complex or untrusted code.
+ Modern agent systems often require more than a simple interpreter.{" "}
+ <b>Runtimes</b> provide safe, scalable execution via guardrails, isolation, or
+ remote/cloud endpoints—ideal for complex or untrusted code.
</Note>
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2 gap-4 my-6">
- <Card icon="shield" title="LLMGuardRuntime">
- <b>Guardrail layer</b> for safe function execution.<br/>
- <ul>
- <li>LLM-based risk scoring (1=safe, 3=unsafe)</li>
- <li>Threshold control for blocking risky calls</li>
- <li>Pre-configured safety system prompt/tool</li>
- </ul>
- </Card>
-
- <Card icon="docker" title="DockerRuntime / UbuntuDockerRuntime">
- <b>Isolated, reproducible containers</b> via Docker.<br/>
- <ul>
- <li>Sandbox tool execution for safety</li>
- <li>FastAPI server for tool endpoints</li>
- <li>Ubuntu flavor supports .py script execution, env vars, and more</li>
- </ul>
- </Card>
-
- <Card icon="globe" title="RemoteHttpRuntime">
- <b>Remote, distributed execution</b> on HTTP servers.<br/>
- <ul>
- <li>Tool execution via FastAPI HTTP APIs</li>
- <li>Distribute compute and offload risky code</li>
- <li>Easy integration with remote endpoints</li>
- </ul>
- </Card>
-
- <Card icon="cloud" title="DaytonaRuntime" className="col-span-1 xl:col-span-3">
- <b>Cloud-managed sandboxing</b> with <a href="https://docs.daytona.io/" target="_blank" rel="noopener">Daytona SDK</a>.<br/>
- <ul>
- <li>Secure remote sandbox per tool</li>
- <li>Upload, run, and manage source code safely</li>
- <li>Automated input/output handling</li>
- </ul>
- </Card>
+<Card icon="shield" title="LLMGuardRuntime">
+ <b>Guardrail layer</b> for safe function execution.
+ <br />
+ <ul>
+ <li>LLM-based risk scoring (1=safe, 3=unsafe)</li>
+ <li>Threshold control for blocking risky calls</li>
+ <li>Pre-configured safety system prompt/tool</li>
+ </ul>
+</Card>
+
+<Card icon="docker" title="DockerRuntime / UbuntuDockerRuntime">
+ <b>Isolated, reproducible containers</b> via Docker.
+ <br />
+ <ul>
+ <li>Sandbox tool execution for safety</li>
+ <li>FastAPI server for tool endpoints</li>
+ <li>Ubuntu flavor supports .py script execution, env vars, and more</li>
+ </ul>
+</Card>
+
+<Card icon="globe" title="RemoteHttpRuntime">
+ <b>Remote, distributed execution</b> on HTTP servers.
+ <br />
+ <ul>
+ <li>Tool execution via FastAPI HTTP APIs</li>
+ <li>Distribute compute and offload risky code</li>
+ <li>Easy integration with remote endpoints</li>
+ </ul>
+</Card>
+
+<Card icon="cloud" title="DaytonaRuntime" className="col-span-1 xl:col-span-3">
+ <b>Cloud-managed sandboxing</b> with{" "}
+ <a href="https://docs.daytona.io/" target="_blank" rel="noopener">
+ Daytona SDK
+ </a>
+ .<br />
+ <ul>
+ <li>Secure remote sandbox per tool</li>
+ <li>Upload, run, and manage source code safely</li>
+ <li>Automated input/output handling</li>
+ </ul>
+</Card>
</div>
## Runtime Interface
All runtimes inherit from <b>BaseRuntime</b>, which defines core methods:
-- <code>add(funcs)</code>: Register one or more <code>FunctionTool</code> objects for execution
+
+- <code>add(funcs)</code>: Register one or more <code>FunctionTool</code>
+ objects for execution
- <code>reset()</code>: Reset the runtime to its initial state
- <code>get_tools()</code>: List all tools managed by the runtime
@@ -91,38 +105,38 @@ All runtimes inherit from <b>BaseRuntime</b>, which defines core methods:
## Runtime Types: Key Features
<AccordionGroup>
- <Accordion title="LLMGuardRuntime">
- <ul>
- <li>Evaluates risk before executing functions or tool calls (risk scores 1-3)</li>
- <li>Customizable LLM-driven safety logic</li>
- <li>Blocks or allows function execution based on threshold</li>
- </ul>
- </Accordion>
- <Accordion title="DockerRuntime / UbuntuDockerRuntime">
- <ul>
- <li>Runs CAMEL tools/agents in Docker containers for isolation and reproducibility</li>
- <li>UbuntuDocker flavor adds support for full script execution and system-level configuration</li>
- <li>Preconfigures <code>PYTHON_EXECUTABLE</code>, <code>PYTHONPATH</code>, and more for custom envs</li>
- </ul>
- </Accordion>
- <Accordion title="RemoteHttpRuntime">
- <ul>
- <li>Executes registered tools on a remote FastAPI server via HTTP endpoints</li>
- <li>Ideal for distributed, scalable, or cross-server tool execution</li>
- </ul>
- </Accordion>
- <Accordion title="DaytonaRuntime">
- <ul>
- <li>Runs code in a managed, remote cloud sandbox using Daytona SDK</li>
- <li>Uploads user code, executes with input/output capture</li>
- <li>Safety and resource guarantees from cloud provider</li>
- </ul>
- </Accordion>
+<Accordion title="LLMGuardRuntime">
+ <ul>
+ <li>Evaluates risk before executing functions or tool calls (risk scores 1-3)</li>
+ <li>Customizable LLM-driven safety logic</li>
+ <li>Blocks or allows function execution based on threshold</li>
+ </ul>
+</Accordion>
+<Accordion title="DockerRuntime / UbuntuDockerRuntime">
+ <ul>
+ <li>Runs CAMEL tools/agents in Docker containers for isolation and reproducibility</li>
+ <li>UbuntuDocker flavor adds support for full script execution and system-level configuration</li>
+ <li>Preconfigures <code>PYTHON_EXECUTABLE</code>, <code>PYTHONPATH</code>, and more for custom envs</li>
+ </ul>
+</Accordion>
+<Accordion title="RemoteHttpRuntime">
+ <ul>
+ <li>Executes registered tools on a remote FastAPI server via HTTP endpoints</li>
+ <li>Ideal for distributed, scalable, or cross-server tool execution</li>
+ </ul>
+</Accordion>
+<Accordion title="DaytonaRuntime">
+ <ul>
+ <li>Runs code in a managed, remote cloud sandbox using Daytona SDK</li>
+ <li>Uploads user code, executes with input/output capture</li>
+ <li>Safety and resource guarantees from cloud provider</li>
+ </ul>
+</Accordion>
</AccordionGroup>
## More Examples
-You’ll find runnable scripts for each runtime in <b>[examples/runtime](https://github.com/camel-ai/camel/tree/master/examples/runtimes)/</b> in our main repo.
+You’ll find runnable scripts for each runtime in <b>[examples/runtimes](https://github.com/camel-ai/camel/tree/master/examples/runtimes)/</b> in our main repo.
Each script demonstrates how to initialize and use a specific runtime—perfect for experimentation or production setups.
## Final Note
diff --git a/docs/key_modules/societies.md b/docs/key_modules/societies.md
index 9312e8f02..c94f72f03 100644
--- a/docs/key_modules/societies.md
+++ b/docs/key_modules/societies.md
@@ -2,6 +2,9 @@
title: "Societies"
description: "Collaborative agent frameworks in CAMEL: autonomous social behaviors, role-based task solving, and turn-based agent societies."
icon: people-group
+
+doc_code_map:
+ - "camel/societies/**/*.py"
---
<Note type="info" title="What is the Society Module?">
diff --git a/docs/key_modules/storages.md b/docs/key_modules/storages.md
index 9c374f95f..1d24ebf08 100644
--- a/docs/key_modules/storages.md
+++ b/docs/key_modules/storages.md
@@ -1,15 +1,22 @@
---
title: "Storages"
icon: database
+
+doc_code_map:
+ - "camel/storages/**/*.py"
---
## What Are Storages in CAMEL-AI?
<Card icon="database">
-The <b>Storage</b> module in CAMEL-AI gives you a **unified interface for saving, searching, and managing your data** from simple key-value records to high-performance vector databases and modern graph engines. It’s your plug-and-play toolkit for building robust, AI-ready storage layers.
+ The <b>Storage</b> module in CAMEL-AI gives you a **unified interface for
+ saving, searching, and managing your data** from simple key-value records to
+ high-performance vector databases and modern graph engines. It’s your
+ plug-and-play toolkit for building robust, AI-ready storage layers.
</Card>
---
+
## Types of Storages
<AccordionGroup>
@@ -32,6 +39,7 @@ The <b>Storage</b> module in CAMEL-AI gives you a **unified interface for saving
- Human-readable, portable JSON file storage
- Supports custom JSON encoder (for Enums, etc)
- Good for configs, small persistent datasets, export/import flows
+
</Accordion>
<Accordion title="VectorDB Storages" icon="file-vector">
@@ -71,6 +79,7 @@ The <b>Storage</b> module in CAMEL-AI gives you a **unified interface for saving
**PgVectorStorage**
- For [PostgreSQL with pgvector](https://github.com/pgvector/pgvector) (open-source vector engine)
- Leverages PostgreSQL for vector search
+
</Accordion>
<Accordion title="Graph Storages" icon="chart-waterfall">
@@ -87,11 +96,11 @@ The <b>Storage</b> module in CAMEL-AI gives you a **unified interface for saving
**Neo4jGraph**
- For [Neo4jGraph](https://neo4j.com/) (most popular enterprise graph DB)
- Widely used for graph analytics, recommendations
+
</Accordion>
</AccordionGroup>
-
## Get Started
Here are practical usage patterns for each storage type—pick the ones you need and mix them as you like.
@@ -119,6 +128,7 @@ Here are practical usage patterns for each storage type—pick the ones you need
>>> [{'key1': 'value1'}, {'key2': 'value2'}]
```
</Tab>
+
</Tabs>
</Card>
@@ -146,6 +156,7 @@ Here are practical usage patterns for each storage type—pick the ones you need
>>> [{'key1': 'value1'}, {'key2': 'value2'}]
```
</Tab>
+
</Tabs>
</Card>
@@ -181,6 +192,7 @@ Here are practical usage patterns for each storage type—pick the ones you need
>>> {'key2': 'value2'} 0.5669466853141785
```
</Tab>
+
</Tabs>
</Card>
@@ -198,7 +210,7 @@ Here are practical usage patterns for each storage type—pick the ones you need
os.environ["TIDB_DATABASE_URL"] = "The database url of your TiDB cluster."
tidb_storage = TiDBStorage(
- url_and_api_key=(os.getenv("DATABASE_URL"), ''),
+ url_and_api_key=(os.getenv("TIDB_DATABASE_URL"), ''),
vector_dim=4,
collection_name="my_collection"
)
@@ -218,10 +230,10 @@ Here are practical usage patterns for each storage type—pick the ones you need
>>> {'key2': 'value2'} 0.5669466755703252
```
</Tab>
+
</Tabs>
</Card>
-
<Card title="Qdrant Vector Storage" icon="square-q">
<b>Use for:</b> Fast, scalable open-source vector search.
<b>Perfect for:</b> RAG, document search, and high-scale retrieval tasks.
@@ -254,6 +266,7 @@ Here are practical usage patterns for each storage type—pick the ones you need
>>> {'key2': 'value2'} 0.5669467095138407
```
</Tab>
+
</Tabs>
</Card>
@@ -297,6 +310,7 @@ Here are practical usage patterns for each storage type—pick the ones you need
>>> {'key2': 'value2'} 0.7834733426570892
```
</Tab>
+
</Tabs>
</Card>
@@ -310,8 +324,9 @@ Here are practical usage patterns for each storage type—pick the ones you need
<Tab title="Python Example">
```python
import os
- from camel.storages import SurrealStorage, VectorDBQuery, VectorRecord
-
+ from camel.storages.vectordb_storages import SurrealStorage
+ from camel.storages import VectorDBQuery, VectorRecord
+
# Set environment variables for SurrealDB connection
os.environ["SURREAL_URL"] = "ws://localhost:8000/rpc"
os.environ["SURREAL_PASSWORD"] = "your_password"
@@ -347,6 +362,7 @@ Here are practical usage patterns for each storage type—pick the ones you need
>>> {'key2': 'value2'} 0.5669467095138407
```
</Tab>
+
</Tabs>
</Card>
@@ -443,6 +459,7 @@ Here are practical usage patterns for each storage type—pick the ones you need
'''
```
</Tab>
+
</Tabs>
</Card>
@@ -485,6 +502,7 @@ Here are practical usage patterns for each storage type—pick the ones you need
>>> {'key2': 'value2'} 0.7834733128547668
```
</Tab>
+
</Tabs>
</Card>
@@ -504,6 +522,7 @@ Here are practical usage patterns for each storage type—pick the ones you need
query = 'SHOW TAGS;'
print(nebula_graph.query(query))
```
+
</CodeGroup>
</Card>
@@ -526,6 +545,7 @@ Here are practical usage patterns for each storage type—pick the ones you need
print(neo4j_graph.query(query))
```
</CodeGroup>
+
</Card>
---
@@ -575,5 +595,6 @@ Here are practical usage patterns for each storage type—pick the ones you need
>>> {'key2': 'value2'} 0.5669467
```
</Tab>
+
</Tabs>
</Card>
diff --git a/docs/key_modules/tasks.md b/docs/key_modules/tasks.md
index 7fc0aae81..b3e814a1c 100644
--- a/docs/key_modules/tasks.md
+++ b/docs/key_modules/tasks.md
@@ -1,6 +1,9 @@
---
title: "Tasks"
icon: list-check
+
+doc_code_map:
+ - "camel/tasks/**/*.py"
---
For more detailed usage information, please refer to our cookbook: [Task Generation Cookbook](../cookbooks/multi_agent_society/task_generation.ipynb)
diff --git a/docs/key_modules/terminaltoolkit.md b/docs/key_modules/terminaltoolkit.md
index 51f1d63f0..d27914099 100644
--- a/docs/key_modules/terminaltoolkit.md
+++ b/docs/key_modules/terminaltoolkit.md
@@ -1,8 +1,10 @@
---
title: "Terminal Toolkit"
icon: "terminal"
----
+doc_code_map:
+ - "camel/toolkits/terminal_toolkit/**/*.py"
+---
<Note type="info" title="What is the Terminal Toolkit?">
The <b>Terminal Toolkit</b> provides a secure and powerful way for CAMEL agents to interact with a terminal. It allows agents to execute shell commands, manage files, and even ask for human help, all within a controlled, sandboxed environment.
</Note>
@@ -14,8 +16,8 @@ icon: "terminal"
<Card title="Multi-Session Management" icon="window-restore">
Run multiple, independent terminal sessions concurrently. Each session maintains its own state and history, allowing for complex, parallel workflows.
</Card>
- <Card title="Virtual Environment Management" icon="binary">
- Automatically create and manage isolated Python virtual environments, ensuring that package installations and script executions don't conflict with your system setup.
+ <Card title="Managed Runtime Environments" icon="binary">
+ The toolkit can create an isolated Python environment automatically and can optionally make additional runtimes like Go and Java available for commands started by this toolkit instance.
</Card>
<Card title="Human-in-the-Loop" icon="hand">
When an agent gets stuck, it can pause its execution and request human assistance. A human can then take over the terminal session to resolve the issue before handing control back.
@@ -66,6 +68,7 @@ The `shell_exec` function is the primary way to execute commands. Each command i
- `block=True` (default): waits for completion and returns combined stdout/stderr.
- `block=False`: starts a background session for interactive/long-running tasks.
- The `id` is how you later view output or terminate the session.
+- If a blocking command exceeds `timeout`, it is converted into a tracked background session automatically.
<Tabs>
<Tab title="Listing Files">
@@ -179,8 +182,9 @@ terminal_toolkit = TerminalToolkit(
#### Environment and Dependencies
Clone the current environment or preinstall dependencies into the sandboxed workspace.
-Use this to ensure tools like `python`, `pip`, or `uv` are available
-inside the sandboxed workspace.
+By default, the local backend tries to create an isolated Python environment in
+the workspace. It first attempts to use `uv`, then falls back to standard
+`venv` if needed.
```python
terminal_toolkit = TerminalToolkit(
@@ -190,6 +194,26 @@ terminal_toolkit = TerminalToolkit(
)
```
+#### Additional Language Runtimes
+You can optionally enable Go and Java for commands launched by this toolkit.
+
+When requested, the toolkit checks whether each runtime is already available. If
+not, it attempts to auto-install:
+- Go under `~/.camel/runtimes/go/`
+- Java (Adoptium Temurin JDK 21) under `~/.camel/runtimes/java/`
+
+These runtime paths are applied only to subprocesses started by this
+`TerminalToolkit` instance.
+
+```python
+from camel.toolkits import TerminalToolkit
+from camel.toolkits.terminal_toolkit.runtime_utils import Runtime
+
+terminal_toolkit = TerminalToolkit(
+ enable_other_runtimes=[Runtime.GO, Runtime.JAVA]
+)
+```
+
#### Write Files Directly
Use `shell_write_content_to_file` to write large files without shell escaping issues.
@@ -208,6 +232,10 @@ print(result)
### Safe Mode
When `safe_mode` is enabled (default), the toolkit blocks commands that could be harmful to your system.
+It also prevents local `cd`/`pushd` operations from escaping the configured
+`working_directory`, including chained directory changes that cannot be safely
+validated.
+
<Card title="Example of a Blocked Command" icon="shield-halved">
```python
# This command attempts to delete a file outside the workspace.
@@ -216,17 +244,22 @@ output = terminal_toolkit.shell_exec(id='session_1', command='rm /etc/hosts')
print(output)
# Expected Output:
-# Command rejected: Safety restriction: Cannot delete files outside of working directory ...
+# Error: Command rejected by TerminalToolkit safe mode.
+# Command 'rm' is blocked for safety.
```
</Card>
-
### Human-in-the-Loop
When an agent gets stuck, it can use `shell_ask_user_for_help` to request human intervention.
This call blocks and waits for a human response in the console, then returns
the user's input or the resulting command output.
+If the provided session `id` already exists, the toolkit shows the latest
+session output and lets the user send input to that running process. If the
+session does not exist, it can collect a one-off response and execute it as a
+new blocking command.
+
<Card title="Asking for Human Help" icon="hand">
```python
# The agent is stuck, so it asks for help in 'session_1'
diff --git a/docs/key_modules/tools.md b/docs/key_modules/tools.md
index 2d4a75841..c975a8e1c 100644
--- a/docs/key_modules/tools.md
+++ b/docs/key_modules/tools.md
@@ -1,28 +1,37 @@
---
title: "Tools"
icon: screwdriver-wrench
+
+doc_code_map:
+ - "camel/toolkits/**/*.py"
---
For more detailed usage information, please refer to our cookbook: [Tools Cookbook](../cookbooks/advanced_features/agents_with_tools.ipynb)
<Card title="What is a Tool?" icon="toolbox">
- A <b>Tool</b> in CAMEL is a callable function with a name, description, input parameters, and an output type.
- Tools act as the interface between agents and the outside world—think of them like <b>OpenAI Functions</b> you can easily convert, extend, or use directly.
+ A <b>Tool</b> in CAMEL is a callable function with a name, description, input
+ parameters, and an output type. Tools act as the interface between agents and
+ the outside world—think of them like <b>OpenAI Functions</b> you can easily
+ convert, extend, or use directly.
</Card>
<Card title="What is a Toolkit?" icon="screwdriver-wrench">
- A <b>Toolkit</b> is a curated collection of related tools designed to work together for a specific purpose.
- CAMEL provides a range of built-in toolkits—covering everything from web search and data extraction to code execution, GitHub integration, and much more.
+ A <b>Toolkit</b> is a curated collection of related tools designed to work
+ together for a specific purpose. CAMEL provides a range of built-in
+ toolkits—covering everything from web search and data extraction to code
+ execution, GitHub integration, and much more.
</Card>
## Get Started
<Card title="Install Toolkits" icon="terminal">
-To unlock advanced capabilities for your agents, install CAMEL's extra tools package:
-<CodeBlock language="sh" title="Install with pip">
-pip install 'camel-ai[tools]'
-</CodeBlock>
-A tool in CAMEL is just a <b>FunctionTool</b>—an interface any agent can call to run custom logic or access APIs.
+ To unlock advanced capabilities for your agents, install CAMEL's extra tools
+ package:
+ <CodeBlock language="sh" title="Install with pip">
+ pip install 'camel-ai[tools]'
+ </CodeBlock>
+ A tool in CAMEL is just a <b>FunctionTool</b>—an interface any agent can call
+ to run custom logic or access APIs.
</Card>
<Card title="Define a Custom Tool" icon="toolbox">
@@ -38,8 +47,8 @@ def add(a: int, b: int) -> int:
add_tool = FunctionTool(add)
```
-
Inspect your tool’s properties—such as its name, description, and OpenAI-compatible schema—using built-in methods:
+
<CodeGroup>
```python tool_properties.py
print(add_tool.get_function_name()) # add
@@ -54,7 +63,8 @@ Adds two numbers.
{'name': 'add', 'description': 'Adds two numbers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The first number to be added.'}, 'b': {'type': 'integer', 'description': 'The second number to be added.'}}, 'required': ['a', 'b'], 'type': 'object'}}
{'type': 'function', 'function': {'name': 'add', 'description': 'Adds two numbers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The first number to be added.'}, 'b': {'type': 'integer', 'description': 'The second number to be added.'}}, 'required': ['a', 'b'], 'type': 'object'}}}
-```
+
+````
</CodeGroup>
</Card>
@@ -65,7 +75,7 @@ Toolkits group related tools for specialized tasks—search, math, or automation
from camel.toolkits import SearchToolkit
toolkit = SearchToolkit()
tools = toolkit.get_tools()
-```
+````
You can also wrap toolkit methods as individual FunctionTools:
@@ -74,6 +84,7 @@ from camel.toolkits import FunctionTool, SearchToolkit
google_tool = FunctionTool(SearchToolkit().search_google)
wiki_tool = FunctionTool(SearchToolkit().search_wiki)
```
+
</Card>
<Card title="Passing Tools to ChatAgent" icon="user-cog">
@@ -86,69 +97,76 @@ tool_agent = ChatAgent(
)
response = tool_agent.step("A query related to the tool you added")
```
+
</Card>
## Built-in Toolkits
CAMEL provides a variety of built-in toolkits that you can use right away. Here's a comprehensive list of available toolkits:
-| Toolkit | Description |
-|---------|-------------|
-| ArxivToolkit | A toolkit for interacting with the arXiv API to search and download academic papers. |
-| AskNewsToolkit | A toolkit for fetching news, stories, and other content based on user queries using the AskNews API. |
-| AudioAnalysisToolkit | A toolkit for audio processing and analysis, including transcription and question answering about audio content. |
-| BrowserToolkit | A toolkit for browsing the web and interacting with web pages, including browser simulation and content extraction. |
-| CodeExecutionToolkit | A toolkit for code execution which can run code in various sandboxes including internal Python, Jupyter, Docker, subprocess, or e2b. |
-| OpenAIImageToolkit | A toolkit for image generation using OpenAI's DALL-E model. |
-| DappierToolkit | A toolkit for searching real-time data and fetching AI recommendations across key verticals like News, Finance, Stock Market, Sports, Weather and more using the Dappier API. |
-| DataCommonsToolkit | A toolkit for querying and retrieving data from the Data Commons knowledge graph, including SPARQL queries, statistical time series data, and property analysis. |
-| ExcelToolkit | A toolkit for extracting and processing content from Excel files, including conversion to markdown tables. |
-| FunctionTool | A base toolkit for creating function-based tools that OpenAI chat models can call, with support for schema parsing and synthesis. |
-| FileWriteTool | A toolkit for creating, writing, and modifying text in files. |
-| GitHubToolkit | A toolkit for interacting with GitHub repositories, including retrieving issues and creating pull requests. |
-| GoogleCalendarToolkit | A toolkit for creating events, retrieving events, updating events, and deleting events from a Google Calendar |
-| GoogleMapsToolkit | A toolkit for accessing Google Maps services, including address validation, elevation data, and timezone information. |
-| GoogleScholarToolkit | A toolkit for retrieving information about authors and their publications from Google Scholar. |
-| HumanToolkit | A toolkit for facilitating human-in-the-loop interactions and feedback in AI systems. |
-| ImageAnalysisToolkit | A toolkit for comprehensive image analysis and understanding using vision-capable language models. |
-| IMAPMailToolkit | A toolkit for IMAP email operations to spring agents into email action |
-| JinaRerankerToolkit | A toolkit for reranking documents (text or images) based on their relevance to a given query using the Jina Reranker model. |
-| LinkedInToolkit | A toolkit for LinkedIn operations including creating posts, deleting posts, and retrieving user profile information. |
-| MathToolkit | A toolkit for performing basic mathematical operations such as addition, subtraction, and multiplication. |
-| MCPToolkit | A toolkit for interacting with external tools using the Model Context Protocol (MCP). |
-| MemoryToolkit | A toolkit for saving, loading, and clearing a ChatAgent's memory. |
-| MeshyToolkit | A toolkit for working with 3D mesh data and operations. |
-| MinerUToolkit | A toolkit for extracting and processing document content using the MinerU API, with support for OCR, formula recognition, and table detection. |
-| NetworkXToolkit | A toolkit for graph operations and analysis using the NetworkX library. |
-| NotionToolkit | A toolkit for retrieving information from Notion pages and workspaces using the Notion API. |
-| OpenAPIToolkit | A toolkit for working with OpenAPI specifications and REST APIs. |
-| OpenBBToolkit | A toolkit for accessing and analyzing financial market data through the OpenBB Platform, including stocks, ETFs, cryptocurrencies, and economic indicators. |
-| PPTXToolkit | A toolkit for creating and manipulating PowerPoint (PPTX) files, including adding slides, text, and images. |
-| PubMedToolkit | A toolkit for interacting with PubMed's E-utilities API to access MEDLINE data. |
-| RedditToolkit | A toolkit for Reddit operations including collecting top posts, performing sentiment analysis on comments, and tracking keyword discussions. |
-| RetrievalToolkit | A toolkit for retrieving information from local vector storage systems based on specified queries. |
-| SearchToolkit | A toolkit for performing web searches using various search engines like Google, DuckDuckGo, Wikipedia, Bing, BaiDu and Wolfram Alpha. |
-| SemanticScholarToolkit | A toolkit for interacting with the Semantic Scholar API to fetch paper and author data from academic publications. |
-| SlackToolkit | A toolkit for Slack operations including creating channels, joining channels, and managing channel membership. |
-| StripeToolkit | A toolkit for processing payments and managing financial transactions via Stripe. |
-| SymPyToolkit | A toolkit for performing symbolic computations using SymPy, including algebraic manipulation, calculus, and linear algebra. |
-| TerminalToolkit | A toolkit for terminal operations such as searching for files by name or content, executing shell commands, and managing terminal sessions across multiple operating systems. |
-| TwitterToolkit | A toolkit for Twitter operations including creating tweets, deleting tweets, and retrieving user profile information. |
-| VideoAnalysisToolkit | A toolkit for analyzing video content with vision-language models, including frame extraction and question answering about video content. |
-| VideoDownloaderToolkit | A toolkit for downloading videos and optionally splitting them into chunks, with support for various video services. |
-| WeatherToolkit | A toolkit for fetching weather data for cities using the OpenWeatherMap API. |
-| WhatsAppToolkit | A toolkit for interacting with the WhatsApp Business API, including sending messages, managing message templates, and accessing business profile information. |
-| ZapierToolkit | A toolkit for interacting with Zapier's NLA API to execute actions through natural language commands and automate workflows. |
-| KlavisToolkit | A toolkit for interacting with Kavis AI's API to create remote hosted production-ready MCP servers. |
+| Toolkit | Description |
+| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| ArxivToolkit | A toolkit for interacting with the arXiv API to search and download academic papers. |
+| AskNewsToolkit | A toolkit for fetching news, stories, and other content based on user queries using the AskNews API. |
+| AudioAnalysisToolkit | A toolkit for audio processing and analysis, including transcription and question answering about audio content. |
+| BrowserToolkit | A toolkit for browsing the web and interacting with web pages, including browser simulation and content extraction. |
+| CodeExecutionToolkit | A toolkit for code execution which can run code in various sandboxes including internal Python, Jupyter, Docker, subprocess, or e2b. |
+| OpenAIImageToolkit | A toolkit for image generation using OpenAI's DALL-E model. |
+| DappierToolkit | A toolkit for searching real-time data and fetching AI recommendations across key verticals like News, Finance, Stock Market, Sports, Weather and more using the Dappier API. |
+| DataCommonsToolkit | A toolkit for querying and retrieving data from the Data Commons knowledge graph, including SPARQL queries, statistical time series data, and property analysis. |
+| ExcelToolkit | A toolkit for extracting and processing content from Excel files, including conversion to markdown tables. |
+| FunctionTool | A base toolkit for creating function-based tools that OpenAI chat models can call, with support for schema parsing and synthesis. |
+| FileWriteTool | A toolkit for creating, writing, and modifying text in files. |
+| GitHubToolkit | A toolkit for interacting with GitHub repositories, including retrieving issues and creating pull requests. |
+| GoogleCalendarToolkit | A toolkit for creating events, retrieving events, updating events, and deleting events from a Google Calendar |
+| GoogleMapsToolkit | A toolkit for accessing Google Maps services, including address validation, elevation data, and timezone information. |
+| GoogleScholarToolkit | A toolkit for retrieving information about authors and their publications from Google Scholar. |
+| HumanToolkit | A toolkit for facilitating human-in-the-loop interactions and feedback in AI systems. |
+| ImageAnalysisToolkit | A toolkit for comprehensive image analysis and understanding using vision-capable language models. |
+| IMAPMailToolkit | A toolkit for IMAP email operations to spring agents into email action |
+| JinaRerankerToolkit | A toolkit for reranking documents (text or images) based on their relevance to a given query using the Jina Reranker model. |
+| LinkedInToolkit | A toolkit for LinkedIn operations including creating posts, deleting posts, and retrieving user profile information. |
+| MathToolkit | A toolkit for performing basic mathematical operations such as addition, subtraction, and multiplication. |
+| MCPToolkit | A toolkit for interacting with external tools using the Model Context Protocol (MCP). |
+| MemoryToolkit | A toolkit for saving, loading, and clearing a ChatAgent's memory. |
+| MeshyToolkit | A toolkit for working with 3D mesh data and operations. |
+| MinerUToolkit | A toolkit for extracting and processing document content using the MinerU API, with support for OCR, formula recognition, and table detection. |
+| NetworkXToolkit | A toolkit for graph operations and analysis using the NetworkX library. |
+| NotionToolkit | A toolkit for retrieving information from Notion pages and workspaces using the Notion API. |
+| OpenAPIToolkit | A toolkit for working with OpenAPI specifications and REST APIs. |
+| OpenBBToolkit | A toolkit for accessing and analyzing financial market data through the OpenBB Platform, including stocks, ETFs, cryptocurrencies, and economic indicators. |
+| PPTXToolkit | A toolkit for creating and manipulating PowerPoint (PPTX) files, including adding slides, text, and images. |
+| PubMedToolkit | A toolkit for interacting with PubMed's E-utilities API to access MEDLINE data. |
+| RedditToolkit | A toolkit for Reddit operations including collecting top posts, performing sentiment analysis on comments, and tracking keyword discussions. |
+| RetrievalToolkit | A toolkit for retrieving information from local vector storage systems based on specified queries. |
+| SearchToolkit | A toolkit for performing web searches using various search engines like Google, DuckDuckGo, Wikipedia, Bing, BaiDu and Wolfram Alpha. |
+| SemanticScholarToolkit | A toolkit for interacting with the Semantic Scholar API to fetch paper and author data from academic publications. |
+| SlackToolkit | A toolkit for Slack operations including creating channels, joining channels, and managing channel membership. |
+| StripeToolkit | A toolkit for processing payments and managing financial transactions via Stripe. |
+| SymPyToolkit | A toolkit for performing symbolic computations using SymPy, including algebraic manipulation, calculus, and linear algebra. |
+| TerminalToolkit | A toolkit for terminal operations such as searching for files by name or content, executing shell commands, and managing terminal sessions across multiple operating systems. |
+| TwitterToolkit | A toolkit for Twitter operations including creating tweets, deleting tweets, and retrieving user profile information. |
+| VideoAnalysisToolkit | A toolkit for analyzing video content with vision-language models, including frame extraction and question answering about video content. |
+| VideoDownloaderToolkit | A toolkit for downloading videos and optionally splitting them into chunks, with support for various video services. |
+| WeatherToolkit | A toolkit for fetching weather data for cities using the OpenWeatherMap API. |
+| WhatsAppToolkit | A toolkit for interacting with the WhatsApp Business API, including sending messages, managing message templates, and accessing business profile information. |
+| ZapierToolkit | A toolkit for interacting with Zapier's NLA API to execute actions through natural language commands and automate workflows. |
+| KlavisToolkit | A toolkit for interacting with Klavis AI's API to create remote hosted production-ready MCP servers. |
## Using Toolkits as MCP Servers
<Card title="MCP Servers in CAMEL" icon="server">
-CAMEL supports the <b>Model Context Protocol (MCP)</b>, letting you expose any toolkit as a standalone server. This enables distributed tool execution and seamless integration across multiple systems—clients can remotely discover and invoke tools via a consistent protocol.
+ CAMEL supports the <b>Model Context Protocol (MCP)</b>, letting you expose any
+ toolkit as a standalone server. This enables distributed tool execution and
+ seamless integration across multiple systems—clients can remotely discover and
+ invoke tools via a consistent protocol.
</Card>
<Card title="What is MCP?" icon="anchor">
-MCP (Model Context Protocol) is a unified protocol for connecting LLMs with external tools and services. In CAMEL, you can turn any toolkit into an MCP server, making its tools available for remote calls—ideal for building distributed, modular, and language-agnostic AI workflows.
+ MCP (Model Context Protocol) is a unified protocol for connecting LLMs with
+ external tools and services. In CAMEL, you can turn any toolkit into an MCP
+ server, making its tools available for remote calls—ideal for building
+ distributed, modular, and language-agnostic AI workflows.
</Card>
<Card title="Expose a Toolkit as an MCP Server" icon="rocket">
@@ -181,6 +199,7 @@ if __name__ == "__main__":
toolkit = ArxivToolkit(timeout=args.timeout)
toolkit.run_mcp_server(mode=args.mode)
```
+
</Card>
<Card title="MCP Server Configuration" icon="settings">
@@ -233,6 +252,7 @@ async def run_example():
if __name__ == "__main__":
asyncio.run(run_example())
+
```
</CodeGroup>
</Card>
diff --git a/docs/key_modules/workforce.md b/docs/key_modules/workforce.md
index 2e33e5a04..58848d0d2 100644
--- a/docs/key_modules/workforce.md
+++ b/docs/key_modules/workforce.md
@@ -1,6 +1,9 @@
---
title: "Workforce"
icon: "users"
+
+doc_code_map:
+ - "camel/societies/workforce/**/*.py"
---
<Card title="Concept" icon="users">
@@ -21,11 +24,16 @@ class Workforce(BaseNode):
coordinator_agent: Optional[ChatAgent] = None,
task_agent: Optional[ChatAgent] = None,
new_worker_agent: Optional[ChatAgent] = None,
+ default_model: Optional[Union[BaseModelBackend, ModelManager]] = None,
graceful_shutdown_timeout: float = 15.0,
task_timeout_seconds: Optional[float] = None,
share_memory: bool = False,
use_structured_output_handler: bool = True,
callbacks: Optional[List[WorkforceCallback]] = None,
+ mode: WorkforceMode = WorkforceMode.AUTO_DECOMPOSE,
+ failure_handling_config: Optional[
+ Union[FailureHandlingConfig, Dict]
+ ] = None,
) -> None:
# ...
```
@@ -41,6 +49,8 @@ class Workforce(BaseNode):
- `share_memory`: If `True`, `SingleAgentWorker` instances will share memory.
- `use_structured_output_handler`: Defaults to `True`. Enables structured output handling so models without native JSON + tool-calling can still interop reliably.
- `callbacks`: Optional A list of callback handlers to observe and record workforce lifecycle events and metrics.
+- `mode`: Execution mode, either `WorkforceMode.AUTO_DECOMPOSE` (default) or `WorkforceMode.PIPELINE`.
+- `failure_handling_config`: Controls retry count, enabled recovery strategies, and whether to halt on max retries.
</Card>
<Card title="Worker Types" icon="users-gear">
@@ -103,12 +113,15 @@ workforce.add_single_agent_worker(
from camel.societies.workforce import Workforce
from camel.agents import ChatAgent
from camel.models import ModelFactory
-from camel.types import ModelType
+from camel.types import ModelPlatformType, ModelType
workforce = Workforce("Creative Writing Team")
# Create an agent with a specific model for creative tasks
-creative_model = ModelFactory.create(model_type=ModelType.GPT_5_MINI)
+creative_model = ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_5_MINI
+)
creative_agent = ChatAgent(
system_message="A creative writer for generating stories.",
model=creative_model
@@ -181,6 +194,37 @@ graph TD
5. **Failure Handling**: If a task fails, the `Workforce` initiates its recovery protocols.
</Card>
+<Card title="Pipeline Mode (Dependency Graph)" icon="diagram-project">
+Besides automatic decomposition, Workforce also supports predefined pipeline execution (`WorkforceMode.PIPELINE`) for deterministic multi-step workflows.
+
+```python
+from camel.societies.workforce import Workforce, WorkforceMode
+from camel.tasks import Task
+
+workforce = Workforce("Report Pipeline", mode=WorkforceMode.PIPELINE)
+
+workforce.pipeline_add("Collect data", task_id="collect") \
+ .pipeline_fork(["Analyze market", "Analyze risks"]) \
+ .pipeline_join("Write final report", task_id="report") \
+ .pipeline_build()
+
+result = workforce.process_task(Task(content="Generate weekly report"))
+```
+
+In pipeline mode, downstream tasks can still receive failure context from upstream tasks, which is useful for robust join/aggregation steps.
+</Card>
+
+<Card title="Runtime Control (Pause/Resume/Snapshot)" icon="hand">
+Workforce provides built-in runtime control APIs for human intervention and safe operations:
+
+- `pause()` / `resume()`
+- `stop_gracefully()` / `stop_immediately()` / `skip_gracefully()`
+- `save_snapshot()` / `list_snapshots()` / `restore_from_snapshot(...)`
+- `add_main_task(...)`, `add_subtask(...)`, `modify_task_content(...)`, `reorder_tasks(...)`
+
+This makes it possible to inspect and adjust execution while tasks are in progress.
+</Card>
+
<Card title="Advanced Usage: Human-in-the-Loop (HITL)" icon="hand">
To enable HITL inside a Workforce, equip the agents (coordinator, task agent, or workers) with the `HumanToolkit`. Agents can then call a human during execution (e.g., to clarify requirements, approve actions, or unblock errors).
@@ -189,14 +233,11 @@ from camel.societies.workforce import Workforce
from camel.agents import ChatAgent
from camel.toolkits import HumanToolkit
-# 1) Create the workforce
-workforce = Workforce("Interactive Workforce")
-
-# 2) Prepare human-in-the-loop tools
+# 1) Prepare human-in-the-loop tools
human_toolkit = HumanToolkit()
human_tools = human_toolkit.get_tools() # includes ask_human_via_console, send_message_to_user, ...
-# 3) Attach HumanToolkit to any agents that may need human help
+# 2) Attach HumanToolkit to any agents that may need human help
coordinator = ChatAgent(
system_message="You coordinate tasks and may ask a human for help when needed.",
tools=human_tools,
@@ -207,7 +248,7 @@ worker = ChatAgent(
tools=[human_toolkit.ask_human_via_console], # or use `human_tools`
)
-# 4) Register agents into the workforce
+# 3) Register agents into the workforce
workforce = Workforce(
description="Interactive Workforce",
coordinator_agent=coordinator,
@@ -215,7 +256,7 @@ workforce = Workforce(
)
workforce.add_single_agent_worker(description="Worker", worker=worker)
-# 5) Run tasks as usual. When an agent invokes a human tool, it will prompt via console.
+# 4) Run tasks as usual. When an agent invokes a human tool, it will prompt via console.
# workforce.process_task(Task(content="Build a quick demo and confirm requirements with the human."))
```
@@ -224,6 +265,16 @@ Notes:
- If you need async control, `process_task_async` is available, but it is not required for HITL.
</Card>
+<Card title="Workflow Memory" icon="database">
+For recurring tasks, `SingleAgentWorker` can persist and reuse workflow traces:
+
+- `save_workflow_memories_async()` (recommended async path)
+- `load_workflow_memories(...)`
+- Selection metadata via `WorkflowSelectionMethod`
+
+This helps workers reuse proven execution patterns across similar tasks.
+</Card>
+
<Card title="Key Data Structures" icon="database">
The `workforce` module uses several Pydantic models to ensure structured data exchange.
@@ -231,7 +282,7 @@ The `workforce` module uses several Pydantic models to ensure structured data ex
- **`TaskResult`**: Represents the output of a completed task.
- **`TaskAssignment`**: A single task-to-worker assignment, including dependencies.
- **`TaskAssignResult`**: A list of `TaskAssignment` objects.
-- **`RecoveryDecision`**: The output of the failure analysis process, dictating the recovery strategy.
+- **`TaskAnalysisResult`**: Unified output for failure/quality analysis, including recommended recovery strategy.
Understanding these models is key to interpreting the workforce's internal state and logs.
</Card>
@@ -247,7 +298,7 @@ Understanding these models is key to interpreting the workforce's internal state
<Card
title="API Reference"
icon="book"
- href="/reference/#societies.workforce"
+ href="/reference/camel.societies.workforce.workforce"
>
Full documentation for advanced usage and configuration.
</Card>
diff --git a/docs/mcp/camel_agents_as_an_mcp_clients.md b/docs/mcp/camel_agents_as_an_mcp_clients.md
index 033e8a71b..accb1df38 100644
--- a/docs/mcp/camel_agents_as_an_mcp_clients.md
+++ b/docs/mcp/camel_agents_as_an_mcp_clients.md
@@ -1,6 +1,11 @@
---
title: "CAMEL Agents as an MCP Client"
icon: plug
+
+doc_code_map:
+ - "camel/agents/mcp_agent.py"
+ - "camel/toolkits/mcp_toolkit.py"
+ - "camel/utils/mcp_client.py"
---
This guide walks you through turning your CAMEL AI agent into an MCP client, letting your agent easily use tools from multiple MCP servers.
@@ -11,8 +16,6 @@ This guide walks you through turning your CAMEL AI agent into an MCP client, let
2. **Use MCPToolkit to Connect**: Load your config file to connect to the servers.
3. **Enable Tools in CAMEL Agent**: Pass the server tools to your CAMEL agent to use.
-This guide walks you through turning your CAMEL AI agent into an MCP client, letting your agent easily use tools from multiple MCP servers.
-
## Step-by-Step Setup
<Steps>
@@ -51,34 +54,35 @@ This guide walks you through turning your CAMEL AI agent into an MCP client, let
}
```
</Tab>
- <Tab title="ACI.dev Server (configurable transport)">
- ```json
- {
- "mcpServers": {
- "aci_apps": {
- "command": "uvx",
- "args": [
- "aci-mcp",
- "apps-server",
- "--apps=BRAVE_SEARCH,GITHUB,ARXIV",
- "--linked-account-owner-id",
- "<your_linked_acc_owner_id>"
- ],
- "env": {
- "ACI_API_KEY": "your_aci_api_key"
- },
- "transport": "sse" // or "streamable-http"
+
+ <Tab title="ACI.dev Server (configurable transport)">
+ ```json
+ {
+ "mcpServers": {
+ "aci_apps": {
+ "command": "uvx",
+ "args": [
+ "aci-mcp",
+ "apps-server",
+ "--apps=BRAVE_SEARCH,GITHUB,ARXIV",
+ "--linked-account-owner-id",
+ "<your_linked_acc_owner_id>"
+ ],
+ "env": {
+ "ACI_API_KEY": "your_aci_api_key"
+ },
+ "transport": "sse" // or "streamable-http"
+ }
}
}
- }
- ```
- <Note type="info">
-You can use <code>sse</code> or <code>streamable-http</code> for ACI.dev, pick whichever is supported by your agent/server.
-</Note>
- </Tab>
-
+ ```
+ <Note type="info">
+ You can use <code>sse</code> or <code>streamable-http</code> for ACI.dev, pick whichever is supported by your agent/server.
+ </Note>
+ </Tab>
</Tabs>
+
</Step>
<Step title="Step 2: Connect & Build the Agent">
@@ -86,14 +90,22 @@ You can use <code>sse</code> or <code>streamable-http</code> for ACI.dev, pick w
```python
import asyncio
- from camel.toolkits.mcp_toolkit import MCPToolkit
+
from camel.agents import ChatAgent
+ from camel.models import ModelFactory
+ from camel.toolkits import MCPToolkit
+ from camel.types import ModelPlatformType, ModelType
+
+ model = ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ )
async def main():
async with MCPToolkit(config_path="config/time.json") as toolkit:
- agent = ChatAgent(model=model, tools=toolkit.get_tools())
- response = await agent.astep("What time is it now?")
- print(response.msgs[0].content)
+ agent = ChatAgent(model=model, tools=toolkit.get_tools())
+ response = await agent.astep("What time is it now?")
+ print(response.msgs[0].content)
asyncio.run(main())
```
@@ -116,19 +128,21 @@ You can use <code>sse</code> or <code>streamable-http</code> for ACI.dev, pick w
## How It Works – System Diagram
<Card title="CAMEL Agent as an MCP Client" img="/images/camel_toolks_as_mcp_server.png">
-This diagram illustrates how CAMEL agents use MCPToolkit to seamlessly connect with MCP servers. Servers provide external tools from platforms like GitHub, Gmail, Notion, and more.
+ This diagram illustrates how CAMEL agents use MCPToolkit to seamlessly connect
+ with MCP servers. Servers provide external tools from platforms like GitHub,
+ Gmail, Notion, and more.
</Card>
-<Card title="Advanced: Register with MCP Hubs & Registries">
-
<Card title="Connect your agent to an MCP registry" icon="link">
Want your MCP agent discoverable by thousands of clients?
Register it with a hub like <a href="https://aci.dev/" target="_blank">ACI.dev</a> or similar.
-```python Register with ACI Registry lines icon="python"
-from camel.agents import MCPAgent
-from camel.types import ACIRegistryConfig, ModelFactory, ModelPlatformType, ModelType
+```python title="register_with_aci.py"
import os
+from camel.agents import MCPAgent
+from camel.models import ModelFactory
+from camel.types import ACIRegistryConfig, ModelPlatformType, ModelType
+
aci_config = ACIRegistryConfig(
api_key=os.getenv("ACI_API_KEY"),
linked_account_owner_id=os.getenv("ACI_LINKED_ACCOUNT_OWNER_ID"),
@@ -146,21 +160,17 @@ agent = MCPAgent(
Your agent is now connected to the <a href="https://aci.dev/" target="_blank">ACI.dev</a> registry and visible in the ecosystem.
</Card>
-<Card title = "Discover MCP Servers Easily with PulseMCP">
-
+<Card title="Discover MCP Servers Easily with PulseMCP" icon="wave-pulse">
Finding MCP servers is now a breeze with PulseMCP integration.
You don’t have to guess which MCP servers are available, just search, browse, and connect.
-
-<Card title="Discover MCP Servers Instantly" icon="wave-pulse">
-PulseMCP acts as a living directory of the entire MCP ecosystem.
-CAMEL toolkits can plug directly into PulseMCP, letting you browse and connect to thousands of servers, all kept up to date in real time.
+PulseMCP acts as a living directory of the entire MCP ecosystem. CAMEL toolkits can plug directly into PulseMCP, letting you browse and connect to thousands of servers, all kept up to date in real time.
You can visit [PulseMCP.com](https://pulsemcp.com) to browse all available MCP servers—everything from file systems and search to specialized APIs.
If you prefer to search programmatically inside your CAMEL code, just use:
<CodeBlock language="python" title="pulse_mcp_search.py">
-from camel.toolkits.mcp import PulseMCPSearchToolkit
+from camel.toolkits import PulseMCPSearchToolkit
search_toolkit = PulseMCPSearchToolkit()
results = search_toolkit.search_mcp_servers(query="Slack", top_k=1)
@@ -169,13 +179,11 @@ print(results)
PulseMCP does the heavy lifting of finding, categorizing, and keeping MCP servers fresh—your agents just connect and go.
</Card>
-</Card>
<Card title="Minimal agent without function-calling" icon="function">
Don’t need advanced tool-calling?
See <a href="https://github.com/camel-ai/camel/blob/master/examples/agents/mcp_agent/mcp_agent_without_function_calling.py" target="_blank">this example</a> for a super-lightweight setup.
</Card>
-</Card>
## Using Transport Methods
diff --git a/docs/mcp/camel_toolkits_as_an_mcp_server.md b/docs/mcp/camel_toolkits_as_an_mcp_server.md
index 843731b66..03b9d6a3c 100644
--- a/docs/mcp/camel_toolkits_as_an_mcp_server.md
+++ b/docs/mcp/camel_toolkits_as_an_mcp_server.md
@@ -2,6 +2,12 @@
title: "Toolkit as MCP Server"
icon: "server"
description: "Share any CAMEL toolkit as an MCP server so external clients and agents can use your tools."
+
+doc_code_map:
+ - "camel/toolkits/base.py"
+ - "camel/toolkits/function_tool.py"
+ - "camel/toolkits/mcp_toolkit.py"
+ - "camel/utils/mcp_client.py"
---
<CardGroup cols={2}>
@@ -35,7 +41,7 @@ You can turn any CAMEL toolkit into a full-featured MCP server—making its tool
Below is a minimal script to expose <b>ArxivToolkit</b> as an MCP server.
Swap in any other toolkit (e.g., <code>SearchToolkit</code>, <code>MathToolkit</code>), they all work the same way!
-```python
+<CodeBlock language="python" title="arxiv_toolkit_server.py">
from camel.toolkits import ArxivToolkit
import argparse
@@ -52,7 +58,7 @@ args = parser.parse_args()
toolkit = ArxivToolkit()
toolkit.mcp.run(args.mode)
-```
+</CodeBlock>
- **stdio:** For local IPC (default, fast and secure for single-machine setups)
- **sse:** Server-Sent Events (good for remote servers and web clients)
diff --git a/docs/mcp/connecting_existing_mcp_tools.md b/docs/mcp/connecting_existing_mcp_tools.md
index f6adcebca..b9759968d 100644
--- a/docs/mcp/connecting_existing_mcp_tools.md
+++ b/docs/mcp/connecting_existing_mcp_tools.md
@@ -2,6 +2,10 @@
title: 'Connect to Existing MCP Tools in CAMEL ChatAgent'
description: 'How to plug any MCP protocol tool (like file systems, web APIs) into your CAMEL ChatAgent for seamless tool-using agents.'
icon: 'network'
+
+doc_code_map:
+ - "camel/toolkits/mcp_toolkit.py"
+ - "camel/utils/mcp_client.py"
---
## Overview
diff --git a/docs/mcp/export_camel_agent_as_mcp_server.md b/docs/mcp/export_camel_agent_as_mcp_server.md
index 7ea13a9fb..a264b1e60 100644
--- a/docs/mcp/export_camel_agent_as_mcp_server.md
+++ b/docs/mcp/export_camel_agent_as_mcp_server.md
@@ -2,11 +2,17 @@
title: "CAMEL Agent as an MCP Server"
icon: server
description: "Turn your CAMEL ChatAgent into an MCP server—let any client (Claude, Cursor, custom apps) connect and use your agent as a universal AI backend."
+
+doc_code_map:
+ - "services/agent_mcp/agent_mcp_server.py"
+ - "camel/agents/mcp_agent.py"
---
<Card title="Why export a ChatAgent as an MCP server?" icon="server">
-Publishing your <b>ChatAgent</b> as an MCP server turns your agent into a universal AI backend.
-Any MCP-compatible client (Claude, Cursor, editors, or your own app) can connect, chat, and run tools through your agent as if it were a native API—no custom integration required.
+ Publishing your <b>ChatAgent</b> as an MCP server turns your agent into a
+ universal AI backend. Any MCP-compatible client (Claude, Cursor, editors, or
+ your own app) can connect, chat, and run tools through your agent as if it
+ were a native API—no custom integration required.
</Card>
## Quick Start
@@ -22,7 +28,7 @@ Configure your MCP client (Claude, Cursor, etc.) to connect:
"camel-chat-agent": {
"command": "/path/to/python",
"args": [
- "/path/to/camel/services/agent_mcp_server.py"
+ "/path/to/camel/services/agent_mcp/agent_mcp_server.py"
],
"env": {
"OPENAI_API_KEY": "...",
@@ -43,16 +49,20 @@ Turn any <code>ChatAgent</code> into an MCP server instantly with <code>to_mcp()
from camel.agents import ChatAgent
# Create a chat agent with your model
+
agent = ChatAgent(model="gpt-4o-mini")
# Convert to an MCP server
+
mcp_server = agent.to_mcp(
- name="demo", description="A demonstration of ChatAgent to MCP conversion"
+ name="demo",
+ description="A demonstration of ChatAgent to MCP conversion",
)
if __name__ == "__main__":
print("Starting MCP server on http://localhost:8000")
mcp_server.run(transport="streamable-http")
+
```
<Info>
<b>Supported transports:</b> <code>stdio</code>, <code>sse</code>, <code>streamable-http</code>
diff --git a/docs/mcp/mcp_hub.md b/docs/mcp/mcp_hub.md
index 4077a53ea..04d4fd60a 100644
--- a/docs/mcp/mcp_hub.md
+++ b/docs/mcp/mcp_hub.md
@@ -2,4 +2,7 @@
title: "CAMEL-AI MCPHub"
icon: warehouse
url: "https://mcp.camel-ai.org/"
+
+doc_code_map:
+ - "camel/toolkits/mcp_toolkit.py"
---
diff --git a/docs/mcp/overview.md b/docs/mcp/overview.md
index 60e3ef12f..a2bcd7ba2 100644
--- a/docs/mcp/overview.md
+++ b/docs/mcp/overview.md
@@ -2,6 +2,10 @@
title: 'Overview'
description: 'Introduction to MCP: what it is, why it matters, and how it transforms agent integration.'
icon: 'play'
+
+doc_code_map:
+ - "camel/toolkits/mcp_toolkit.py"
+ - "camel/utils/mcp_client.py"
---
## What is MCP all about?
diff --git a/docs/mintlify/docs_sync/README.mdx b/docs/mintlify/docs_sync/README.mdx
new file mode 100644
index 000000000..256f46cad
--- /dev/null
+++ b/docs/mintlify/docs_sync/README.mdx
@@ -0,0 +1,110 @@
+---
+title: "Readme"
+---
+
+# docs code map tooling
+
+This folder keeps Mintlify documentation in sync with CAMEL source code.
+
+## Scripts
+
+| Script | Purpose |
+|--------|---------|
+| `doc_code_map.py` | Validate `doc_code_map` frontmatter and find impacted docs after code changes. |
+| `auto_sync_docs_with_chatagent.py` | Ask a CAMEL ChatAgent to inspect impacted docs with terminal tools and update them directly. Located at `.camel/skills/docs-incremental-update/scripts/`. |
+
+Documented doc roots:
+
+- `docs/mintlify/key_modules/*.mdx`
+- `docs/mintlify/mcp/*.mdx`
+
+## How It Works
+
+Each `.mdx` doc declares a `doc_code_map` block in its YAML frontmatter listing
+glob patterns for the source files it documents. When code changes land,
+`doc_code_map.py impacted` matches the changed files against those patterns to
+produce a list of impacted docs. `auto_sync_docs_with_chatagent.py` then passes
+each target doc path plus `changed_python_files.txt` to a CAMEL ChatAgent. The
+agent uses terminal tools to inspect the target doc and any relevant code, then
+updates the target doc directly when a reader-facing change is needed.
+
+The GitHub Actions workflow `.github/workflows/docs_release_auto_sync_pr.yml`
+orchestrates this end-to-end on every release tag diff and opens a PR
+automatically when mapped docs actually changed.
+
+## Commands
+
+Verify all mappings and ensure every pattern resolves to at least one file:
+
+```bash
+python docs/mintlify/scripts/docs_sync/doc_code_map.py verify
+```
+
+Print impacted docs from an explicit changed-file list:
+
+```bash
+python docs/mintlify/scripts/docs_sync/doc_code_map.py impacted \
+ --changed-file camel/toolkits/mcp_toolkit.py \
+ --changed-file camel/societies/workforce/workforce.py
+```
+
+Print impacted docs from a file containing changed paths:
+
+```bash
+python docs/mintlify/scripts/docs_sync/doc_code_map.py impacted \
+ --changed-files-file changed_python_files.txt
+```
+
+Print impacted docs from git refs:
+
+```bash
+python docs/mintlify/scripts/docs_sync/doc_code_map.py impacted --base-ref <base> --head-ref <head>
+```
+
+Auto-sync impacted docs with CAMEL ChatAgent:
+
+```bash
+python .camel/skills/docs-incremental-update/scripts/auto_sync_docs_with_chatagent.py \
+ --docs-file impacted_docs.txt \
+ --changed-files-file changed_python_files.txt \
+ --model-platform openai \
+ --model-type gpt-5.4
+```
+
+## Environment Variables
+
+The auto-sync script requires an API key for the chosen model platform.
+The release workflow is fixed to OpenAI `gpt-5.4` and expects
+`OPENAI_API_KEY`.
+
+| Platform | Variable |
+|----------|----------|
+| OpenAI (default) | `OPENAI_API_KEY` |
+| Anthropic | `ANTHROPIC_API_KEY` |
+| Other platforms | See CAMEL `ModelPlatformType` docs |
+
+Example:
+
+```bash
+export OPENAI_API_KEY=...
+```
+
+## Manual Multi-Platform Support
+
+When you run the script directly, both `--model-platform` and `--model-type`
+can be overridden to use any backend supported by CAMEL's `ModelFactory`.
+For example:
+
+```bash
+python .camel/skills/docs-incremental-update/scripts/auto_sync_docs_with_chatagent.py \
+ --docs-file impacted_docs.txt \
+ --model-platform anthropic \
+ --model-type claude-sonnet-4-20250514
+```
+
+## Repo Skill
+
+The repo skill at `.camel/skills/docs-incremental-update/` guides the agent to
+inspect the impacted doc, use `changed_python_files.txt` as context, inspect
+any other relevant code when needed, and edit that doc directly through
+terminal tools with the smallest necessary diff.