### [Harbor Agent](https://github.com/av/harbor)

> Handle: `agent`<br/>
> URL: [http://localhost:34321](http://localhost:34321)

Harbor Agent is a built-in OpenAI-compatible agentic API that wraps an LLM with a planning and task-execution loop. It accepts standard `/v1/chat/completions` requests and autonomously decomposes goals into steps, executing them in sequence.

The service runs inside a [Webtop](./2.3.29-Satellite&colon-Webtop.md) desktop environment, giving it access to a graphical session for computer-use tasks.

---

#### Starting

```bash
# Start Harbor Agent (requires an LLM backend, e.g. Ollama)
harbor up agent ollama

# Open the service API
harbor open agent
```

#### Usage

Harbor Agent exposes an OpenAI-compatible chat completions endpoint. Any client that supports OpenAI's API can point to it:

```bash
curl http://localhost:34321/v1/chat/completions \
  -H "Authorization: Bearer sk-agent" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "any",
    "messages": [{"role": "user", "content": "Your task here"}],
    "stream": false
  }'
```

See more examples in the [http catalog](https://github.com/av/harbor/blob/main/services/http-catalog/agent.http).

#### Configuration

```bash
harbor config ls | grep HARBOR_AGENT

# Port on the host where the OpenAI-compatible API is exposed
HARBOR_AGENT_HOST_PORT     34321
# API key required for requests to the agent API
HARBOR_AGENT_API_KEY       sk-agent
# Base webtop image to use
HARBOR_AGENT_IMAGE         lscr.io/linuxserver/webtop
# Webtop image tag (desktop environment variant)
HARBOR_AGENT_VERSION       ubuntu-xfce
# Workspace directory for agent data and source overrides
HARBOR_AGENT_WORKSPACE     ./services/agent
```

Additional runtime config (set via `harbor env agent <KEY> <VALUE>`):

| Variable | Default | Description |
|---|---|---|
| `HARBOR_AGENT_LLM_URL` | `http://ollama:11434/v1` | OpenAI-compatible inference API to use |
| `HARBOR_AGENT_LLM_PARAMS` | `model=minicpm-v:8b-2.6-q8_0,temperature=0` | Model and sampling params (comma-separated key=value) |
| `HARBOR_AGENT_INTERMEDIATE_OUTPUT` | `true` | Stream intermediate reasoning steps in the response |

See Harbor's [environment configuration guide](./1.-Harbor-User-Guide.md#environment-variables) for setting arbitrary environment variables.

#### Related Services

- [Webtop](./2.3.29-Satellite&colon-Webtop.md) — graphical desktop environment used by Harbor Agent
- [Open WebUI](./2.1.1-Frontend&colon-Open-WebUI.md) — can connect to the agent API as an OpenAI-compatible backend
