> For the complete documentation index, see [llms.txt](https://docs.aios.foundation/aios-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aios.foundation/aios-docs/aios-agent/how-to-use-agent.md).

# How to Use Agent

To pipeline of how to use agents in AIOS is shown as the following figure. &#x20;

<figure><img src="/files/qMA8q7AOPTDF1Cn6tgrK" alt="" width="563"><figcaption><p>AIOS Agent Integration Flow</p></figcaption></figure>

AIOS first checks cache for the agent (typically the source code of the agent will be stored in \~/.cache/cerebrum/) and then installs the agent if it is not available.&#x20;

#### Running Agents

**Run a Remote Agent**

Use this command to run an agent from the AIOS Agent Hub:

```bash
run-agent \
  --mode remote \
  --agent_author example \
  --agent_name test_agent \
  --agent_version 0.0.3 \
  --task "What is the capital of United States?" \
  --agenthub_url https://app.aios.foundation
```

**Run a Local Agent**

For agents already available on your local device:

```bash
run-agent \
  --mode local \
  --agent_path cerebrum/example/agents/test_agent \
  --task "What is the capital of United States?"
```

#### Agent Management

View agents available in the AIOS Agent Hub:

```bash
list-agenthub-agents
```

View agents available locally:

```bash
list-local-agents
```

Download an agent from the AIOS Agent Hub:

```bash
download-agent \
  --agent_author <agent_author> \
  --agent_name <agent_name> \
  --agent_version <agent_version> \
  --agenthub_url <agenthub_url>
```

Upload an agent to the AIOS Agent Hub:

```bash
upload-agents \
  --agent_path <agent_path> \
  --agenthub_url <agenthub_url> 
```
