Skip to main content

AgentMetrics - self-hosted AI agent observability server

Project description

agentmetrics-server

PyPI Python 3.11+ License: MIT

Self-hosted AgentMetrics API server. Install it once and every agent instrumented with the AgentMetrics SDK reports to your own dashboard showing cost, latency, token usage, tool calls, and failures, with no cloud account and no data leaving your infrastructure.


Install

pip install agentmetrics-server

Requires Python 3.11 or later.


Quickstart

Start the server in the foreground:

agentmetrics-server

Dashboard → http://localhost:3099
API → http://localhost:8099

Data is stored in agentmetrics.db in the current directory by default.


Always running

For continuous 24/7 observation across reboots and crashes, install as a system service instead of running in the foreground:

agentmetrics install

This registers the server with systemd on Linux, launchd on macOS, or Task Scheduler on Windows, starts it immediately, and configures it to come back automatically after any restart or crash. The database is stored in a persistent OS data directory so it is never lost across reinstalls.

agentmetrics install              # install and start with defaults
agentmetrics install --port 9000  # custom port
agentmetrics install --db postgresql://user:pass@localhost/mydb

agentmetrics start                # start a stopped service
agentmetrics stop                 # stop without uninstalling
agentmetrics restart              # restart
agentmetrics status               # show service state and HTTP health check
agentmetrics uninstall            # remove the service

Platform behaviour

Platform Mechanism Restarts on crash Starts on boot
Linux (non-root) systemd user service yes yes
Linux (root) systemd system service yes yes
macOS launchd user agent yes yes
Windows Task Scheduler (ONLOGON) no yes (at logon)

On Linux, the service unit is written to ~/.config/systemd/user/agentmetrics.service when run as a normal user, or /etc/systemd/system/agentmetrics.service when run as root. Logs are available via journalctl --user -u agentmetrics -f.

On macOS, the plist is written to ~/Library/LaunchAgents/com.agentmetrics.server.plist and logs go to ~/Library/Logs/AgentMetrics/.


Configuration

All options can be passed as flags or set via environment variables.

Flag Env var Default Description
--port PORT 8099 Port to bind
--host 0.0.0.0 Host to bind
--db DATABASE_URL sqlite:///./agentmetrics.db Database URL
--open off Open browser on startup

SQLite (default)

No setup needed. The database is created automatically in the current directory, or in the OS data directory when running as a service.

PostgreSQL

pip install "agentmetrics-server[postgres]"
agentmetrics-server --db postgresql://user:pass@localhost/agentmetrics

Or as a persistent service:

agentmetrics install --db postgresql://user:pass@localhost/agentmetrics

Foreground options

agentmetrics-server --port 9000
agentmetrics-server --host 127.0.0.1     # localhost only
agentmetrics-server --db postgresql://user:pass@localhost/mydb
agentmetrics-server --open               # open dashboard in browser on start

Health check

GET /health  →  {"status": "ok"}

License

MIT

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

agentmetrics_server-0.2.0.tar.gz (61.6 kB view details)

Uploaded Source

Built Distribution

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

agentmetrics_server-0.2.0-py3-none-any.whl (88.1 kB view details)

Uploaded Python 3

File details

Details for the file agentmetrics_server-0.2.0.tar.gz.

File metadata

  • Download URL: agentmetrics_server-0.2.0.tar.gz
  • Upload date:
  • Size: 61.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentmetrics_server-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4810d2cfb8c88f1f4a52376f808d30aa5038db1c3fe558d6dde852ab1ed4a717
MD5 24ea5d25a7cb7824617e29fee1887caa
BLAKE2b-256 2a6362aa14a67144d710912c6c03a2c7a35f03d167dcd2c25a26154512327f6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentmetrics_server-0.2.0.tar.gz:

Publisher: publish-packages.yml on andalabx/agentmetrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentmetrics_server-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentmetrics_server-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22a7d52d6d64e9a5ecd977c80534369a724709ae32c0252211d167aa9b01a9fe
MD5 26f1b525a4116b457ab723bd5f957f8f
BLAKE2b-256 1041826aef5a844a3524ab80273b53e61fcf7a04283bfc7cf9959ebd9464e746

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentmetrics_server-0.2.0-py3-none-any.whl:

Publisher: publish-packages.yml on andalabx/agentmetrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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