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-bote29354f47088
diff --git a/docs/mintlify/docs.json b/docs/mintlify/docs.json
index dfd4bcc3e..086d1ae4c 100644
--- a/docs/mintlify/docs.json
+++ b/docs/mintlify/docs.json
@@ -631,6 +631,7 @@
{
"group": "Utilities",
"pages": [
+ "reference/camel.utils.agent_context",
"reference/camel.utils.async_func",
"reference/camel.utils.commons",
"reference/camel.utils.context_utils",
diff --git a/docs/mintlify/reference/camel.agents.chat_agent.mdx b/docs/mintlify/reference/camel.agents.chat_agent.mdx
index e711261f2..e8f45615a 100644
--- a/docs/mintlify/reference/camel.agents.chat_agent.mdx
+++ b/docs/mintlify/reference/camel.agents.chat_agent.mdx
@@ -261,7 +261,7 @@ Class for managing conversations of CAMEL Chat Agents.
- **token_limit** (int, optional): The maximum number of tokens allowed for the context window. If `None`, uses the model's default token limit. This can be used to restrict the context size below the model's maximum capacity. (default: :obj:`None`)
- **output_language** (str, optional): The language to be output by the agent. (default: :obj:`None`)
- **tools** (Optional[List[Union[FunctionTool, Callable]]], optional): List of available :obj:`FunctionTool` or :obj:`Callable`. (default: :obj:`None`) toolkits_to_register_agent (Optional[List[RegisteredAgentToolkit]], optional): List of toolkit instances that inherit from :obj:`RegisteredAgentToolkit`. The agent will register itself with these toolkits, allowing them to access the agent instance. Note: This does NOT add the toolkit's tools to the agent. To use tools from these toolkits, pass them explicitly via the `tools` parameter. (default: :obj:`None`) external_tools (Optional[List[Union[FunctionTool, Callable, Dict[str, Any]]]], optional): List of external tools (:obj:`FunctionTool` or :obj:`Callable` or :obj:`Dict[str, Any]`) bind to one chat agent. When these tools are called, the agent will directly return the request instead of processing it. (default: :obj:`None`)
-- **response_terminators** (List[ResponseTerminator], optional): List of :obj:`ResponseTerminator` bind to one chat agent. (default: :obj:`None`)
+- **response_terminators** (List[ResponseTerminator], optional): List of :obj:`ResponseTerminator` to check if task is complete. When set, the agent will keep prompting the model until a terminator signals completion. Note: You must define the termination signal (e.g., a keyword) in your system prompt so the model knows what to output. (default: :obj:`None`)
- **scheduling_strategy** (str): name of function that defines how to select the next model in ModelManager. (default: :str:`round_robin`)
- **max_iteration** (Optional[int], optional): Maximum number of model calling iterations allowed per step. If `None` (default), there's no explicit limit. If `1`, it performs a single model call. If `N > 1`, it allows up to N model calls. (default: :obj:`None`)
- **agent_id** (str, optional): The ID of the agent. If not provided, a random UUID will be generated. (default: :obj:`None`)
@@ -274,7 +274,7 @@ Class for managing conversations of CAMEL Chat Agents.
- **retry_attempts** (int, optional): Maximum number of retry attempts for rate limit errors. (default: :obj:`3`)
- **retry_delay** (float, optional): Initial delay in seconds between retries. Uses exponential backoff. (default: :obj:`1.0`)
- **step_timeout** (Optional[float], optional): Timeout in seconds for the entire step operation. If None, no timeout is applied. (default: :obj:`None`)
-- **stream_accumulate** (bool, optional): When True, partial streaming updates return accumulated content (current behavior). When False, partial updates return only the incremental delta. (default: :obj:`True`)
+- **stream_accumulate** (Optional[bool], optional): When True, partial streaming updates return accumulated content. When False, partial updates return only the incremental delta (recommended). If None, defaults to False with a deprecation warning for users who previously relied on the old default (True). (default: :obj:`None`, which behaves as :obj:`False`)
- **summary_window_ratio** (float, optional): Maximum fraction of the total context window that can be occupied by summary information. Used to limit how much of the model's context is reserved for summarization results. (default: :obj:`0.6`)
<a id="camel.agents.chat_agent.ChatAgent.__init__"></a>
@@ -307,7 +307,7 @@ def __init__(
retry_attempts: int = 3,
retry_delay: float = 1.0,
step_timeout: Optional[float] = Constants.TIMEOUT_THRESHOLD,
- stream_accumulate: bool = True,
+ stream_accumulate: Optional[bool] = None,
summary_window_ratio: float = 0.6
):
```
@@ -1483,6 +1483,19 @@ def _get_token_count(self, content: str):
Get token count for content with fallback.
+<a id="camel.agents.chat_agent.ChatAgent._warn_stream_accumulate_deprecation"></a>
+
+### _warn_stream_accumulate_deprecation
+
+```python
+def _warn_stream_accumulate_deprecation(self):
+```
+
+Issue deprecation warning for stream_accumulate default change.
+
+Only warns once per agent instance, and only if the user didn't
+explicitly set stream_accumulate.
+
<a id="camel.agents.chat_agent.ChatAgent._stream_response"></a>
### _stream_response
diff --git a/docs/mintlify/reference/camel.utils.agent_context.mdx b/docs/mintlify/reference/camel.utils.agent_context.mdx
new file mode 100644
index 000000000..78cd0a86b
--- /dev/null
+++ b/docs/mintlify/reference/camel.utils.agent_context.mdx
@@ -0,0 +1,30 @@
+<a id="camel.utils.agent_context"></a>
+
+<a id="camel.utils.agent_context.set_current_agent_id"></a>
+
+## set_current_agent_id
+
+```python
+def set_current_agent_id(agent_id: str):
+```
+
+Set the current agent ID in context-local storage.
+
+This is safe to use in both sync and async contexts.
+In async contexts, each coroutine maintains its own value.
+
+**Parameters:**
+
+- **agent_id** (str): The agent ID to set.
+
+<a id="camel.utils.agent_context.get_current_agent_id"></a>
+
+## get_current_agent_id
+
+```python
+def get_current_agent_id():
+```
+
+**Returns:**
+
+ Optional[str]: The agent ID if set, None otherwise.
diff --git a/docs/mintlify/reference/camel.utils.langfuse.mdx b/docs/mintlify/reference/camel.utils.langfuse.mdx
index 11b232a8f..a8791ce7c 100644
--- a/docs/mintlify/reference/camel.utils.langfuse.mdx
+++ b/docs/mintlify/reference/camel.utils.langfuse.mdx
@@ -47,7 +47,10 @@ Check if Langfuse is configured.
def set_current_agent_session_id(session_id: str):
```
-Set the session ID for the current agent in thread-local storage.
+Set the session ID for the current agent in context-local storage.
+
+This is safe to use in both sync and async contexts.
+In async contexts, each coroutine maintains its own value.
**Parameters:**