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.1.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.1-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bog_agents_daemon-0.7.1.tar.gz
  • Upload date:
  • Size: 124.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bog_agents_daemon-0.7.1.tar.gz
Algorithm Hash digest
SHA256 6f732c5421e20b87d95307615fd7bbe8019e4145c383dda5a63707778ffd3f86
MD5 878430a12a4604c4f65d126014bed236
BLAKE2b-256 dbae08236df2bef0476131f8fc1ef964430f1514acd5eb9f5d3248636409db41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bog_agents_daemon-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cee9debf0b86a821837d5052e420f02ca78f92e9aec965313eaa76fc5372b1d7
MD5 7d8ba26b72997ef5dd492ea6793a2919
BLAKE2b-256 b3befd5a8dce711e7460aaf833d8a0b1422a52d5149c0c85b4570dae8a9dd23a

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