# 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> 
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aios.foundation/aios-docs/aios-agent/how-to-use-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
