examples/console/README.md
This example demonstrates the agentscope.console module: trying and
debugging an agent directly in the terminal, without launching the web
service or writing any UI code.
main.py assembles a full-featured agent and hands it to
launch_console:
DashScopeChatModel (default qwen3.7-max), streaming.LocalWorkspace rooted at ./workspace. The
builtin filesystem tools (Bash/Edit/Glob/Grep/Read/Write) and the
agent skills both come from the workspace, bound to its backend and
skill partition.AgenticMemoryMiddleware persists durable
facts as Markdown files under the workspace directory, surviving
across runs.launch_console):
y allows once, a also accepts the
suggested permission rules so matching calls won't ask again;exit/quit/Ctrl+D leaves.export DASHSCOPE_API_KEY=sk-...
python main.py # interactive chat
python main.py --verbosity debug # plus lifecycle events
python main.py --verbosity quiet # only the reply text
Things worth trying:
List the python files in this directory — read-only tools run
without confirmation.Create a note.md summarizing our conversation — Write asks for
confirmation; answer a and watch follow-up writes skip the prompt.Please remember that I prefer concise Chinese answers — the memory
middleware persists it under workspace/; restart the demo and ask
What do you remember about me?.For agent pipelines or scripts where you own the loop, use the passive
ConsoleRenderer instead of launch_console:
from agentscope.console import ConsoleRenderer
renderer = ConsoleRenderer()
async for event in agent.reply_stream(msg):
renderer.render(event)
final_msg = renderer.last_msg
Inputs, tool-call confirmation and interruption are then the caller's responsibility — the renderer only prints.