Skip to main content

Ambient agent daemon for bog-agents — run agents on schedules, file-change triggers, webhooks, and git pushes

Project description

bog-agents-daemon

v0.7.0 — Ambient agent daemon for Bog Agents. Run AI agents on schedules, file-change triggers, webhooks, and git pushes without keeping a terminal open.

PyPI License


Install

pip install bog-agents-daemon

# Or with uv
uv tool install bog-agents-daemon

Requires Python 3.11+ and a running Bog Agents installation (bog-agents>=0.7.0).


Quick Start

# 1. Start the daemon (runs on localhost:7391 by default)
bog-agents-daemon

# 2. Or manage it via the bog-agents CLI
bog-agents daemon start
bog-agents daemon status

# 3. Create a job (cron trigger, every day at 9 AM)
curl -s -X POST http://localhost:7391/jobs \
  -H "X-Daemon-Token: $(cat ~/.bog-agents/daemon/token)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "daily-standup",
    "prompt": "Summarize recent git commits and open PRs",
    "triggers": [{"type": "cron", "cron": "0 9 * * 1-5"}],
    "outputs": [{"target": "log"}]
  }'

Install as a System Service

The daemon can auto-register itself as a background service that starts on login:

# Linux (systemd)
bog-agents daemon install
systemctl --user enable --now bog-agents-daemon

# macOS (launchd)
bog-agents daemon install
# daemon starts automatically at login

Trigger Types

Trigger Config key Description
cron cron: "0 9 * * 1-5" Standard 5-field cron expression
interval interval_seconds: 3600 Every N seconds
file_change watch_dir, watch_patterns Any matched file modified
webhook webhook_path: "/hooks/deploy" POST to /webhooks/<path>
git_push git_branch_pattern: "main" Git post-receive hook fires
manual POST /jobs/{id}/run

Output Targets

Target Description
log Daemon log (default)
file Append/overwrite a local file
email Send via SMTP
slack Post to a Slack incoming webhook
github_comment Comment on a GitHub issue or PR
webhook POST JSON to any URL
stdout Print to daemon stdout

REST API

The daemon exposes a REST API on http://127.0.0.1:7391 (localhost only). All endpoints except /ready require the X-Daemon-Token header.

TOKEN=$(cat ~/.bog-agents/daemon/token)

# Health
curl -H "X-Daemon-Token: $TOKEN" http://localhost:7391/health

# Readiness probe (no auth)
curl http://localhost:7391/ready

# List jobs
curl -H "X-Daemon-Token: $TOKEN" http://localhost:7391/jobs

# Create job
curl -X POST -H "X-Daemon-Token: $TOKEN" -H "Content-Type: application/json" \
  -d '{"name":"my-job","prompt":"...","triggers":[...],"outputs":[...]}' \
  http://localhost:7391/jobs

# Trigger manually
curl -X POST -H "X-Daemon-Token: $TOKEN" http://localhost:7391/jobs/{id}/run

# View run history
curl -H "X-Daemon-Token: $TOKEN" http://localhost:7391/jobs/{id}/runs

# Enable/disable
curl -X POST -H "X-Daemon-Token: $TOKEN" http://localhost:7391/jobs/{id}/enable
curl -X POST -H "X-Daemon-Token: $TOKEN" http://localhost:7391/jobs/{id}/disable

# Delete
curl -X DELETE -H "X-Daemon-Token: $TOKEN" http://localhost:7391/jobs/{id}

Git Push Triggers

Install a git post-receive hook to fire jobs on push:

# Via bog-agents CLI (recommended)
bog-agents daemon install-git-hook --repo /path/to/repo

# Or via daemon CLI
bog-agents-daemon install-git-hook --repo /path/to/repo

The hook POSTs {"ref": "refs/heads/main", "new_sha": "...", "old_sha": "..."} to /webhooks/git-push. Jobs with type: git_push and a matching git_branch_pattern will fire.


Environment Variables

Variable Default Description
BOG_DAEMON_AGENT_TIMEOUT 1800 Max seconds per agent run
BOG_DAEMON_MAX_CONCURRENT_JOBS 5 Max parallel agent executions
BOG_DAEMON_MAX_RUNS_PER_JOB 100 Run files kept per job (older pruned)

Security

  • API binds to 127.0.0.1 (localhost only) — not reachable from the network.
  • Auth token stored at ~/.bog-agents/daemon/token (mode 0600).
  • Webhook secrets validated with HMAC-SHA256 (hmac.compare_digest — timing-safe).
  • Token comparison uses hmac.compare_digest to prevent timing attacks.
  • File output restricted to $HOME and /tmp (path traversal guard).
  • Git hook scripts use shlex.quote() to prevent shell injection.

Development

cd libs/daemon
uv sync --group test
uv run pytest tests/ -q
uv run ruff check bog_agents_daemon/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bog_agents_daemon-0.7.2.tar.gz (124.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bog_agents_daemon-0.7.2-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file bog_agents_daemon-0.7.2.tar.gz.

File metadata

  • Download URL: bog_agents_daemon-0.7.2.tar.gz
  • Upload date:
  • Size: 124.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bog_agents_daemon-0.7.2.tar.gz
Algorithm Hash digest
SHA256 b2fdd6b243c49efa1dc8edc441eee43b3d8320820b328fe5412787ef97edbeba
MD5 fcadd3ef40cb86bdba1b131585d79440
BLAKE2b-256 98ee1f9f1662ef8c4e7bfe42a66f9277f72a2fd48bee0cc81a03b1cbddec02cb

See more details on using hashes here.

File details

Details for the file bog_agents_daemon-0.7.2-py3-none-any.whl.

File metadata

  • Download URL: bog_agents_daemon-0.7.2-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bog_agents_daemon-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 75fb2f3240f5645645814384af2c006340337917dfa83342a07aad926ea035ac
MD5 ed1313e57921b9015f301bd1a7886731
BLAKE2b-256 0ed9f7c96f9a0668b00f188eba8391128df89fd990f094722a9f3121baf88610

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page