Skip to main content

Real-time monitoring & alerting SDK for AI agent frameworks

Project description

OpenAlerts

Real-time monitoring & alerting SDK for AI agent frameworks. Currently supports OpenManus.

Every LLM call, tool execution, agent step, and error is tracked automatically. When things go wrong, you get an alert. A real-time dashboard is included.

Install

pip install openalerts

Usage

import asyncio
import openalerts
from app.agent.manus import Manus

async def main():
    # Dashboard starts at http://localhost:9464/openalerts
    await openalerts.init({})

    # Use your agents as normal — they're automatically monitored
    agent = Manus()
    await agent.run("Research quantum computing")

asyncio.run(main())

That's it. A real-time dashboard starts at http://localhost:9464/openalerts. OpenAlerts monkey-patches OpenManus internals (BaseAgent.run, ReActAgent.step, ToolCallAgent.execute_tool, LLM.ask_tool, LLM.ask) so every event flows through the monitoring engine. Cleanup happens automatically on exit. All events are persisted to ~/.openalerts/ as JSONL.

Optionally, add channels (Slack, Discord, webhooks) to get alerts delivered when things go wrong.

Standalone Dashboard

By default, the dashboard runs in-process - when your agent exits, the dashboard dies too. For a persistent dashboard that survives agent restarts:

# Terminal 1 — start persistent dashboard (stays running)
openalerts serve

# Terminal 2 — run your agent (writes events, no dashboard of its own)
python my_agent.py

Disable the in-process dashboard when using standalone mode:

await openalerts.init({
    "dashboard": False,
    "channels": [...]
})
openalerts serve [--port 9464] [--state-dir ~/.openalerts] [--log-level INFO]

Also works via python -m openalerts serve.

Channels

# Slack
{"type": "slack", "webhook_url": "https://hooks.slack.com/services/..."}

# Discord
{"type": "discord", "webhook_url": "https://discord.com/api/webhooks/..."}

# Generic webhook
{"type": "webhook", "webhook_url": "https://your-server.com/alerts", "headers": {"Authorization": "Bearer ..."}}

Or via environment variables (no code changes needed):

OPENALERTS_SLACK_WEBHOOK_URL="https://hooks.slack.com/services/..."
OPENALERTS_DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."
OPENALERTS_WEBHOOK_URL="https://your-server.com/alerts"

Configuration

await openalerts.init({
    "channels": [...],
    "rules": {
        "llm-errors": {"threshold": 3},
        "high-error-rate": {"enabled": False},
        "tool-errors": {"cooldown_seconds": 1800},
    },
    "cooldown_seconds": 900,
    "max_alerts_per_hour": 5,
    "quiet": False,
    "dashboard": True,
    "dashboard_port": 9464,
    "state_dir": "~/.openalerts",
    "log_level": "INFO",
})

Alert Rules

Rule Fires When Severity
llm-errors LLM API failures in 1-min window ERROR
tool-errors Tool execution failures in 1-min window WARN
agent-stuck Agent enters stuck state WARN
token-limit Token limit exceeded ERROR
step-limit-warning Agent reaches 80% of max_steps WARN
high-error-rate >50% of last 20 tool calls failed ERROR

API

engine = await openalerts.init({...})   # async init
engine = openalerts.init_sync({...})    # sync init
await openalerts.send_test_alert()      # verify channels
engine = openalerts.get_engine()        # get engine instance
await openalerts.shutdown()             # optional — runs automatically on exit

Full documentation: github.com/steadwing/openalerts

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

openalerts-0.1.1.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

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

openalerts-0.1.1-py3-none-any.whl (39.2 kB view details)

Uploaded Python 3

File details

Details for the file openalerts-0.1.1.tar.gz.

File metadata

  • Download URL: openalerts-0.1.1.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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 openalerts-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2ed50dce12260160fe679899415fe7f478542c1a798545a3946b9844fe4153e4
MD5 6f64b3bd56e53969a441b1e0079d0501
BLAKE2b-256 d96cfb66be78ed562991383a4dec01cc0921f887e6e892782fd16a2777e2a2ac

See more details on using hashes here.

File details

Details for the file openalerts-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: openalerts-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 39.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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 openalerts-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 055e45cddcdfbb177f4d342284735ed2326d38516cb3e6633a9d0e972cb9176a
MD5 1900fc726f2cf5634645393b655e0c6e
BLAKE2b-256 9d884230f60609446f568ffae83131ce0ea946b42271c4c66177158abf2c15ab

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