agent-hub-plugin

2 downloads 0 likes on ModelScope updated

Model card

agent-hub plugin

An agent on ModelScope AgentHub is a repository of files. MS-Agent and QwenPaw each keep their agents in a different home directory, with a different layout and their own registration steps. This plugin is the bridge between the two: give it an agent repository and it downloads the files, places them in the framework's home, and completes the framework's registration so the agent shows up in its UI and CLI.

Framework layouts and registration rules evolve on their own schedule, so they live in this plugin rather than in modelscope-hub: the hub stays free of any framework knowledge and the plugin can be updated without a hub release. modelscope-hub loads and runs the plugin for you — there is nothing to install by hand, and installing a QwenPaw agent never requires ms-agent, nor an MS-Agent agent QwenPaw: the plugin imports neither framework.

What you need

  • Python 3.10 or newer
  • modelscope-hub, which provides the modelscope agent install command
  • the framework you want to run the agent in (MS-Agent or QwenPaw), with its command on your PATH

Use it from the command line

modelscope agent install -r <owner>/<agent_name>

That is the whole command. It downloads the agent, installs it into the detected framework's home, and reports what happened (Installed …) together with the frameworks and operations that plugin build supports. Options you may want:

Option What it does
--framework ms-agent / --framework qwenpaw install into this framework instead of the one the repository declares
-n <name> install one sub-agent out of a repository that holds several
--local-dir DIR keep the download in DIR instead of a temporary staging directory
--dry-run report what would happen and change nothing

Which framework an agent is installed into comes from the repository's own declaration; --framework overrides it. The two examples below therefore use the same command and differ only in the framework you run the agent in.

Example: fetch an agent and run it in MS-Agent

modelscope agent install -r <owner>/<agent_name>
ms-agent tui          # terminal UI; or `ms-agent ui` for the web UI

Example: fetch an agent and run it in QwenPaw

modelscope agent install -r <owner>/<agent_name>
qwenpaw tui --agent <agent_name>   # or `qwenpaw app`, then pick it in the Agent menu

Use it from Python

from modelscope_hub.agent import install_agent

outcome = install_agent("<owner>/<agent_name>", framework="ms-agent")
print(outcome.ok, outcome.operation, outcome.error)

If you only want the files — to inspect them, or to place them yourself — use the plugin's transfer API, which never touches a framework home:

from agent_hub_core import fetch_raw

result = fetch_raw("<owner>/<agent_name>", dest="./my_agent")
print(result.ok, len(result.files_written))

The same operations exist as a CLI:

python -m agent_hub_core fetch -r <owner>/<agent_name> -d ./my_agent
python -m agent_hub_core list-backups
python -m agent_hub_core restore last

Capabilities

Capability Status
install — download an agent and register it in MS-Agent or QwenPaw available
fetch (Python: fetch_raw) — download an agent repository into a directory you name available
restore / list-backups — roll an agent back from a backup archive available
upload — publish a local agent to AgentHub planned
convert — convert an agent between frameworks planned

Every run prints a scope : line naming the operations that build implements and the ones it does not yet, so this table can never disagree with what you actually have.

Where your files go, and what is protected

  • MS-Agent agents are installed under ~/.ms_agent, QwenPaw agents under ~/.qwenpaw.
  • Before an existing agent is overwritten, the current one is zipped into a backup pool in your ModelScope cache; restore last rolls it back.
  • A plain fetch writes only the directory you named. Only install touches a framework home, and it takes that backup first.
  • Secrets are stripped in both directions: API keys, tokens and channel credentials are removed from every downloaded agent configuration, so a remote agent never lands on your disk carrying someone else's keys — and from every upload, so yours never reach a remote repository.

Security

The plugin is official code. modelscope-hub loads it only from a compile-time allow-list of organisations, verifies the package against its own manifest before importing it, and logs which build is about to run. Plugin sources outside the allow-list are refused before anything is downloaded.

License

Apache-2.0