MS-Agent Documentation
repository·main·Indexed 26 days ago
https://github.com/modelscope/ms-agentA lightweight framework enabling agents to perform autonomous exploration, deep research, and complex tasks such as code and video generation using the Model Calling Protocol (MCP). The documentation covers the ms-agent-webui package (v1.0.0) and provides detailed integration guides for connecting MS-Agent's 30 MCP capabilities with other agent frameworks, including Hermes Agent, nanobot, and OpenClaw.
What's inside MS-Agent
- MS-Agent is a lightweight framework designed to provide agents with autonomous exploration capabilities. It features a flexible and extensible architecture that enables developers to create agents capable of complex tasks such as code generation, data analysis, and general tool calling via Model Context Protocol (MCP) support.
Overview of MS-Agent Deep Research versions
mainMS-Agent Deep Research provides an agent workflow for generating in-depth, multimodal research reports. It offers two distinct versions depending on your requirements:
Base Version
Designed for lightweight, efficient, and low-cost investigation. It uses a "search-then-execute" paradigm that completes tasks in minutes with modest token consumption. Key features include:
- Autonomous Exploration: Automatic analysis of complex questions.
- Multimodality: Extracts original chart/graph information for illustrated reports.
- Accelerated Parsing: Uses Ray for document parsing acceleration.
Extended Version
Designed for deep, comprehensive, large-scale research. It builds on the Base Version by adding:
- Intent Clarification: Proactively asks clarifying questions to refine research direction.
- Deep Search: Recursively optimizes search paths to broaden coverage, stopping based on user budget or research progress.
- Context Compression: Condenses long-context multimodal data into information-dense summaries to maintain quality across multi-round searches.
Overview of Code Genesis Multi-Agent Framework
mainCode Genesis is a production-ready, open-source multi-agent framework designed for end-to-end project generation. It utilizes a topology-aware code synthesis approach, meaning it uses dependency-driven scheduling to prevent hallucinated references and enable parallel generation. The framework follows a holistic engineering pipeline that includes requirement analysis, architecture design, implementation, and deployment.
Key technical features include:
- Topology-Aware Code Synthesis: Uses dependency-driven scheduling to ensure correct file ordering.
- LSP-Integrated Validation: Incorporates real-time Language Server Protocol (LSP) feedback during the generation process to ensure code correctness.
- Multi-Agent Workflow: Employs specialized agents for different stages of the software development lifecycle (SDLC).
Overview of Code Genesis Workflows
mainCode Genesis offers two distinct pipeline modes depending on your needs:
- Standard Workflow (Production-Grade): A 7-stage process (
User Story → Architect → File Design → File Order → Install → Coding → Refine) designed for complex, high-quality applications with explicit architectural planning and dependency-driven generation. - Simple Workflow (Rapid Prototyping): A 4-stage condensed process (
Orchestrator → Install → Coding → Refine) optimized for speed and lightweight projects or quick iterations.
- Standard Workflow (Production-Grade): A 7-stage process (
Understand FinResearch Project Components
mainThe FinResearch workflow is orchestrated via a Directed Acyclic Graph (DAG) of five specialized agents. Key configuration and logic files include:
workflow.yaml: The main entry point defining the execution process.agent.yamlfiles: Individual configurations for the Orchestrator, Searcher, Collector, Analyst, and Aggregator agents.conf.yaml: Configuration for search engines (e.g., Exa, SerpAPI) used by the Searcher agent.callbacks/: Modules for handling agent outputs (e.g.,orchestrator_callback.pysaves plans,aggregator_callback.pysaves final reports).tools/: Containsbuild_jupyter_image.shfor Docker sandbox setup andprinciple_skill.pyfor analytical frameworks.searcher.py: Triggersms-agent/projects/deep_researchfor sentiment searches.aggregator.py: Merges sentiment and quantitative analysis results.
Understand the Code Genesis Standard Workflow
mainThe standard workflow follows a 7-stage pipeline defined in
workflow.yaml:- User Story Agent: Parses requirements into structured stories.
- Architect Agent: Selects tech stack and defines architecture.
- File Design Agent: Generates physical file structure.
- File Order Agent: Constructs dependency DAG and topological sort.
- Install Agent: Bootstraps environment and resolves dependencies.
- Coding Agent: Synthesizes code with LSP validation.
- Refine Agent: Performs runtime validation, bug fixing, and automated deployment.
Understand the Long-term Memory structure for Nanobot
mainThe
MEMORY.mdfile serves as the long-term memory storage for thenanobotagent. It is designed to persist important information across different sessions. The file is structured into four main sections:- User Information: Stores important facts about the user.
- Preferences: Stores user preferences learned by the agent over time.
- Project Context: Stores information regarding ongoing projects.
- Important Notes: Stores miscellaneous things the agent should remember.
Note: This file is automatically updated by
nanobotwhen the agent identifies information that should be remembered.Key Features of MS-Agent
mainMS-Agent offers several core capabilities:
- Multi-Agent for general purpose: Chat with agents featuring tool-calling capabilities based on MCP.
- Deep Research: Enables advanced autonomous exploration and complex task execution.
- Code Generation: Supports code generation tasks with artifacts.
- Short Video Generation: Supports video generation of approximately 5 minutes.
- Agent Skills: A knowledge-driven skill system providing reusable procedural knowledge via standard tool integration. It features multi-source loading, progressive disclosure, and runtime self-evolution.
- WebUI: A modern web interface for agent interaction using real-time WebSocket communication.
- Lightweight and Extensible: Designed for easy customization and extension.
Understand the Standard Workflow stages
mainThe Standard Workflow uses seven specialized agents to ensure production-ready output:
- User Story Agent: Parses requirements and augments them with missing specifications (e.g., auth, error handling).
- Architect Agent: Selects the technology stack (frameworks, databases) and defines communication protocols (REST, GraphQL, etc.).
- File Design Agent: Creates the physical file tree and package structures based on the architecture.
- File Order Agent: Constructs a dependency-aware directed acyclic graph (DAG) and performs topological sorting to ensure files are generated in the correct order.
- Install Agent: Bootstraps the environment by generating dependency manifests and invoking package managers (e.g.,
pip,npm,mvn). - Coding Agent: Synthesizes code following the topological order and validates it using Language Server Protocol (LSP) for syntax, types, and imports.
- Refine Agent: Performs runtime verification, executes the project, applies surgical fixes to errors, and handles automated deployment.
Understand the Simple Workflow stages
mainThe Simple Workflow is a condensed pipeline for rapid prototyping:
- Orchestrator Agent: A single reasoning step that handles requirement analysis, architecture design, and file planning.
- Install Agent: Handles dependency resolution and environment setup.
- Coding Agent: Performs direct code generation with integrated file ordering.
- Refine Agent: Handles final validation and deployment.
Use LLMAgent for basic agent functionality
mainThe
LLMAgentclass is the core component in MS-Agent responsible for conversational capabilities and tool invocation. It manages the execution loop, including LLM calls, tool usage, message management, and RAG.Execution Loop Logic:
- Registers configured callbacks.
- Initializes LLM, tools, message management, and RAG.
- Reads message history cache.
- Prepares messages (RAG queries, plans, etc.).
- Enters loop: attempts to compress messages, prepares tool list, calls LLM, and executes tools based on results.
Loop Termination Conditions:
- The model provides a reply without any tool calls.
- The number of rounds reaches
max_chat_roundspecified in the configuration.
Understand Skill Progressive Disclosure
mainMS-Agent uses a three-level progressive disclosure mechanism to manage context window costs and detail levels:
- L1 (Automatic): The system prompt includes a lightweight index (Name + one-line description) for all enabled skills (~30 tokens per skill).
- L2 (On Demand): The model calls the
skill_view(skill_id)tool to load the fullSKILL.mdbody. - L3 (On Demand): The model uses
skill_viewwith afile_pathto access referenced scripts, templates, or documentation files.