Model Agent

English | 中文

Quick Reference


Model Agent

Model Agent is an intelligent model agent experience image for Atlas AI processors. Within the image, you can experience various automation capabilities provided by Model Agent, including model adaptation, migration, quantization, optimization, and more.


Tag Convention

Tags follow the format below:

<version>-<chip_series>-<os>-py<python_version>
Field Example Description
version 1.2 Model Agent version
chip_series a2, a3 Target Atlas chip series
os ubuntu22.04 Base operating system
python_version py3.11 Python version

Model Agent 1.2

Tag dockerfile Image Contents
1.2-a2-ubuntu22.04-py3.11 dockerfile modelagent/torch_npu 2.9, Claude Code CLI, web frontend + nginx, Streamlit backend, ttyd, AtomCode and plugins
1.2-a3-ubuntu22.04-py3.11 dockerfile modelagent/torch_npu 2.9, Claude Code CLI, web frontend + nginx, Streamlit backend, ttyd, AtomCode and plugins

Quick Start

Prerequisites (Optional)

Install Driver

The host machine must have an Atlas NPU driver installed that is compatible with the CANN version inside the container. Please refer to the CANN Compatibility Matrix for the mapping between drivers and CANN versions.


Run ModelAgent Container

After pulling or building the image, start the 1.2 Model Agent container with the command below:

docker run -d \
-p ${HOST_PORT}:${CONTAINER_PORT} \
--device=/dev/davinci0 \
--device=/dev/davinci_manager \
--device=/dev/devmm_svm \
--device=/dev/hisi_hdc \
-v /usr/local/Ascend/driver:/usr/local/Ascend/driver \
-v /usr/local/Ascend/add-ons/:/usr/local/Ascend/add-ons/ \
-v /usr/local/sbin/:/usr/local/sbin/ \
--name ${CONTAINER_NAME} \
${model_agent_tag}:latest

Example variable values

CONTAINER_NAME="model-agent-offline"
model_agent_tag="model-agent-offline"
HOST_PORT="18004"
CONTAINER_PORT="8500"

How to Build Locally

The Dockerfiles for 1.0/1.1 are self-contained; use the version directory as the build context:

docker build -t modelagent:1.1-a2-ubuntu22.04-py3.11 \
  -f docker/1.1-a2-ubuntu22.04-py3.11/Dockerfile \
  docker/1.1-a2-ubuntu22.04-py3.11/

The Dockerfile for 1.2 depends on nginx.conf, conf.d/, settings.json and start.sh in the same directory (referenced by ADD/COPY), so the build context must be that version directory.

The git clone step requires gitcode credentials: prepare a credentials file on the build machine first (one line: https://<user>:<token>@gitcode.com), then mount it via --secret at build time. The credentials are never written into the image.

docker build \
  --secret id=git_credentials,src=/path/to/git-credentials \
  --build-arg CACHEBUST=$(date +%s) \
  -t modelagent:1.2-a2-ubuntu22.04-py3.11 \
  -f docker/1.2-a2-ubuntu22.04-py3.11/Dockerfile \
  docker/1.2-a2-ubuntu22.04-py3.11/

How to Develop Further

Use a built Model Agent image as the base image and add your own software on top (adjust the tag to the version you actually use):

# Use the Model Agent image as the base image and add your own software on top
FROM modelagent:1.2-a2-ubuntu22.04-py3.11

RUN apt update -y && \
 apt install gcc ...

...

Using Model Agent 1.0/1.1

Run 1.0/1.1 Model Agent container template

docker run \
  --name modelagent_container \
  --shm-size=1g \
  --net=host \
  --device /dev/davinci4 \
  --device /dev/davinci5 \
  --device /dev/davinci_manager \
  --device /dev/devmm_svm \
  --device /dev/hisi_hdc \
  -v /usr/local/dcmi:/usr/local/dcmi \
  -v /usr/local/Ascend/driver/tools/hccn_tool:/usr/local/Ascend/driver/tools/hccn_tool \
  -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
  -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
  -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
  -v /etc/ascend_install.info:/etc/ascend_install.info \
  -v /root/.cache:/root/.cache \
  -it ${model-agent_tag}:latest bash

After entering the container, edit the Claude configuration file with the following command:

vim ~/.claude/settings.json

Press i to enter edit mode, delete the existing content, and then enter the following to replace it (using Kimi K2.6 as an example):

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/",
    "ANTHROPIC_AUTH_TOKEN": "xxx",
    "ANTHROPIC_MODEL": "kimi-k2.6",
    "ANTHROPIC_SMALL_FAST_MODEL": "kimi-k2.6",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "API_TIMEOUT_MS": "600000"
  },
  "extraKnownMarketplaces": {
    "ascend-model-agent-plugin": {
      "source": {
        "source": "git",
        "url": "https://gitcode.com/gmq123/ascend-model-agent-plugin.git"
      }
    }
  },
  "enabledPlugins": {
    "ascend-model-agent-plugin@ascend-model-agent-plugin": true
  }
}

Note: Replace the value of ANTHROPIC_AUTH_TOKEN, "xxx", with your actual token.

Type :wq to save and exit, then start Claude Code:

claude

Keep pressing Enter until you reach the conversation interface, then you can experience Model Agent Skills, for example:

  • /verify-agent Help me adapt the qwen3.5-0.8B model
  • /optimizer-agent Help me optimize the qwen3.5-0.8B model

Using Model Agent 1.2

For how to start the container, see Quick Start - Run ModelAgent Container.

Once the container is running, access it via the server's public IP and the mapped host port, for example: http://external-server-ip:host-port

Fill in the model service parameters on the frontend model configuration page:

  • Model Name *: enter a model name
  • API Address *: model service address, Anthropic protocol required, e.g. https://api-ai.gitcode.com
  • API Key *: enter an API key

Protocol: only the Anthropic protocol is supported.

After saving the configuration, enter the chat interface, select the corresponding module, and type an Agent command to experience Model Agent Skills, for example:

  • /verify Help me adapt the qwen3.5-0.8B model
  • /optimize Help me optimize the qwen3.5-0.8B model

Image Software Information

Software Version
OS Ubuntu 22.04.5
Python 3.11
Package Manager apt
Torch_npu 2.9

License

Model Agent and related software in these images are released under the BSD 3-Clause license.

  • Container images are built on top of upstream base images such as vLLM-Ascend and CANN, and pre-installed packages (Python, system libraries, Claude Code, Node.js, etc.) are subject to their respective original license terms.
  • For the third-party open source software notice, see LICENSE.