Metadata-Version: 2.4
Name: versabot-local-agent
Version: 0.2.0
Summary: Run your own AI agent on Versabot work from your computer.
Author: Versabot
Project-URL: Homepage, https://www.versabot.co/mcp-server
Classifier: Programming Language :: Python :: 3
Classifier: Environment :: Console
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# Versabot local agent

`versabot-agent` lets an AI agent on your own computer do Versabot work: scheduled
tasks, website chat answers, reply drafts and other work you route to it in Versabot.
It only makes outgoing HTTPS requests, so you don't open a port or run a tunnel.
Your agent does the thinking, so this uses no Versabot AI credits. Paid actions
(media, phone, ads) still cost the usual amount and keep their approvals.

## Install

```sh
pipx install versabot-local-agent      # or: pip install versabot-local-agent
```

Until the package is on PyPI, install it from a Versabot checkout:

```sh
pip install ./packages/versabot-local-agent
```

## Set up

1. In Versabot, open **Connect your AI agent**, then **Use a token instead**, and
   create a token with the Read and Agent permissions.
2. Keep the token on your computer, in an environment variable:

   ```sh
   export VERSABOT_MCP_TOKEN=vbt_...
   ```

3. In Versabot, choose which work goes to your computer (for example, set a
   schedule to run locally).

## Run

Use Claude Code or Codex (signed in the way you normally use it), or your own command:

```sh
versabot-agent --agent codex            # runs each task with `codex exec`
versabot-agent --agent claude           # runs each task with `claude -p`
versabot-agent -- your-agent-command    # your own command gets the task as JSON on stdin
versabot-agent --agent codex --once     # take one task, then stop
versabot-agent --upload ./clip.mp4 --client-id CLIENT   # add a file to your media library
```

The listener keeps one request open to Versabot, so work arrives within a second or
two. If the network drops it reconnects on its own, waiting a little longer each time
(up to a minute). While it runs, Versabot shows "Your agent is online".

With `--agent codex` or `--agent claude`, the listener adds the Versabot MCP server to
that run only, passes the task and instructions on stdin, and saves the agent's final
answer as the result. Your token is passed by environment variable name, never on the
command line. Your Claude or ChatGPT login stays with that CLI; this package never reads
it. Use `--model` to pick a model and `--effort` for Codex reasoning effort.

With your own command, the task is JSON on stdin. Print the result on stdout and exit
with 0 when it worked. A nonzero exit is recorded as a failure.

If a run times out, the task is left unresolved instead of being retried, so nothing is
sent or published twice. Check what happened in Versabot before retrying.

In Versabot, open **Connect your AI agent > Your agent** to choose what goes to your
agent: chat, the daily check-in and scheduled tasks, and events such as new leads,
bookings and payments. You also choose what happens when your agent is offline: keep the
work waiting, or let Versabot handle it with your normal credits.

## Keep it running in the background

Save your token in a file only you can read, then print a service definition:

```sh
mkdir -p ~/.config/versabot && nano ~/.config/versabot/token && chmod 600 ~/.config/versabot/token
export VERSABOT_MCP_TOKEN_FILE=~/.config/versabot/token
versabot-agent --agent codex --print-service launchd    # Mac
versabot-agent --agent codex --print-service systemd    # Linux
versabot-agent --agent codex --print-service windows    # Windows
```

Each prints the file and the commands to install, stop and read logs. The service
starts at login and restarts if it stops. It keeps working while the computer is on
with the screen locked, but not while it's asleep. For work overnight, run it on a
computer or small server that stays on.

Options:

- `--url`: the Versabot MCP endpoint. Defaults to production, or `VERSABOT_MCP_URL`.
  Plain `http://` is accepted only for `localhost` and `127.0.0.1`.
- `--version`: print the version.

`python -m versabot_local_agent` works the same as `versabot-agent`.

## Publishing (Versabot staff)

```sh
cd packages/versabot-local-agent
python -m build            # writes dist/*.whl and dist/*.tar.gz
python -m twine upload dist/*
```

After it is on PyPI, set `NEXT_PUBLIC_LOCAL_AGENT_PACKAGE=published` in the frontend
so the Connect your AI agent page shows the install command.
