Skip to content
Back to search

infiAgent

Build your own Cowork, AI Scientist and other SoTA Agents just by editing config files. Support anthropic skills. An infinite-horizon agent framework designed for long-running, complex tasks.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/polyuiislab/infiAgent with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/polyuiislab/infiAgent'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/polyuiislab--infiagent/badge.svg)](/listings/polyuiislab--infiagent)

HTML

<a href="/listings/polyuiislab--infiagent"><img src="/api/listings/polyuiislab--infiagent/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

Vedio of Docker Mode:

<a href="https://www.bilibili.com/video/BV142vQB2EDu/?share_source=copy_web&vd_source=8f099df5d40b73e936381e57d7fc05aa ">infiagent:全自动写作工具</a>

Option 1: Docker (Recommended - No Python Required)

**1. Install Docker** - Mac/Windows: [Docker Desktop](https://www.docker.com/products/docker-desktop) - Linux: `curl -fsSL https://get.docker.com | sh`

**2. Pull Image**

docker pull chenglinhku/mlav3:latest

**3. Choose Your Mode**

Option A: Web UI Mode (Recommended)

The current Docker image starts the SDK-based Web UI directly. Use the Agent System selector to switch between `Researcher` and `OpenCowork`. The old standalone config page on `9641` is no longer required.

cd /your/workspace
mkdir -p ~/.mla_v3

docker run -d --name mla-webui \
  -e HOST_PWD=$(pwd) \
  -e PORT=4242 \
  -v $(pwd):/workspace$(pwd) \
  -v ~/.mla_v3:/root/mla_v3 \
  -p 4242:4242 \
  chenglinhku/mlav3:latest webui

Then open browser: `http://localhost:4242`

- On a fresh volume, the bootstrap admin account is `admin` / `admin123` - You can also create a new user directly from the login page - Click the `Config` button inside Web UI to edit `llm_config.yaml`, `app_config.json`, and agent configuration files - View logs with `docker logs -f mla-webui`

If you want Docker runtime data to stay inside the project instead of `~/.mla_v3`, replace the runtime mount with:

mkdir -p .mla_v3_docker
# replace: -v ~/.mla_v3:/root/mla_v3
# with:    -v $(pwd)/.mla_v3_docker:/root/mla_v3

<p align="center"> </p>

📖 **Web UI usage & UI details**: see [web_ui/README.md](web_ui/README.md).

Option B: CLI Mode

cd /your/workspace
mkdir -p ~/.mla_v3

docker run -it --rm \
  -e HOST_PWD=$(pwd) \
  -v $(pwd):/workspace$(pwd) \
  -v ~/.mla_v3:/root/mla_v3 \
  chenglinhku/mlav3:latest cli

**Windows Users:**

Windows users can mount any working folder into `/workspace/<your_task_root>` and reuse the same `/root/mla_v3` runtime volume across runs.

# CLI Mode (PowerShell)
docker run -it --rm `
  -e HOST_PWD="/docker_web" `
  -v "${PWD}:/workspace/docker_web" `
  -v "${HOME}\.mla_v3:/root/mla_v3" `
  chenglinhku/mlav3:latest cli

# Web UI Mode (PowerShell)
docker run -d --name mla-webui `
  -e HOST_PWD="/docker_web" `
  -e PORT=4242 `
  -v "${PWD}:/workspace/docker_web" `
  -v "${HOME}\.mla_v3:/root/mla_v3" `
  -p 4242:4242 `
  chenglinhku/mlav3:latest webui

# Then open browser: http://localhost:4242
# View logs: docker logs -f mla-webui

**4. Configure API Key**

Open browser: `http://localhost:4242`

<p align="center"> </p>

Sign in, open the `Config` dialog, edit `llm_config.yaml`, fill in your API key, and save.

**🎉 Done!** Start using MLA CLI.

📖 **[Complete Docker Guide](docs/DOCKER_GUIDE.md)**

---

Option 2: Local Installation (Python Required)

**1. Install the package**

# Python 3.9+ is supported. Use Python 3.10+ if you need MCP support through the packaged dependency set.
cd install_path
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
git clone https://github.com/ChenglinPoly/infiAgent.git
cd infiAgent
pip install -e .

**2. Install Playwright**

playwright install chromium

**3. Configure API Key**

mla-agent --config-set api_key "your-api-key"

**4. Start CLI**

cd /your/workspace
mla-agent --cli

📖 **[Complete CLI Guide](docs/CLI_GUIDE.md)**

---

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 927 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <div align="center">
  2. <img src="assets/logo.png" alt="infiAgent Logo" width="200">
  3. <h1>MLA V3 - Build Domain-Specific SOTA-Level AI Agents</h1>
  4. <p>
  5. <img src="https://img.shields.io/badge/version-3.13.0-blue.svg" alt="Version">
  6. <img src="https://img.shields.io/badge/python-3.10+-green.svg" alt="Python">
  7. <img src="https://img.shields.io/badge/license-GPL-blue.svg" alt="License: GPL">
  8. </p>
  9. <p>
  10. <a href="README.md">English</a> | <a href="README_CN.md">简体中文</a>
  11. </p>
  12. </div>
  13. ---
  14. ## 🌟 Introduction
  15. **InfiAgent, also called MLA (Multi-Level Agent),** is a framework for long-running general-purpose and domain-specific agents. Define responsibilities, prompts, and tools in YAML, delegate complex work to cooperating agents, and keep execution records and artifacts in files so each step can retrieve the context it needs.
  16. ### Key Features
  17. - ✅ **Long-running execution:** Thinking, ReAct, and ReAct Lite loops combine bounded action windows, file-based handoffs, and context compression.
  18. - ✅ **Hierarchical and parallel agents:** retain Researcher's multi-level orchestration and OpenCowork's general-purpose assistant; run independent instances of the same child agent, collect results, and cancel background work.
  19. - ✅ **Resumable sessions:** atomic state writes and durable tool receipts support continuation after interruption. Calls with uncertain side effects are reported for inspection.
  20. - ✅ **Persistent memory and workspaces:** sessions keep separate execution records while sharing project files and artifacts through a workspace.
  21. - ✅ **Agent Skills and extensible tools:** compatible with the [Agent Skills standard](https://agentskills.io/), custom Python tools, and MCP.
  22. - ✅ **Developer console:** the yellow runtime interface brings together sessions, files, human interaction, five model API roles, and a usage panel.
  23. ### Update & News🔥
  24. - **3.13.0 runtime update:** parallel sub-agents, reliable session recovery, local shared workspaces, the yellow developer console, five model configuration roles, and usage reporting. See Quick Start below and the [CHANGELOG](CHANGELOG.md).
  25. - **July 2026:** runtime and Python SDK updates, multi-provider model failover, and experience-store improvements.
  26. - **March 2026:** Thinking / ReAct modes, task-history retrieval, and per-agent execution, thinking, compression, and image model settings.
  27. - **February 2026:** Agent Skills, multi-provider model support, and desktop integrations.
  28. - **January 2026:** OpenCowork and the paper [InfiAgent: An Infinite-Horizon Framework for General-Purpose Autonomous Agents](https://arxiv.org/abs/2601.03204).
  29. **OpenCowork demos: file organization and presentation creation**
  30. These original demos illustrate example tasks and outputs. Their interfaces may differ from the current version.
  31. [![Desktop Organization & File Management](https://img.youtube.com/vi/IuTVRPIIW-s/hqdefault.jpg)](https://www.youtube.com/watch?v=IuTVRPIIW-s)
  32. [![PowerPoint Creation](https://img.youtube.com/vi/uuxAvCLIX9M/hqdefault.jpg)](https://www.youtube.com/watch?v=uuxAvCLIX9M)
  33. [Original writing demo (Bilibili)](https://www.bilibili.com/video/BV142vQB2EDu/)
  34. ## 🎬 Outputs
  35. Paper artifacts from the original Researcher demos:
  36. **Demo 1:**
  37. <p align="center">
  38. <img src="assets/paper1.png" alt="Paper generation example 1" width="800">
  39. </p>
  40. **Demo 2:**
  41. <p align="center">
  42. <img src="assets/paper2.png" alt="Paper generation example 2" width="800">
  43. </p>
  44. MLA handles the entire research workflow - from literature search and experiment design to code execution, figure generation, and LaTeX paper writing. All automatically orchestrated through multi-level agents.
  45. Large demo videos and GIFs are now distributed outside git history so clones stay smaller and faster.
  46. ---
  47. ## 📚 Table of Contents
  48. - [Outputs](#-outputs)
  49. - [Quick Start](#-quick-start)
  50. - [How It Works](#-how-it-works)
  51. - [Interface Screenshots](#-interface-screenshots)
  52. - [Configuration Guide](#-configuration-guide)
  53. - [CLI Interface](#-cli-interface)
  54. - [SDK Integration](#-sdk-integration)
  55. - [Example Outputs](#-example-outputs)
  56. - [Project Extensions](#-project-extensions)
  57. ---
  58. ## 🚀 Quick Start
  59. ### Option 1: Docker developer console
  60. The image includes the Python runtime, browser, and document tools. Mount `user_root` to persist your working data:
  61. ```bash
  62. mkdir -p user_root
  63. docker run -d --name infiagent \
  64. -p 127.0.0.1:4260:4260 \
  65. -v "$PWD/user_root:/data/user_root" \
  66. chenglinhku/mlav3:3.13.0
  67. ```
  68. Open [http://localhost:4260](http://localhost:4260). Select **模型 API 配置** (Model API configuration) to enter model names, API URLs, and keys. Choose an **Agent System** and **Agent Name**, create a task, and click **Stream Send**. Open **Usage Panel** for token statistics.
  69. Execution, thinking, compression, vision, and image generation can share a connection or use separate ones. Workspaces and files persist in the mounted directory.
  70. **Windows PowerShell:**
  71. ```powershell
  72. New-Item -ItemType Directory -Force user_root
  73. docker run -d --name infiagent `
  74. -p 127.0.0.1:4260:4260 `
  75. -v "${PWD}/user_root:/data/user_root" `
  76. chenglinhku/mlav3:3.13.0
  77. ```
  78. **Docker CLI mode:**
  79. ```bash
  80. docker run -it --rm \
  81. -v "$PWD/user_root:/data/user_root" \
  82. chenglinhku/mlav3:3.13.0 cli
  83. ```
  84. See the [Docker guide](docs/DOCKER_GUIDE.md) for configuration, upgrades, and mounts.
  85. ### Option 2: Local Python installation
  86. Python 3.10 or later is required.
  87. ```bash
  88. pip install infiagent==3.13.0
  89. infiagent-runtime --user-root ./user_root
  90. ```
  91. Configure models in the browser, then use the Python SDK with the same `user_root`. Run `infiagent` for the interactive CLI, or use `pip install -e .` for source development.
  92. ---
  93. ## 🎯 How It Works
  94. MLA's design philosophy is **"Provide short but high-value context for the next step."** To achieve this, the framework implements multiple innovations:
  95. ### 1. 🌲 Hierarchical and Parallel Multi-Agent System
  96. MLA deploys agents in a **tree-structured hierarchy** (e.g., Grandparent → Parent → Child). This ensures:
  97. - ✅ **Single-purpose agents**: Each agent has a focused role
  98. - ✅ **Minimal tool sets**: Agents only access necessary tools
  99. - ✅ **Parallel coordination**: independent child instances execute delegated work; parents collect results, while shared files follow workspace concurrency rules
  100. - ✅ **Clear delegation**: Parent agents orchestrate child agents
  101. **Example Hierarchy:**
  102. ```
  103. alpha_agent (Level 3)
  104. ├── data_collection_agent (Level 2)
  105. │ └── web_search_agent (Level 1)
  106. ├── coder_agent (Level 2)
  107. └── material_to_document_agent (Level 2)
  108. ```
  109. ### 2. 🎯 Nested Attention Mechanism
  110. Long documents (PDFs, novels, papers) can be retrieved selectively through tools. Instead:
  111. - ✅ Use `answer_from_pdf`, `answer_from_document` tools
  112. - ✅ Query-driven content extraction
  113. - ✅ Only relevant excerpts or summaries enter context
  114. - ✅ **Application-layer attention allocation** through tools
  115. **Traditional Approach:**
  116. ```
  117. Load entire 50-page PDF → Agent processes everything → Token overflow
  118. ```
  119. **MLA Approach:**
  120. ```
  121. Agent asks: "What is the methodology?"
  122. → Tool extracts relevant sections (2 pages)
  123. → Returns concise answer → Minimal token usage
  124. ```
  125. ### 3. 📁 File-Centric Architecture
  126. **"Files are everything."** All outputs and interactions are saved to the file system:
  127. - ✅ Web scraping → Saves as Markdown files
  128. - ✅ PDF parsing → Extracts to structured documents
  129. - ✅ Sub-agent results → Stored as files
  130. - ✅ Large results retain full files with bounded previews in context
  131. **Benefits:**
  132. - Clear audit trail
  133. - Reusable artifacts
  134. - Context-free state representation
  135. ### 4. ⚡ Action Windows and Thinking Cadence
  136. Files retain task artifacts and execution records retain the process. Each new step can work with the current goal, relevant files, and recent actions.
  137. - **Thinking:** plan, execute, and revisit the plan at a configurable cadence.
  138. - **ReAct / ReAct Lite:** advance through tool calls with the reflection mode appropriate to the task.
  139. - `action_window_steps` and `thinking_interval` control the window and cadence; context compression is available when needed.
  140. - Historical records remain local and can be retrieved beyond the current context window.
  141. ```text
  142. Set a goal → Execute steps → Save artifacts to files
  143. → Update current state → Retrieve relevant records and continue
  144. ```
  145. ### 5. 🔧 Batch File Operations
  146. Inspired by [Claude Code](https://www.anthropic.com/), MLA uses **list-based tool parameters** to save tokens:
  147. - ✅ Read multiple files in one call
  148. - ✅ Batch operations reduce cumulative overhead
  149. - ✅ Significant token savings on repeated actions
  150. **Example:**
  151. ```python
  152. # Traditional: 3 separate calls
  153. file_read(path=["file1.txt"])
  154. file_read(path=["file2.txt"])
  155. file_read(path=["file3.txt"])
  156. # MLA: 1 batch call
  157. file_read(path=["file1.txt", "file2.txt", "file3.txt"])
  158. ```
  159. ### 6. 💾 Session Memory and Shared Workspaces
  160. `task_id` identifies a persistent session; reusing it continues its records. `workspace_id` binds multiple sessions to the same working files while retaining separate execution histories.
  161. ```python
  162. agent.create_workspace("research", title="Research project")
  163. agent.run("Collect papers and save notes", task_id="./user_root/tasks/collect", workspace_id="research")
  164. agent.run("Write a review from the notes", task_id="./user_root/tasks/write", workspace_id="research")
  165. ```
  166. Sessions in one workspace run sequentially by default. Concurrent mode is available when the tools used are compatible with concurrent file access.
  167. ### 7. 📊 Call Graph-Based Shared Context
  168. The `hierarchy_manager` maintains a **dynamic call relationship graph**:
  169. - ✅ Tracks parent-child agent relationships
  170. - ✅ Injects call graph into shared context
  171. - ✅ Prevents agents from overstepping boundaries
  172. - ✅ Maintains task alignment across multi-agent system
  173. **Call Graph Example:**
  174. ```json
  175. {
  176. "current_agent": "coder_agent",
  177. "parent": "alpha_agent",
  178. "siblings": ["data_collection_agent", "material_to_document_agent"],
  179. "allowed_tools": ["python_run", "file_write", "file_read"]
  180. }
  181. ```
  182. The runtime enforces `available_tools` and records separate identities and parent-child relationships for parallel instances.
  183. ---
  184. ## 📸 Interface Screenshots
  185. ### Model Configuration and Usage
  186. The yellow developer console provides separate execution, thinking, compression, vision, and image-generation settings. This is the actual configuration dialog; saved keys are not displayed:
  187. <p align="center"><img src="assets/model-configuration.png" alt="Five model API roles" width="900"></p>
  188. The usage panel shows time buckets, cache usage, and model and task breakdowns. This screenshot comes from a real test run with two parallel child agents:
  189. <p align="center"><img src="assets/usage-panel.png" alt="Token usage from a real parallel-agent run" width="1000"></p>
  190. ### CLI Interface
  191. MLA provides a rich interactive CLI with real-time task monitoring, HIL handling, and agent switching:
  192. **System Selection:**
  193. <p align="center">
  194. <img src="assets/cli_choose_system.png" alt="CLI System Selection" width="800">
  195. </p>
  196. **Tool Mode Configuration:**
  197. <p align="center">
  198. <img src="assets/cli_choose_tool_mode.png" alt="CLI Tool Mode" width="800">
  199. </p>
  200. **Starting Tasks:**
  201. <p align="center">
  202. <img src="assets/cli_start_task.png" alt="CLI Task Execution" width="800">
  203. </p>
  204. *Interactive CLI with prompt_toolkit and rich terminal UI - featuring multi-turn conversations, automatic HIL detection, and tool execution confirmation.*
  205. ### VS Code Integration Example
  206. Build powerful IDE extensions using MLA's JSONL mode:
  207. <p align="center">
  208. <img src="assets/vscode_plugin.png" alt="VS Code Plugin Screenshot" width="800">
  209. </p>
  210. *VS Code extension powered by MLA - seamless integration with workspace context and real-time streaming output.*
  211. ---
  212. ## ⚙️ Configuration Guide
  213. Agents and tools are configured in YAML. After the first launch, the user directory contains:
  214. ```text
  215. user_root/
  216. ├── config/
  217. │ ├── llm_config.yaml
  218. │ └── app_config.json
  219. ├── agent_library/
  220. │ ├── Researcher/
  221. │ │ ├── general_prompts.yaml
  222. │ │ ├── level_0_tools.yaml
  223. │ │ ├── level_1_agents.yaml
  224. │ │ ├── level_2_agents.yaml
  225. │ │ └── level_3_agents.yaml
  226. │ └── OpenCowork/
  227. ├── tools_library/
  228. ├── skills/
  229. ├── tasks/
  230. └── workspaces/
  231. ```
  232. ### Key Configuration Files
  233. #### 1. `llm_config.yaml` — Model configuration
  234. Use the page editor to get started. The YAML structure below shows all five roles; replace model names and URLs with your actual service:
  235. ```yaml
  236. api_key: "your-api-key"
  237. base_url: "https://your-provider.example/v1"
  238. models:
  239. - "openai/your-execution-model"
  240. thinking_models:
  241. - "openai/your-thinking-model"
  242. compressor_models:
  243. - "openai/your-compression-model"
  244. read_figure_models:
  245. - "openai/your-vision-model"
  246. figure_models:
  247. - name: "openai/your-image-model"
  248. base_url: "https://your-image-provider.example/v1"
  249. api_key: "your-image-api-key"
  250. image_api: "images"
  251. multimodal: false
  252. compressor_multimodal: false
  253. ```
  254. Each role can inherit the default connection or override `api_key` / `base_url`. Vision and image generation require models that support those capabilities; image generation can use `images` or `chat`. Per-agent model overrides take precedence over role defaults.
  255. #### 2. Agent Hierarchy
  256. MLA organizes agents into levels:
  257. - **Level 3**: Top-level orchestrators (e.g., `alpha_agent`)
  258. - **Level 2**: Functional specialists (e.g., `data_collection_agent`, `coder_agent`)
  259. - **Level 1**: Basic executors (e.g., `web_search_agent`)
  260. - **Level 0**: Tool definitions
  261. - **Level -1**: Quality control (e.g., `judge_agent`)
  262. #### 3. Creating Custom Agents
  263. Define responsibilities, tools, and parameters in a system's level YAML, for example:
  264. ```yaml
  265. tools:
  266. notes_agent:
  267. type: llm_call_agent
  268. level: 1
  269. name: notes_agent
  270. description: Read project files and write notes.
  271. available_tools:
  272. - file_read
  273. - file_write
  274. - final_output
  275. prompts:
  276. agent_responsibility: Read project files and write concise notes.
  277. parameters:
  278. type: object
  279. properties:
  280. task_id:
  281. type: string
  282. task_input:
  283. type: string
  284. required: [task_id, task_input]
  285. ```
  286. Use `spawn_subagents`, `collect`, and `cancel` for parallel delegation. Children must be linked in the parent’s available tool set. See the [SDK guide](docs/SDK_GUIDE.md).
  287. ---
  288. ## 💻 CLI Interface
  289. ### Interactive Mode
  290. Start the CLI for a conversational experience:
  291. ```bash
  292. mla-agent --cli
  293. ```
  294. **Key Features:**
  295. - 🔄 **Multi-turn conversations** with persistent context
  296. - 🤖 **Agent switching** with `@agent_name` syntax
  297. - 🔔 **Automatic HIL detection** with audio alerts
  298. - ⚠️ **Tool execution confirmation** in manual mode
  299. - ⏸️ **Interrupt and resume** support (Ctrl+C to pause)
  300. - 🎨 **Rich terminal UI** powered by `prompt_toolkit` and `rich`
  301. **Usage Examples:**
  302. ```bash
  303. # Direct task input (uses default agent)
  304. [alpha_agent] > Collect papers on Transformers
  305. # Switch agent and execute task
  306. [alpha_agent] > @data_collection_agent Search for recent NLP papers
  307. # Switch default agent only
  308. [alpha_agent] > @coder_agent
  309. ✅ Switched to: coder_agent
  310. [coder_agent] >
  311. ```
  312. **CLI Commands:**
  313. | Command | Description |
  314. |---------|-------------|
  315. | `/help` | Show help and available commands |
  316. | `/agents` | List all available agents |
  317. | `/resume` | Resume interrupted tasks |
  318. | `/quit` or `/exit` | Exit CLI mode |
  319. | `Ctrl+C` | Interrupt current task (stays in CLI) |
  320. | `Ctrl+D` | Exit CLI immediately |
  321. **Human-in-Loop (HIL) Handling:**
  322. When an agent requests human input, the CLI automatically detects it:
  323. ```
  324. 🔔🔔🔔 Detected HIL task! Press Enter to handle... 🔔🔔🔔
  325. ================================================================================
  326. 🔔 Human Interaction Task (HIL)
  327. ================================================================================
  328. 📝 Task ID: upload_file_20250124
  329. 📋 Instruction: Please upload the required dataset files...
  330. ================================================================================
  331. 💡 Enter your response (any text)
  332. Type /skip to skip this task
  333. ================================================================================
  334. [alpha_agent] HIL Response > Files uploaded successfully
  335. ✅ HIL task responded
  336. ```
  337. **Tool Confirmation (Manual Mode):**
  338. When `--auto-mode false` is set, each tool execution requires confirmation:
  339. ```
  340. ⚠️⚠️⚠️ Detected tool execution request! Press Enter to confirm... ⚠️⚠️⚠️
  341. ================================================================================
  342. ⚠️ Tool Execution Confirmation Request
  343. ================================================================================
  344. 🔧 Tool Name: python_run
  345. 📝 Confirmation ID: confirm_12345
  346. 📋 Parameters:
  347. code: import numpy as np...
  348. timeout: 300
  349. ================================================================================
  350. 💡 Choose action:
  351. yes / y - Approve execution
  352. no / n - Reject execution
  353. ================================================================================
  354. [alpha_agent] Confirm [yes/no] > yes
  355. ✅ Approved tool execution: python_run
  356. ```
  357. **Screenshot:** *(User will provide)*
  358. ---
  359. ### Command-Line Mode
  360. For scripting and automation:
  361. ```bash
  362. mla-agent \
  363. --task_id /path/to/workspace \
  364. --user_input "Your task description" \
  365. --agent_name alpha_agent
  366. ```
  367. **Common Parameters:**
  368. | Parameter | Description | Default |
  369. |-----------|-------------|---------|
  370. | `--task_id` | Workspace path (absolute) | Required |
  371. | `--user_input` | Task description | Required |
  372. | `--agent_name` | Agent to invoke | `alpha_agent` |
  373. | `--agent_system` | Agent library name | `Researcher` |
  374. | `--cli` | Interactive CLI mode | `false` |
  375. | `--jsonl` | JSONL output mode | `false` |
  376. | `--force-new` | Clear all state and start fresh | `false` |
  377. | `--auto-mode` | Tool execution mode (`true`/`false`) | Auto-detect |
  378. **Auto-Mode Examples:**
  379. ```bash
  380. # Automatic tool execution (no confirmation needed)
  381. mla-agent --task_id ~/project --user_input "Task" --auto-mode true
  382. # Manual confirmation for each tool
  383. mla-agent --task_id ~/project --user_input "Task" --auto-mode false
  384. ```
  385. ---
  386. ### Runtime Tool Execution
  387. ```bash
  388. # Tools are executed in-process through direct-tools.
  389. # No standalone mla-tool-server process is required.
  390. ```
  391. ---
  392. ## 🔌 SDK Integration
  393. MLA provides two SDK options: **Python SDK** for direct integration and **JSONL mode** for IDE plugins.
  394. ---
  395. ### Python SDK
  396. Use the bundled `infiagent` SDK. The current SDK model is:
  397. - instantiate `infiagent(...)` once to describe runtime defaults
  398. - pass a concrete `task_id` to `run(...)` and other task APIs
  399. - optionally point the whole runtime at a dedicated `user_data_root`
  400. Minimal example:
  401. ```python
  402. from infiagent import infiagent
  403. agent = infiagent(
  404. user_data_root="/abs/path/to/my_root",
  405. default_agent_system="Researcher",
  406. default_agent_name="alpha_agent",
  407. action_window_steps=30,
  408. thinking_interval=30,
  409. max_turns=100000,
  410. fresh_enabled=True,
  411. fresh_interval_sec=300,
  412. )
  413. result = agent.run(
  414. "Write a survey paper on Transformers",
  415. task_id="/abs/path/to/tasks/transformer_survey",
  416. )
  417. print(f"Status: {result['status']}")
  418. print(f"Output: {result['output']}")
  419. ```
  420. If your `user_data_root` already contains:
  421. - `config/llm_config.yaml`
  422. - `config/app_config.json`
  423. - `agent_library/...`
  424. - `tools_library/...`
  425. you usually do not need to pass `llm_config_path`, `agent_library_dir`, or `tools_dir` again.
  426. Common task APIs:
  427. ```python
  428. # Ask a running or stopped task to refresh runtime config.
  429. agent.fresh(
  430. task_id="/abs/path/to/tasks/transformer_survey",
  431. reason="reload runtime config",
  432. )
  433. # Append a new instruction to the same task.
  434. agent.add_message(
  435. "Keep the existing outline and only revise section 3.",
  436. task_id="/abs/path/to/tasks/transformer_survey",
  437. source="user",
  438. resume_if_needed=True,
  439. )
  440. # Launch a separate background task in another Python process.
  441. agent.start_background_task(
  442. task_id="/abs/path/to/tasks/subtask_eval",
  443. user_input="Run the evaluation pipeline and summarize results",
  444. force_new=True,
  445. )
  446. # Inspect task state for dashboards or lightweight watchdogs.
  447. snapshot = agent.task_snapshot(
  448. task_id="/abs/path/to/tasks/transformer_survey",
  449. )
  450. # Reset a broken task loop while optionally preserving history.
  451. agent.reset_task(
  452. task_id="/abs/path/to/tasks/transformer_survey",
  453. reason="clear broken loop",
  454. preserve_history=True,
  455. )
  456. ```
  457. Runtime introspection:
  458. ```python
  459. runtime = agent.describe_runtime()
  460. print(runtime["user_data_root"])
  461. print(runtime["agent_library_dir"])
  462. print(runtime["tools_dir"])
  463. systems = agent.list_agent_systems()
  464. print(systems["systems"])
  465. ```
  466. Advanced runtime features supported by the SDK:
  467. - task-scoped background execution and resume/fresh control
  468. - `user_data_root`-scoped conversations, logs, runtime state, and config
  469. - tool hooks before/after tool execution
  470. - context hooks that can inspect or rewrite the final prompt before the LLM call
  471. - per-instance MCP server injection through `mcp_servers=[...]`
  472. See the full guide: [docs/SDK_GUIDE.md](docs/SDK_GUIDE.md)
  473. **Use Cases for Python SDK:**
  474. - 🔧 Building custom workflows
  475. - 🤖 Embedding agents in existing applications
  476. - 📊 Batch processing multiple tasks
  477. - 🧭 Building external dashboards, watchdogs, and orchestration layers
  478. - 🔬 Research experiments with programmatic control
  479. ---
  480. ### JSONL Mode for IDE Plugins
  481. MLA provides a JSONL streaming mode for real-time integration with IDEs and editors:
  482. ```bash
  483. mla-agent \
  484. --task_id $(pwd) \
  485. --user_input "Optimize code performance" \
  486. --jsonl 2>/dev/null
  487. ```
  488. **Output Format:**
  489. ```jsonl
  490. {"type":"start","call_id":"c-1760936557-474c43","project":"~/project","agent":"alpha_agent","task":"Optimize..."}
  491. {"type":"token","text":"[alpha_agent] Analyzing code..."}
  492. {"type":"progress","phase":"execution","pct":30}
  493. {"type":"token","text":"Calling tool: code_analyzer"}
  494. {"type":"result","ok":true,"summary":"Optimization complete"}
  495. {"type":"end","status":"ok","duration_ms":5432}
  496. ```
  497. **Event Types:**
  498. | Event Type | Description | Key Fields |
  499. |------------|-------------|------------|
  500. | `start` | Task begins | `call_id`, `agent`, `task` |
  501. | `token` | Streaming text output | `text` |
  502. | `progress` | Progress update | `phase`, `pct` |
  503. | `result` | Task result | `ok`, `summary` |
  504. | `end` | Task completed | `status`, `duration_ms` |
  505. | `error` | Error occurred | `message` |
  506. ---
  507. ### TypeScript/JavaScript Integration
  508. ```typescript
  509. import { spawn } from 'child_process';
  510. interface AgentEvent {
  511. type: 'start' | 'token' | 'progress' | 'result' | 'end' | 'error';
  512. [key: string]: any;
  513. }
  514. function runAgent(
  515. workspacePath: string,
  516. userInput: string,
  517. onEvent: (event: AgentEvent) => void
  518. ): Promise<AgentEvent> {
  519. return new Promise((resolve, reject) => {
  520. const child = spawn('mla-agent', [
  521. '--task_id', workspacePath,
  522. '--user_input', userInput,
  523. '--jsonl'
  524. ]);
  525. let buffer = '';
  526. child.stdout.on('data', (data) => {
  527. buffer += data.toString();
  528. const lines = buffer.split('\n');
  529. buffer = lines.pop() || '';
  530. lines.forEach(line => {
  531. if (!line.trim()) return;
  532. try {
  533. const event: AgentEvent = JSON.parse(line);
  534. onEvent(event);
  535. if (event.type === 'end') {
  536. resolve(event);
  537. } else if (event.type === 'error') {
  538. reject(new Error(event.message));
  539. }
  540. } catch (e) {
  541. console.error('Failed to parse event:', line);
  542. }
  543. });
  544. });
  545. child.stderr.on('data', (data) => {
  546. // Log errors to stderr
  547. console.error(data.toString());
  548. });
  549. child.on('error', reject);
  550. });
  551. }
  552. // Usage
  553. await runAgent('/path/to/workspace', 'Write unit tests', (event) => {
  554. switch (event.type) {
  555. case 'start':
  556. console.log(`Task started: ${event.task}`);
  557. break;
  558. case 'token':
  559. process.stdout.write(event.text);
  560. break;
  561. case 'progress':
  562. updateProgressBar(event.pct);
  563. break;
  564. case 'result':
  565. console.log(`\nResult: ${event.summary}`);
  566. break;
  567. }
  568. });
  569. ```
  570. ---
  571. ### VS Code Extension Example
  572. Build your own Cursor/VS Code extension using MLA:
  573. **Extension Features:**
  574. - 🤖 Agent commands in command palette
  575. - 💬 Inline chat with workspace context
  576. - 📝 Automatic code generation and refactoring
  577. - 🔍 Literature search within editor
  578. - 🔔 HIL task handling with UI prompts
  579. **Basic Extension Structure:**
  580. ```typescript
  581. // extension.ts
  582. import * as vscode from 'vscode';
  583. import { runAgent } from './mla-client';
  584. export function activate(context: vscode.ExtensionContext) {
  585. let disposable = vscode.commands.registerCommand(
  586. 'mla.executeTask',
  587. async () => {
  588. const workspace = vscode.workspace.workspaceFolders?.[0].uri.fsPath;
  589. const input = await vscode.window.showInputBox({
  590. prompt: 'Enter task description'
  591. });
  592. if (!workspace || !input) return;
  593. // Show progress
  594. await vscode.window.withProgress({
  595. location: vscode.ProgressLocation.Notification,
  596. title: 'MLA Agent',
  597. cancellable: true
  598. }, async (progress, token) => {
  599. await runAgent(workspace, input, (event) => {
  600. if (event.type === 'token') {
  601. vscode.window.showInformationMessage(event.text);
  602. } else if (event.type === 'progress') {
  603. progress.report({ increment: event.pct });
  604. }
  605. });
  606. });
  607. }
  608. );
  609. context.subscriptions.push(disposable);
  610. }
  611. ```
  612. **Screenshot:** *(User will provide)*
  613. ---
  614. ## 📊 Example Outputs
  615. ### Academic Paper Output
  616. MLA can generate complete research papers with the following structure:
  617. ```
  618. upload/
  619. ├── paper.tex # Main LaTeX document
  620. ├── references.bib # Bibliography
  621. ├── figures/
  622. │ ├── architecture.png
  623. │ ├── results_comparison.png
  624. │ └── ablation_study.png
  625. └── supplementary/
  626. └── detailed_results.pdf
  627. ```
  628. **Quality Metrics:**
  629. - ✅ Passes peer review at EI/IEEE conferences
  630. - ✅ Proper citation formatting
  631. - ✅ High-quality figures (300 DPI)
  632. - ✅ Coherent structure and flow
  633. ### Other Capabilities
  634. **1. Scientific Computing**
  635. - ECM protein composition simulation
  636. - Logistics company shift scheduling
  637. - Student assignment grading with feedback
  638. **2. General Tasks**
  639. - Web scraping and data extraction
  640. - Code generation and debugging
  641. - Document conversion and processing
  642. ---
  643. ## 🌱 Project Extensions
  644. **Status: Prototyping and testing.** Around InfiAgent, we are exploring a development workflow that spans agent engineering, execution validation, and platform management.
  645. ### Cosine: agent engineering
  646. Cosine brings project editing, an embedded assistant, configuration and tool changes, file management, and container-based trial runs into one workflow. The screenshot shows the assistant interface under development:
  647. ![Cosine assistant prototype](assets/cosine-assistant.png)
  648. ### Reusable end-to-end testing and repair
  649. Reuse project configurations, runtime environments, and test cases. An assistant can execute real tasks, inspect records and artifacts, locate problems, modify tools or prompts, and rerun the same cases to verify results. Test materials and repair records accumulate with the project.
  650. ### Operations console and high-availability platform
  651. Development directions include multiple execution nodes, recovery of resumable tasks after node failures, and management of nodes, configuration, versions, permissions, data sources, and usage. The screenshot shows quota management in a prototype test environment:
  652. ![Operations console quota-management prototype](assets/operations-quotas.png)
  653. See [Project extensions](docs/PLATFORM_OVERVIEW.md) for more details and development status.
  654. ---
  655. ## 📖 Documentation
  656. - Runtime tools are executed in-process via direct-tools; no standalone tool server is required.
  657. - [SDK guide](docs/SDK_GUIDE.md) — Python calls, parallel orchestration, workspaces, and human interaction
  658. - [Docker guide](docs/DOCKER_GUIDE.md) — Developer console and deployment
  659. - [Event schema](docs/EVENT_SCHEMA.md) · [Usage reporting](docs/USAGE.md)
  660. - [Configuration Examples](config/agent_library/Researcher/) - Agent YAML templates
  661. ---
  662. ## 🤝 Contributing
  663. Contributions are welcome! Please feel free to submit issues or pull requests.
  664. ---
  665. ## 📄 License
  666. see [LICENSE](LICENSE) for details.
  667. ---
  668. ## 📄 Citation
  669. If you use InfiAgent in your research, please cite our paper:
  670. ```bibtex
  671. @article{yu2026infiagent,
  672. title={InfiAgent: An Infinite-Horizon Framework for General-Purpose Autonomous Agents},
  673. author={Yu, Chenglin and Wang, Yuchen and Wang, Songmiao and Yang, Hongxia and Li, Ming},
  674. journal={arXiv preprint arXiv:2601.03204},
  675. year={2026}
  676. }
  677. ```
  678. ---
  679. ## 🙏 Acknowledgments
  680. - Built with [LiteLLM](https://github.com/BerriAI/litellm) for unified LLM access
  681. - Uses [Crawl4AI](https://github.com/unclecode/crawl4ai) for web scraping
  682. ---
  683. Thanks to contributors: @yuchenglin @wangyuchen @wangsongmiao @yuyang @lijinjia

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.