# InfiAgent

> A long-horizon agent framework where agents are YAML configs and state lives in files, so tasks can run for days and resume after a crash

- Category: Agents & Automation / Agent Frameworks & Builders
- Language: Python
- Licence: GPL-3.0
- Repository: https://github.com/polyuiislab/infiAgent
- Canonical page: https://ai-tldr.dev/tools/infiagent/
- Updated: 2026-07-11

## In short

InfiAgent, also called MLA (Multi-Level Agent), is a Python framework for agents that run for a very long time on complex tasks. It sits in the Agent Frameworks & Builders category of the Agents & Automation tools and is open-source, written in Python and licensed GPL-3.0. To get started: clone and install.

## Overview

InfiAgent, also called MLA (Multi-Level Agent), is a Python framework for agents that run for a very long time on complex tasks. Instead of writing agent classes, you describe an agent system in YAML: a tree of agents across levels (a level-3 orchestrator, level-2 specialists, level-1 executors, level-0 tool definitions and a level -1 judge), each with its own prompt and a minimal tool set. The repository ships two ready-made systems — `Researcher`, a multi-level hierarchy that runs literature search, experiments, figures and LaTeX paper writing, and `OpenCowork`, a flatter computer-work assistant for organising folders, building slide decks, processing invoices and writing code inside a chosen workspace.

The design goal stated in the README is to give the model 'short but high-value context for the next step'. Every output — scraped pages, parsed PDFs, sub-agent results — is written to the file system rather than returned into the conversation. An agent keeps only its recent actions, while a separate thinking module periodically summarises the state of the workspace, so the framework does not depend on compressing a growing chat history. Long documents are queried through tools such as `answer_from_pdf` instead of being loaded whole, and a call graph injected into shared context keeps each agent inside its own scope.

State is persisted under a portable data root with atomic writes, so a task interrupted by a crash, network error or Ctrl+C can be resumed with `/resume`, and launching again in the same workspace gives the agent memory of earlier tasks there. Models are reached through LiteLLM with per-agent model choice and multi-provider failover configured in `llm_config.yaml`, and agents can load skills that follow the Agent Skills open standard. The runtime installs from PyPI as `infiagent`, with a CLI, a JSONL streaming mode for IDE plugins and a Python SDK; a Docker image with a web UI is also published. The project is GPL-3.0 and is described in the arXiv paper 'InfiAgent: An Infinite-Horizon Framework for General-Purpose Autonomous Agents' (2601.03204).

## What it does

- Agent systems defined entirely in YAML: a multi-level tree of orchestrators, specialists, executors, tools and a judge agent
- File-centric context: outputs go to the workspace and a periodic thinking step summarises state, instead of compressing chat history
- Crash-safe, resumable tasks with atomic state writes, plus workspace-scoped memory across sessions
- Agent Skills open-standard support: drop skill folders into the skills library and agents load them on demand
- Per-agent model selection and multi-provider failover through LiteLLM, set in llm_config.yaml
- Interactive CLI with human-in-the-loop prompts and optional per-tool confirmation, a JSONL streaming mode and a Python SDK

## Getting started

InfiAgent needs Python 3.9 or later (3.10+ for MCP support). You can run the published Docker image with its web UI instead of installing anything locally; the steps below follow the README's local install.

1. Clone and install

```bash
python -m venv venv
source venv/bin/activate
git clone https://github.com/polyuiislab/infiAgent.git
cd infiAgent
pip install -e .
```

2. Install the browser used for web tasks

```bash
playwright install chromium
```

3. Set your API key

   Models, base URLs and per-agent overrides live in llm_config.yaml; copy llm_config.example.yaml to start from the template.

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

4. Start the interactive CLI in a workspace

   The workspace path becomes the task ID, so running again in the same folder resumes its memory. Use @agent_name to switch agents and /resume to continue an interrupted task.

```bash
cd /your/workspace
mla-agent --cli
```

5. Or run a task from a script

```bash
mla-agent \
  --task_id /path/to/workspace \
  --user_input "Your task description" \
  --agent_name alpha_agent
```

6. Embed it with the Python SDK

```python
from infiagent import infiagent

agent = infiagent(
    user_data_root="/abs/path/to/my_root",
    default_agent_system="Researcher",
    default_agent_name="alpha_agent",
)

result = agent.run(
    "Write a survey paper on Transformers",
    task_id="/abs/path/to/tasks/transformer_survey",
)
print(result["status"], result["output"])
```

## When to use it

- Run a research pipeline end to end — literature search, experiments, figures and a LaTeX paper — over many hours or days
- Give an assistant a working folder to organise files, build slide decks or sort invoices, with memory of past tasks in that folder
- Build a domain-specific agent by editing YAML prompts and tool lists rather than writing agent code
- Drive a long-running agent from an IDE plugin or dashboard through the JSONL stream or the Python SDK

## Version history

- 2026-07-11 3.12.24: Backend runtime published to PyPI as `infiagent`, with crash-safe atomic state writes, a concurrency-safe experience store and multi-provider LLM failover; the desktop app and other application layers moved out of the repository.
