> For the complete documentation index, see [llms.txt](https://docs.podtorrent.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.podtorrent.com/running-a-node/run-in-production.md).

# Run it in production

The agent should restart on its own if it stops or the machine reboots.

## With systemd

```ini
# /etc/systemd/system/podtorrent-agent.service
[Unit]
Description=PodTorrent agent
After=network-online.target
Wants=network-online.target

[Service]
EnvironmentFile=/etc/podtorrent/agent.env
ExecStart=/usr/local/bin/podtorrent-agent -engine http://127.0.0.1:8000 -manifest /etc/podtorrent/manifest.json
Restart=always
DynamicUser=yes
NoNewPrivileges=yes

[Install]
WantedBy=multi-user.target
```

Put the token in `/etc/podtorrent/agent.env` (readable by root only):

```bash
PODTORRENT_NODE_TOKEN=...
```

Then:

```bash
sudo systemctl enable --now podtorrent-agent
journalctl -u podtorrent-agent -f
```

## With Docker

```bash
docker run -d --name podtorrent-agent --restart unless-stopped \
  --read-only --cap-drop ALL --security-opt no-new-privileges \
  -e PODTORRENT_NODE_TOKEN=... \
  -v /etc/podtorrent/manifest.json:/manifest.json:ro \
  ghcr.io/munerate/podtorrent-agent:v0.2.0 \
  -manifest /manifest.json -engine http://engine:8000
```

Put the agent on a Docker network where it can reach only your engine and the internet. It needs no GPU, no volumes besides the manifest, and no host networking.

## What it does once running

1. Checks your engine lists every model in the manifest. It waits up to a minute for the engine to come up.
2. Connects, sends the manifest, and gets a welcome from the network.
3. Reports free slots per model whenever they change, and every 30 seconds.
4. Passes each request to your engine and streams the answer back. It refuses requests for models it doesn't serve, or when that model is full.

## Upgrading

Stop the agent, replace the binary or image tag, start it again. Requests in flight on the old process are lost, so upgrade at a quiet time. Releases are listed on [GitHub](https://github.com/Munerate/podtorrent-agent/releases). Use v0.2.0 or newer: older agents don't send [receipts](/concepts/receipts-and-billing.md), so their work isn't paid.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.podtorrent.com/running-a-node/run-in-production.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
