Skip to main content

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

Metadata

Release files for agentmetrics-server 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentmetrics-server 0.2.0
File Size Uploaded
agentmetrics_server-0.2.0.tar.gz 61.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentmetrics-server 0.2.0
File Interpreter ABI Platform
agentmetrics_server-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 149.7 kB

Release files / agentmetrics_server-0.2.0.tar.gz

Download URL agentmetrics_server-0.2.0.tar.gz
Size 61.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4810d2cfb8c88f1f4a52376f808d30aa5038db1c3fe558d6dde852ab1ed4a717
BLAKE2b-256 checksum
How to use checksums
2a6362aa14a67144d710912c6c03a2c7a35f03d167dcd2c25a26154512327f6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 20, 2026.

Transparency log

Release files / agentmetrics_server-0.2.0-py3-none-any.whl

Download URL agentmetrics_server-0.2.0-py3-none-any.whl
Size 88.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22a7d52d6d64e9a5ecd977c80534369a724709ae32c0252211d167aa9b01a9fe
BLAKE2b-256 checksum
How to use checksums
1041826aef5a844a3524ab80273b53e61fcf7a04283bfc7cf9959ebd9464e746
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page