[KongchangAI]
· 2 min read· 1,142 words

AgentScope 2.0 in Practice: A Guide to Building Production-Grade AI Agents

AgentScope 2.0 in Practice: A Guide to Building Production-Grade AI Agents

AgentScope 2.0 builds production-grade AI agents via the ReAct loop, a three-dimensional security defense line, and context management.

The article introduces AgentScope 2.0, a production-oriented agent development framework. Unlike ordinary chatbots, Agents can think autonomously, invoke tools, and execute multi-step tasks, so a framework is needed to manage their construction, deployment, and operation. AgentScope centers on the ReAct (Reasoning + Acting) pattern and offers three defense layers—tool review, HITL, and secure sandbox—plus systematic context management. Version 2.0 brings massive changes, so learning it directly is recommended.

AgentScope 2.0 in Practice: A Guide to Building Production-Grade AI Agents

Why We Need an Agent Development Framework

An ordinary chatbot is only responsible for answering questions, whereas an Agent can think autonomously, invoke tools, and execute multi-step tasks. For example, when you ask an Agent to "analyze sales data, generate a report, and email it to the manager," it needs to read the data, call Python analysis functions, generate the report, and invoke the email tool—a sequence of actions far beyond simple Q&A. As Agent capabilities grow, how to develop, control, and ensure their behavior stays controllable becomes a challenge, and agent development frameworks have emerged in response. AgentScope is one of them: it helps developers build, deploy, manage, and run Agents—essentially a development framework for managing Agents.

Core Capabilities of AgentScope 2.0

ReAct Agent: The Think-and-Act Loop

ReAct is not the frontend framework React, but a combination of Reasoning and Acting. Take "check the weather in Beijing and remind me to bring an umbrella" as an example: upon receiving the request, the Agent first thinks "I need to know the weather," then acts by calling the weather tool; after getting the result, it thinks again "it will rain, so I need to remind the user to bring an umbrella," and finally replies to the user. This "think-act-observe-think again" loop repeats until complex tasks are completed. AgentScope adopts this thinking pattern as its core construction approach and provides tool calling, streaming execution, interruption and recovery, and other capabilities suited to complex task scenarios.

Academic origin of ReAct: The concept of ReAct originates from the 2022 paper "ReAct: Synergizing Reasoning and Acting in Language Models," jointly published by Princeton University and Google. The paper's core insight is that letting large models interleave "reasoning traces" and "concrete actions" can significantly reduce hallucination and improve task success rates. Compared with reasoning that only does Chain-of-Thought, ReAct's "acting" feeds external observations (tool return values) back into the model, forming a closed loop, which performs better in scenarios requiring real-time information or multi-step decision-making. Understanding this helps developers see why AgentScope treats ReAct as a core abstraction rather than a simple wrapper around function calling.

HITL (Human-in-the-Loop) refers to a design paradigm in which humans are part of the process, commonly found in high-risk automation systems. In Agent scenarios, HITL is usually implemented through an "interrupt-approve-resume" mechanism: the Agent suspends when it reaches a sensitive node and continues only after receiving human instructions. It is not only a safety measure but also commonly used to collect human feedback to improve Agent policies, so it has value for both protection and iteration.

A Three-Dimensional Unified Security Defense Line

When an Agent's permissions expand (such as deleting files, executing code, operating databases, sending emails, or calling internal systems), fully autonomous operation carries extremely high risk. AgentScope builds its security defense line from three dimensions:

  • Tool review: Checks are performed before invoking sensitive tools. Ordinary tools (such as checking the weather) can be executed directly, while tools that might delete database contents require further review.
  • Human-in-the-Loop (HITL): Humans make the final decision on critical steps. For example, when the Agent is about to execute a delete operation, it pauses and waits for an administrator to approve or reject it; approval means continuing, and rejection means stopping or adjusting. This does not block autonomy but leaves the final say on high-risk actions to humans.

So what if the agent's judgment is wrong

  • Secure sandbox isolation: Provides an isolated space for the Agent to execute code or process files, avoiding impact on the host system. Even if human-in-the-loop approval goes wrong, the sandbox can limit the scope of damage.

And this sandbox of ours

The three can be used together: tool review decides "whether it can be done," human-in-the-loop decides "whether it is allowed to be done," and the sandbox handles "where it can be done safely."

Common implementations of secure sandboxes mainly fall into three categories: first, operating-system-level isolation, such as containers (Docker) or lightweight virtual machines (Firecracker), which restrict file, network, and resource access through namespaces and cgroups; second, language-runtime-level sandboxes, such as restricting the available built-ins of eval/exec in Python, using RestrictedPython, or executing in a separate subprocess; third, policy sandboxes based on permission declarations, exposing only allowed APIs in a whitelist manner. Production environments usually combine these and assign capabilities to Agents according to the "principle of least privilege." Note that a sandbox can only limit the scope of damage and cannot replace tool review and human-in-the-loop; the three are different layers of defense in depth.

Systematic Context Management

An Agent working for a long time may search dozens of web pages, invoke tools dozens of times, and read a large number of files, causing the context to expand rapidly. Large models have limited context windows, and important information can easily be drowned out. AgentScope provides multiple context management methods (detailed in later lessons) to ensure key information is not diluted during long tasks.

Version Evolution and Learning Advice

AgentScope 1.0 was released in 2025, while version 2.0 brings massive changes, with many APIs deprecated—described as a "devastating change." Learning 2.0 directly is sufficient; there is no need to start from 1.0, because 2.0 is already production-grade.

For example, if you previously learned 1.0

The framework provides both Python and Java versions. The current course focuses on the Python version, while the Java version can be self-studied by referring to the official documentation. The official documentation supports switching to Chinese, making it suitable for developers with strong self-learning ability to extend their learning.

Summary

AgentScope 2.0 addresses the security and context issues brought by autonomy and provides complete engineering capabilities. It is a production-oriented agent development framework. Through the ReAct loop, a three-dimensional security defense line, and context management, developers can build controllable and reliable AI Agents.

One-line Summary

AgentScope 2.0 builds production-grade AI agents through the ReAct loop, a three-dimensional security defense line, and context management.

Paragraph Summary

The article introduces AgentScope 2.0, a production-oriented agent development framework. Unlike ordinary chatbots, Agents can think autonomously, invoke tools, and execute multi-step tasks, so a framework is needed to manage their construction, deployment, and operation. AgentScope centers on the ReAct (Reasoning + Acting) pattern, supporting complex tasks through a "think-act-observe" loop, and offers tool calling, streaming execution, and interruption recovery. Facing the risks brought by expanded Agent permissions, the framework provides three defense layers—tool review, human-in-the-loop (HITL), and secure sandbox—answering "whether it can be done," "whether it is allowed to be done," and "where it can be done safely." In addition, systematic context management addresses context expansion in long tasks. Version 2.0 brings massive changes with many deprecated APIs, so developers are advised to learn 2.0 directly; the framework offers both Python and Java versions.

#AgentScope 2.0#AI agent framework#ReAct agent#HITL#secure sandbox#context management
Share:

Related articles