Skip to content

Build and run agents you can see, understand and trust.

feat(agent): support to disable console output from environment variable (#1001)

DavdGao5e0adc36ad64
diff --git a/src/agentscope/agent/_agent_base.py b/src/agentscope/agent/_agent_base.py
index 0ac03550d..0779a1781 100644
--- a/src/agentscope/agent/_agent_base.py
+++ b/src/agentscope/agent/_agent_base.py
@@ -3,6 +3,7 @@
import asyncio
import io
import json
+import os
from asyncio import Task, Queue
from collections import OrderedDict
from copy import deepcopy
@@ -168,7 +169,13 @@ class AgentBase(StateModule, metaclass=_AgentMeta):
# We add this variable in case developers want to disable the console
# output of the agent, e.g., in a production environment.
- self._disable_console_output: bool = False
+ self._disable_console_output: bool = (
+ os.getenv(
+ "AGENTSCOPE_DISABLE_CONSOLE_OUTPUT",
+ "false",
+ ).lower()
+ == "true"
+ )
# The streaming message queue used to export the messages as a
# generator