|
Download README.md from zkwr1081/Agent-Observability-Lab: direct link, hf CLI and curl.
- Browser
- Download file 3.48 kB
-
https://huggingface.co/spaces/zkwr1081/Agent-Observability-Lab/resolve/main/README.md
- Command line
-
hf download hf://spaces/zkwr1081/Agent-Observability-Lab/README.md
-
curl -L -o README.md https://huggingface.co/spaces/zkwr1081/Agent-Observability-Lab/resolve/main/README.md
3.48 kB
| title: Agent Observability Lab | |
| emoji: π | |
| colorFrom: purple | |
| colorTo: pink | |
| sdk: static | |
| app_file: index.html | |
| pinned: false | |
| # Agent Observability Lab | |
| A bilingual-ready, self-hosted starter for recording and inspecting real AI-agent operational telemetry: success/error/timeout counts, latency, token totals, estimated cost, and recent traces. | |
| **Live dashboard:** https://huggingface.co/spaces/zkwr1081/Agent-Observability-Lab | |
| ## Architecture and deployment status | |
| This public Space is a static dashboard. The API is a separate FastAPI service in `backend/app.py`; it is designed to run on a machine you control. The dashboard connects to that API using an HTTPS endpoint and an API key entered by the operator. The API key remains in tab memory and is not stored in browser localStorage. Only the API endpoint is remembered. | |
| The companion API source and Python sender are in `backend/`. This Space does not host the API process. Data is stored in SQLite on the API host, so persistence depends on that host and its backup policy. | |
| ## Run the API on Termux / Linux | |
| ```bash | |
| cd backend | |
| python -m pip install -r requirements.txt | |
| # Set AGENT_OBS_API_KEY to a long random secret before starting. | |
| export AGENT_OBS_API_KEY='REPLACE_WITH_A_PRIVATE_RANDOM_SECRET' | |
| export AGENT_OBS_DB="$HOME/agent-observability/traces.sqlite3" | |
| uvicorn app:app --host 127.0.0.1 --port 8788 | |
| ``` | |
| The local health check is `http://127.0.0.1:8788/health`. Keep the API bound to localhost when using a secure tunnel. Never expose the API without its key. Configure an HTTPS tunnel or reverse proxy before connecting from the public Space. | |
| ## Send telemetry from Python | |
| Install the sender from `backend/agent_observability.py`, then configure `AGENT_OBS_URL` and `AGENT_OBS_API_KEY` as environment variables. The sender records operational metadata only. It does not collect prompts, completions, or personal data. | |
| ```python | |
| from agent_observability import AgentObservability | |
| import os | |
| obs = AgentObservability(os.environ['AGENT_OBS_URL'], os.environ['AGENT_OBS_API_KEY']) | |
| obs.record(agent_name='support-agent', status='success', duration_ms=842, input_tokens=320, output_tokens=95, estimated_cost_usd=0.0012) | |
| ``` | |
| ## API | |
| - `GET /health` β public liveness check. | |
| - `POST /api/v1/traces` β ingest one trace; requires `X-API-Key`. | |
| - `GET /api/v1/traces?limit=100` β list traces; requires `X-API-Key`. | |
| - `GET /api/v1/summary` β aggregate metrics; requires `X-API-Key`. | |
| - `GET /api/docs` β OpenAPI documentation. | |
| ## Security and limitations | |
| - API key comparison uses constant-time comparison. API key is not embedded in the public frontend. | |
| - API validates payload types and bounds; SQL uses parameterized statements. | |
| - Do not send secrets, raw prompts, completions, customer identifiers, or sensitive personal data. | |
| - This starter does not yet provide multi-tenant isolation, user accounts, billing, alerting, distributed tracing, or certified benchmark scores. | |
| - Cost is supplied by the caller and is an estimate, not independently calculated billing data. | |
| - A production commercial SaaS needs a managed database, tenancy controls, retention policies, monitoring, backups, and security review. | |
| ## Product stage | |
| **Published:** static dashboard, API source, Python telemetry sender, protected ingestion and query endpoints, SQLite persistence on the API host. | |
| **Not claimed:** hosted multi-tenant SaaS, paying customers, production SLA, benchmark certification, or verified revenue. | |