# Web demo

Try examples and configure a chat in harness-web.

harness-web is a local application with two halves: a library that runs every repository example, and a workspace where you build your own agent. It runs real SDK code behind a React interface.

## Start the application

Clone the repository, add your model key, and start it with Docker:

~~~bash
git clone https://github.com/datagol/agent-harness-x.git
cd agent-harness-x
cp .env.example .env        # then set ANTHROPIC_API_KEY=... in .env
docker compose up --build
~~~

Open http://localhost:8765. That is all: the image includes the frontend, the SDK with every extra, and PostgreSQL, Temporal and Redis for the durable examples. `--build` picks up the code you have checked out; without it Docker reuses the image from your last build.

You can skip the `.env` step and add keys in the app instead: open **Workspace setup** (the HX button, top right) and paste them under **API keys**. A key saved there is used straight away and kept on your machine in the app's Docker volume. The app never shows it again, and it takes precedence over `.env`. Keys in `.env` are read when the container starts and never copied into the image. Without any keys the offline examples still run; the live ones say what is missing.

## Run the examples

The library lists every script in `examples/`, grouped by the same topics as the folders. Each entry runs the file unchanged, as `python examples/<topic>/<file>.py`. While it runs you see:

- its output, streamed as it is printed;
- a card for every tool call any agent in the example makes, with the arguments, the result and its status;
- its questions and approvals, answered in the browser;
- the files it writes, ready to download.

Start with an offline example such as **Loop guard**, **Retries and fallback** or **Flight recorder**; they need no key.

**Decisions: routing and classification** and **Decisions: answer review** use fixed decisions and scripted agent responses, so they also need no key. Routing demonstrates a caller-supplied `0.8` confidence threshold; review shows a Score rubric and Noul evidence probability without changing the original agent result. Use the [command-line examples](../examples/) for live Jev calls.

## Build your agent

Open **Build your agent**, choose a provider and model, then select the settings button beside the agent's name. There you can:

- Write the system prompt. The conversation history is kept.
- Switch any tool off or back on, and see the permission each one runs under.
- Upload Markdown skills, which the agent loads only when it needs them.
- Connect a local stdio command or a remote HTTP/SSE MCP server, and choose Ask, Allow or Deny for its tools.
- Add subagents: a name, a description that tells your agent when to delegate, instructions, and the tools the specialist may use. Each one becomes a `delegate_<name>` tool that runs a fresh child agent and returns its answer.

Stop or finish an active response before changing the setup. File writes, shell commands and Ask tools wait for an explicit approval in the browser. The Local demo provider uses scripted responses and a real calculator, so it shows tool execution without a key; it is not a language model.

## Understand storage

| Data | Where it lives |
| --- | --- |
| Conversations, runs, pending approvals | The server's memory |
| Uploaded skills | `.harness-web/chats/.../skills/` |
| Generated files | The conversation's or example's working directory |
| Model keys | The repository's `.env`, or for keys pasted under **API keys**, `.harness-web/api-keys.json` (in Docker, the `harness-web-data` volume) |

A browser refresh keeps a running server's state. Restarting the container loses conversations and run history; files remain on disk.

The application is for a trusted local developer. It is not an authenticated multi-tenant service or an operating-system sandbox.
