## 项目概述

AgentScope 2.0 是一个生产就绪、易于使用的智能体框架，提供 ReAct 智能体、工具包、模型、上下文管理、事件系统、权限控制、中间件、长期记忆和工作区/沙箱等核心构建块，并内置多租户、多会话的 Agent Service 后端与 Web UI，支持 MCP、RAG、多智能体协作和即时通讯频道集成。

## 核心功能

- **ReAct 智能体**：推理-行动循环，支持结构化输出、实时中断与恢复、批量工具执行。
- **工具包**：管理 Python 工具、MCP 服务器和技能，内置编码工具（Shell、文件编辑、搜索）和任务/计划工具。
- **模型**：支持 OpenAI、Anthropic、Gemini、DashScope、DeepSeek、Moonshot、xAI、Ollama 等主流 LLM、Embedding 和 TTS 模型。
- **上下文管理**：自动压缩、工具结果卸载、通过中间件注入系统提示、RAG 和记忆。
- **事件系统**：统一事件总线，流式传输推理、工具调用和多模态内容（文本、图像、音频）到前端。
- **权限与人工介入**：对工具和资源的细粒度控制，支持确认和绕过模式。
- **中间件**：可组合的钩子，覆盖回复、推理、行动、模型调用、权限检查、上下文压缩等环节。
- **长期记忆**：支持 ReMe、Mem0 等可切换后端的智能体记忆。
- **工作区/沙箱**：隔离的工具和代码执行环境，支持本地、Docker、Apple Container、Bubblewrap、E2B、OpenSandbox、Daytona、K8s。
- **Agent Service**：多租户、多会话的 FastAPI 后端，预构建 Web UI，支持频道（飞书、Discord）、RAG 服务、MCP 与技能中心、资源分享、持久化、任务调度。
- **多智能体协作**：Leader-Worker 编排，内置团队工具，任务规划。

## 适用与不适用场景

**适用场景**：
- 构建生产级单智能体或多智能体应用。
- 需要将智能体接入即时通讯平台（如飞书、Discord）。
- 需要 RAG、长期记忆、沙箱执行等高级功能。
- 需要多租户、多会话的智能体服务部署。

**不适用场景**：
- 仓库资料未提供。

## 技术架构与依赖

- **编程语言**：Python 3.11+。
- **核心依赖**：仓库资料未提供。
- **可选依赖**：支持多种模型提供商（OpenAI、Anthropic、Gemini 等）、存储后端（SQL、NoSQL）、沙箱后端（Docker、K8s 等）。
- **架构**：SDK 层（构建块）+ Agent Service 层（FastAPI 后端 + Web UI）。

## 安装与快速开始

### 安装

**从 PyPI 安装**：
```bash
uv pip install agentscope
```

**从源码安装**：
```bash
git clone -b main https://github.com/agentscope-ai/agentscope.git
cd agentscope
uv pip install -e .
```

### 快速开始（控制台智能体）

```python
from agentscope.agent import Agent
from agentscope.console import launch_console
from agentscope.tool import Toolkit, Bash, Grep, Glob, Read, Write, Edit
from agentscope.credential import DashScopeCredential
from agentscope.model import DashScopeChatModel

import os, asyncio

async def main() -> None:
    agent = Agent(
        name="Friday",
        system_prompt="You're a helpful assistant named Friday.",
        model=DashScopeChatModel(
            credential=DashScopeCredential(api_key=os.environ["DASHSCOPE_API_KEY"]),
            model="qwen3.6-plus",
        ),
        toolkit=Toolkit(tools=[Bash(), Grep(), Glob(), Read(), Write(), Edit()]),
    )
    await launch_console(agent)

asyncio.run(main())
```

## 典型使用方法

### 启动 Agent Service 后端和 Web UI

```bash
git clone -b main https://github.com/agentscope-ai/agentscope.git
cd agentscope/examples/agent_service
python main.py
```

另一个终端启动 Web UI：
```bash
cd agentscope/examples/web_ui
pnpm install
pnpm dev
```

## 配置与部署要点

- 需要 Python 3.11 或更高版本。
- 模型 API 密钥通过环境变量或 Credential 对象配置。
- Agent Service 支持多租户、多会话隔离，可配置 SQL/NoSQL 持久化。
- 支持通过频道（飞书、Discord）连接智能体到 IM 平台。
- 工作区/沙箱支持本地、Docker、K8s 等多种后端。

## 限制、风险与许可证

- **许可证**：Apache License 2.0。
- **限制**：仓库资料未提供。
- **风险**：仓库资料未提供。

## 官方链接

- **GitHub 仓库**：https://github.com/agentscope-ai/agentscope
- **文档**：https://docs.agentscope.io/
- **路线图**：https://github.com/orgs/agentscope-ai/projects/2/views/1
- **PyPI**：https://pypi.org/project/agentscope/
- **Discord**：https://discord.gg/eYMpfnkG8h
- **论文**：
  - AgentScope 1.0：https://arxiv.org/abs/2508.16279
  - AgentScope：https://arxiv.org/abs/2402.14034

## 信息来源和分析时间

- **信息来源**：GitHub 仓库 README、文档、贡献指南、更新日志、路线图。
- **分析时间**：2026-08-07（基于最新发布版本 v2.0.6 的日期）。