# AgentScope

> A Python framework for building production multi-agent applications

- Category: Agents & Automation / Multi-Agent Systems
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/agentscope-ai/agentscope
- Website: https://agentscope.io
- Canonical page: https://ai-tldr.dev/tools/agentscope/

## In short

AgentScope is an open-source Python framework for building agent and multi-agent applications on top of large language models. Version 2.0 focuses on production use, with abstractions designed to work alongside increasingly capable, tool-using models rather than constraining them with rigid prompts and orchestration. It sits in the Multi-Agent Systems category of the Agents & Automation tools and is open-source, written in Python and licensed Apache-2.0.

## Overview

AgentScope is an open-source Python framework for building agent and multi-agent applications on top of large language models. Version 2.0 focuses on production use, with abstractions designed to work alongside increasingly capable, tool-using models rather than constraining them with rigid prompts and orchestration.

It is aimed at Python developers who need more than a single chatbot loop: teams of agents that coordinate, call tools, and run code. The framework leans on the model's own reasoning and tool-use abilities, exposing the agent's reason-act loop through a unified event stream that you can wire into a UI or a human-in-the-loop step.

Within the multi-agent systems space, AgentScope adds the operational pieces you need to ship: a permission system for fine-grained control over tools, workspace sandboxes (local, Docker, or E2B), composable middleware, and a multi-tenancy, multi-session agent service for serving agents with isolation.

## What it does

- Event system: a unified event bus that streams the agent's reasoning and actions to a frontend and supports human-in-the-loop
- Permission system for fine-grained, configurable control over which tools and resources an agent can use
- Workspace and sandbox support to run tools and code in isolated environments, with backends for local, Docker, and E2B
- Multi-tenancy and multi-session agent service for production-grade serving with isolation across tenants and sessions
- Extensible middleware: composable hooks to customize and extend the agent's reasoning-acting loop
- Built-in toolkit with file and shell tools such as Bash, Grep, Glob, Read, Write, and Edit, plus an Agent Team feature for coordinating worker agents

## Getting started

AgentScope requires Python 3.11 or higher. Install it from PyPI, then create your first agent and stream its events.

1. Install AgentScope

   Install the package from PyPI with uv or pip.

```bash
uv pip install agentscope
# or
# pip install agentscope
```

2. Set your model credentials

   The quickstart uses DashScope, so export the API key the model client reads from the environment.

```bash
export DASHSCOPE_API_KEY=your_api_key
```

3. Create and run an agent

   Build an Agent with a model and a toolkit, then iterate over the event stream from reply_stream to handle the agent's output.

```python
from agentscope.agent import Agent
from agentscope.tool import Toolkit, Bash, Grep, Glob, Read, Write, Edit
from agentscope.credential import DashScopeCredential
from agentscope.model import DashScopeChatModel
from agentscope.message import UserMsg
from agentscope.event import EventType

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()]
        ),
    )

    async for evt in agent.reply_stream(UserMsg("Tony", "Hi, Friday!")):
        match evt.type:
            case EventType.TEXT_BLOCK_DELTA:
                ...
            # Handle other event types

asyncio.run(main())
```

## When to use it

- Build a team of agents where a leader spawns and coordinates worker agents through the built-in team tools
- Serve agents to many users with a multi-tenant, multi-session FastAPI service and a pre-built web UI
- Run agent-generated code and tool calls safely inside local, Docker, or E2B sandboxes
- Stream an agent's reasoning and tool calls into a frontend, with human-in-the-loop approval gated by the permission system
