Skip to main content

This is the UI backend for the dr.sai project.

Project description

OpenDrSai

An integrated framework for rapid development and deployment of agents and multi-agent systems, developed by the HepAI team at the Institute of High Energy Physics, Chinese Academy of Sciences. It enables the fast creation and deployment of backend and frontend services for customized agent and multi-agent collaboration systems.

Adaptation Logic Diagram

This framework is built upon Microsoft’s open-source project AutoGen (current version 0.5.7). While maintaining compatibility with the complete structure and ecosystem of AutoGen, it redesigns the components and development logic of agent and multi-agent systems, making it more suitable for building professional scientific agents and multi-agent systems 🤖: such as complex multi-task execution 💡, state management and human-computer interaction 🙋‍♂️🙋‍♀️, professional scientific tool management and execution 🛠️, long-duration task execution ⏰, and memory management 🧠.

It ensures strong compatibility with mainstream MCP and A2A protocols, the HepAI ecosystem, and RAGFlow as a representative RAG architecture. Furthermore, it provides integrated capabilities for both development and deployment: agent or multi-agent system code can be launched with a single command, registered as an OpenAI ChatCompletions format service or HepAI Worker service, and directly exposed as an API. Together with the bundled human-computer interaction frontend, developers can rapidly build and deploy complete end-to-end applications.

1. Features

  • Flexible switching of base models for agents via the HepAI platform, along with dynamic configuration of components such as tools and knowledge bases. Supports integration of OpenAI ChatCompletions, Ollama, and other model formats.
  • Provides pre-defined components for perception, reasoning, memory, execution, and state management in agent and multi-agent systems. These are plugin-based and extensible, supporting a wide variety of professional agent design use cases.
  • Offers a one-click launch for human-computer interaction frontends and backends, enabling immediate application deployment. Compatible backend interfaces (OpenAI ChatCompletions, OpenWebUI-Pipeline) allow the system to be served as a third-party model or agent API.

2. Quick Start

2.1 Install OpenDrSai

From source (recommended)

conda create -n drsai python=>3.11
conda activate drsai
git clone https://code.ihep.ac.cn/hepai/drsai drsai

cd your/path/to/drsai/python/packages/drsai && pip install -e . # for OpenDrSai backend and agent components
cd your/path/to/drsai/python/packages/drsai_ui && pip install -e . # for DrSai-UI human-computer interaction frontend

Install via pip

conda create -n drsai python=>3.11
conda activate drsai
pip install drsai drsai_ui -U

Configure HepAI Platform API Key

Set the environment variables for the HepAI DDF2 platform API key (based on bash):

Linux/macOS:

vi ~/.bashrc
export HEPAI_API_KEY=your_api_key
source ~/.bashrc

Windows:

setx "HEPAI_API_KEY" "your_api_key"
# Note: Windows environment variables require a restart to take effect

Agent Example Test

See examples/oai_client/assistant_R1_oai.py for a demonstration of quickly developing an agent system with OpenDrSai.

2.2 Launch Human-Computer Interaction Frontend

Configure npm environment

Install Node.js

# install nvm to install node
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
nvm install node

Install frontend dependencies

cd your/path/to/drsai/frontend
npm install -g gatsby-cli
npm install --global yarn
yarn install

# cp .env.default .env.development or .env.production # copy .env.default to .env.development or .env.production
# Development variables: frontend/.env.development
# Production variables: frontend/.env.production

# yarn build # build frontend static resources
yarn run dev # start frontend development environment

2.3 Start OpenDrSai Service via CLI

# pip install drsai_ui -U # ensure drsai_ui is installed

cp .env.example .env # copy .env.example to .env
drsai ui # start Magenti-UI backend and static frontend

drsai console --agent-config agent_config.yaml # start CLI-based agent/multi-agent service
drsai backend --agent-config agent_config.yaml # deploy agent/multi-agent as OpenAI-compatible backend service

NOTE:

  • The agent_config.yaml file defines configuration information for agents and multi-agent systems. It allows quick setup for testing, or for frontend users to customize their agents. Example:
# Define your base agent model
model_config: &client
  provider: drsai.HepAIChatCompletionClient
  config:
    model: openai/gpt-4o
    api_key: sk-****
    base_url: "https://aiapi.ihep.ac.cn/apiv2"
    max_retries: 10
# Assemble your agent
myassistant:
  type: AssistantAgent # agent type, provided by OpenDrSai or user-developed
  name: myassistant
  system_message: "You are a helpful assistant who responds to user requests based on your tools and knowledge."
  description: "An agent that provides assistance with ability to use tools."
  model_client: *client

For detailed configuration, see Configuration Documentation. On our AI platform, we provide a wide selection of base models, MCP/HEPAI Worker tools, RAG memory plugins, various agent and multi-agent frameworks, and pre-defined workflows. You can combine these in the frontend or backend to rapidly construct your own agent or multi-agent collaboration system. For detailed instructions on configuration-based construction, see: docs/agent_factory.md.

3. Documentation

Tutorials (in development, contact us for issues):

tutorials/base01-hepai.md: Model configuration and usage on the HepAI platform
tutorials/base02-worker.md: Configuration and usage of HEPAI Worker remote functions
tutorials/base03-use_claude-code.md: Using Claude-Code via the HepAI platform
tutorials/agents: Agent and multi-agent system examples
tutorials/components: Agent component development examples

Documentation (in development, contact us for issues):

docs/develop.md: Agent/multi-agent system development guide
docs/agent_factory.md: Agent/multi-agent open development and community contribution guide
docs/drsai_ui.md: Human-computer interaction frontend user guide
docs/open-webui.md: Using OpenAI-compatible frontend and OpenWebUI Pipeline plugin

4. Contribution

We welcome contributions to OpenDrSai, including code, documentation, issues, and suggestions. Contributions can take many forms, such as:

  • Code contributions: agent/multi-agent system components, system examples, frontend UI development.
  • Documentation contributions: system guides, tutorials, FAQs.
  • Issue reporting: bug reports, feature suggestions, usage problems.
  • Community activities: offline events, online meetups, knowledge sharing.

5. Contact

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drsai_ui-0.0.5.tar.gz (4.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drsai_ui-0.0.5-py3-none-any.whl (4.4 MB view details)

Uploaded Python 3

File details

Details for the file drsai_ui-0.0.5.tar.gz.

File metadata

  • Download URL: drsai_ui-0.0.5.tar.gz
  • Upload date:
  • Size: 4.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for drsai_ui-0.0.5.tar.gz
Algorithm Hash digest
SHA256 72fef80ea6dee327bcdf6f2a3e1a7ba5eef49466139378cabbb3ffd9d45fe6a3
MD5 ea7b0212b6ee5dc4aed750c36f3e6761
BLAKE2b-256 44426962ab06ddd25e7599c145a9d6d497b80f98dcf135903107bda10eb3f8bd

See more details on using hashes here.

File details

Details for the file drsai_ui-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: drsai_ui-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for drsai_ui-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2197f5b862907fc51214636ba6e7e42c0c7477ad410f85a1d5a99712492b4d88
MD5 002636a361632607cd98ff266e74a149
BLAKE2b-256 8d8001d240ab2dbaa2f136fef6415bf5edcaeaf1ef550108b407307af173ae42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page