Home

Awesome

English | 中文 | 日本語

AgentScope

<h1 align="left"> <img src="https://img.alicdn.com/imgextra/i2/O1CN01cdjhVE1wwt5Auv7bY_!!6000000006373-0-tps-1792-1024.jpg" width="600" alt="agentscope-logo"> </h1>

Start building LLM-empowered multi-agent applications in an easier way.

<h5 align="left"> <a href="https://agentscope.io" target="_blank"> <img src="https://img.alicdn.com/imgextra/i1/O1CN01RXAVVn1zUtjXVvuqS_!!6000000006718-1-tps-3116-1852.gif" width="500" alt="agentscope-workstation" style="box-shadow: 5px 10px 18px #888888;"> </a> </h5>
DiscordDingTalk
<img src="https://gw.alicdn.com/imgextra/i1/O1CN01hhD1mu1Dd3BWVUvxN_!!6000000000238-2-tps-400-400.png" width="100" height="100"><img src="https://img.alicdn.com/imgextra/i2/O1CN01tuJ5971OmAqNg9cOw_!!6000000001747-0-tps-444-460.jpg" width="100" height="100">

News

<h5 align="left"> <video src="https://github.com/user-attachments/assets/6d03caab-6193-4ac6-8b1c-36f152ec02ec" width="45%" alt="web browser control" controls></video> </h5> <h5 align="left"> <img src="https://github.com/user-attachments/assets/b14d9b2f-ce02-4f40-8c1a-950f4022c0cc" width="45%" alt="agentscope-logo"> <img src="https://github.com/user-attachments/assets/dfffbd1e-1fe7-49ee-ac11-902415b2b0d6" width="45%" alt="agentscope-logo"> </h5> <details> <summary>Full News</summary>

https://github.com/qbc2016/AgentScope/assets/22984042/22d45aee-3470-4923-850f-348a5b0faaa7

</details>

What's AgentScope?

AgentScope is an innovative multi-agent platform designed to empower developers to build multi-agent applications with large-scale models. It features three high-level capabilities:

Supported Model Libraries

AgentScope provides a list of ModelWrapper to support both local model services and third-party model APIs.

APITaskModel WrapperConfigurationSome Supported Models
OpenAI APIChatOpenAIChatWrapperguidance <br> templategpt-4o, gpt-4, gpt-3.5-turbo, ...
EmbeddingOpenAIEmbeddingWrapperguidance <br> templatetext-embedding-ada-002, ...
DALL·EOpenAIDALLEWrapperguidance <br> templatedall-e-2, dall-e-3
DashScope APIChatDashScopeChatWrapperguidance <br> templateqwen-plus, qwen-max, ...
Image SynthesisDashScopeImageSynthesisWrapperguidance <br>templatewanx-v1
Text EmbeddingDashScopeTextEmbeddingWrapperguidance <br> templatetext-embedding-v1, text-embedding-v2, ...
MultimodalDashScopeMultiModalWrapperguidance <br> templateqwen-vl-max, qwen-vl-chat-v1, qwen-audio-chat
Gemini APIChatGeminiChatWrapperguidance <br> templategemini-pro, ...
EmbeddingGeminiEmbeddingWrapperguidance <br> templatemodels/embedding-001, ...
ZhipuAI APIChatZhipuAIChatWrapperguidance <br> templateglm-4, ...
EmbeddingZhipuAIEmbeddingWrapperguidance <br> templateembedding-2, ...
ollamaChatOllamaChatWrapperguidance <br> templatellama3, llama2, Mistral, ...
EmbeddingOllamaEmbeddingWrapperguidance <br> templatellama2, Mistral, ...
GenerationOllamaGenerationWrapperguidance <br> templatellama2, Mistral, ...
LiteLLM APIChatLiteLLMChatWrapperguidance <br> templatemodels supported by litellm...
Yi APIChatYiChatWrapperguidance <br> templateyi-large, yi-medium, ...
Post Request based API-PostAPIModelWrapperguidance <br> template-

Supported Local Model Deployment

AgentScope enables developers to rapidly deploy local model services using the following libraries.

Supported Services

Example Applications

More models, services and examples are coming soon!

Installation

AgentScope requires Python 3.9 or higher.

Note: This project is currently in active development, it's recommended to install AgentScope from source.

From source

# Pull the source code from GitHub
git clone https://github.com/modelscope/agentscope.git

# Install the package in editable mode
cd agentscope
pip install -e .

Using pip

pip install agentscope

Extra Dependencies

To support different deployment scenarios, AgentScope provides several optional dependencies. Full list of optional dependencies refers to tutorial Taking distribution mode as an example, you can install its dependencies as follows:

On Windows

# From source
pip install -e .[distribute]
# From pypi
pip install agentscope[distribute]

On Mac & Linux

# From source
pip install -e .\[distribute\]
# From pypi
pip install agentscope\[distribute\]

Quick Start

Configuration

In AgentScope, the model deployment and invocation are decoupled by ModelWrapper.

To use these model wrappers, you need to prepare a model config file as follows.

model_config = {
    # The identifies of your config and used model wrapper
    "config_name": "{your_config_name}",          # The name to identify the config
    "model_type": "{model_type}",                 # The type to identify the model wrapper

    # Detailed parameters into initialize the model wrapper
    # ...
}

Taking OpenAI Chat API as an example, the model configuration is as follows:

openai_model_config = {
    "config_name": "my_openai_config",             # The name to identify the config
    "model_type": "openai_chat",                   # The type to identify the model wrapper

    # Detailed parameters into initialize the model wrapper
    "model_name": "gpt-4",                         # The used model in openai API, e.g. gpt-4, gpt-3.5-turbo, etc.
    "api_key": "xxx",                              # The API key for OpenAI API. If not set, env
                                                   # variable OPENAI_API_KEY will be used.
    "organization": "xxx",                         # The organization for OpenAI API. If not set, env
                                                   # variable OPENAI_ORGANIZATION will be used.
}

More details about how to set up local model services and prepare model configurations is in our tutorial.

Create Agents

Create built-in user and assistant agents as follows.

from agentscope.agents import DialogAgent, UserAgent
import agentscope

# Load model configs
agentscope.init(model_configs="./model_configs.json")

# Create a dialog agent and a user agent
dialog_agent = DialogAgent(name="assistant",
                           model_config_name="my_openai_config")
user_agent = UserAgent()

Construct Conversation

In AgentScope, message is the bridge among agents, which is a dict that contains two necessary fields name and content and an optional field url to local files (image, video or audio) or website.

from agentscope.message import Msg

x = Msg(name="Alice", content="Hi!")
x = Msg("Bob", "What about this picture I took?", url="/path/to/picture.jpg")

Start a conversation between two agents (e.g. dialog_agent and user_agent) with the following code:

x = None
while True:
    x = dialog_agent(x)
    x = user_agent(x)
    if x.content == "exit":  # user input "exit" to exit the conversation_basic
        break

AgentScope Studio

AgentScope provides an easy-to-use runtime user interface capable of displaying multimodal output on the front end, including text, images, audio and video.

Refer to our tutorial for more details.

<h5 align="center"> <img src="https://img.alicdn.com/imgextra/i4/O1CN015kjnkd1xdwJoNxqLZ_!!6000000006467-0-tps-3452-1984.jpg" width="600" alt="agentscope-logo"> </h5>

Tutorial

License

AgentScope is released under Apache License 2.0.

Contributing

Contributions are always welcomed!

We provide a developer version with additional pre-commit hooks to perform checks compared to the official version:

# For windows
pip install -e .[dev]
# For mac
pip install -e .\[dev\]

# Install pre-commit hooks
pre-commit install

Please refer to our Contribution Guide for more details.

Publications

If you find our work helpful for your research or application, please cite our papers.

  1. AgentScope: A Flexible yet Robust Multi-Agent Platform

    @article{agentscope,
        author  = {Dawei Gao and
                   Zitao Li and
                   Xuchen Pan and
                   Weirui Kuang and
                   Zhijian Ma and
                   Bingchen Qian and
                   Fei Wei and
                   Wenhao Zhang and
                   Yuexiang Xie and
                   Daoyuan Chen and
                   Liuyi Yao and
                   Hongyi Peng and
                   Ze Yu Zhang and
                   Lin Zhu and
                   Chen Cheng and
                   Hongzhu Shi and
                   Yaliang Li and
                   Bolin Ding and
                   Jingren Zhou}
        title   = {AgentScope: A Flexible yet Robust Multi-Agent Platform},
        journal = {CoRR},
        volume  = {abs/2402.14034},
        year    = {2024},
    }