# How to Use Agent

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

<figure><img src="https://4233234616-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5h7XvlMFgKMtRboLGG1i%2Fuploads%2F2hHoCzJXlga7yWcVsXfw%2F1561731617657_.pic.jpg?alt=media&#x26;token=4cc7a302-6f9d-4f01-8b1b-fc218e5951a6" 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> 
```
