Observed since 20 Oct, 22:03 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
AgentGear: LLM observability, prompt management, and agentic tracing platform with SDK, FastAPI backend, and dashboard.
AgentGear is the all-in-one open-source platform for LLM Observability, Prompt Engineering, and Agent Tracing. It helps you debug, evaluate, and optimize your AI agents with a beautiful, locally hosted dashboard.
Get started in 30 seconds. No complex setup required.
pip install agentgear-ai
agentgear ui
The dashboard will open at http://localhost:8000.
For full documentation on how to instrument your code, visit the Documentation page within the dashboard.
from agentgear import instrument, start_trace
# 1. Initialize
instrument(
project_id="my-project",
api_key="...", # Not needed for local dev
)
# 2. Decorate your functions
@trace_span(name="generate_story")
def generate_story(topic):
# Your LLM call here...
return "Once upon a time..."
AgentGear works out of the box, but you can configure it via environment variables:
AGENTGEAR_DATABASE_URL: Custom database path (default: sqlite:///~/.agentgear/agentgear.db)OPENAI_API_KEY: Required for Playground and Evaluations.pip install agentgear-ai
Package name is
agentgear-ai, import path remainsimport agentgear.
agentgear init-db
Default SQLite file lives at
~/.agentgear/agentgear.db. SetAGENTGEAR_DATABASE_URLto override (absolute path recommended).
agentgear ui # FastAPI + packaged React dashboard on :8000
# open http://localhost:8000
# first visit prompts you to set an admin username/password
agentgear create-project --name "My Project"
agentgear create-token --project <project_id>
Copy the token (shown once). Use it in SDK calls via X-AgentGear-Key.
export AGENTGEAR_ADMIN_USERNAME=adminexport AGENTGEAR_ADMIN_PASSWORD=change-meagentgear uifrom agentgear import AgentGearClient
# Remote mode (FastAPI running elsewhere)
client = AgentGearClient(
base_url="https://your-api.example.com",
api_key="ag_live_...",
project_id="proj_123",
local=False,
)
# Local mode (writes directly to SQLite, no API key needed)
local_client = AgentGearClient(
project_id="proj_123",
local=True,
)
from agentgear import observe
@observe(client, name="chat-complete", prompt_version_id="pv_abc")
def complete(prompt: str) -> str:
# call your LLM here
return "response"
complete("hi")
Captures args, output, latency, prompt version, and errors; logs a run.
from agentgear import trace
run = client.log_run(name="pipeline", input_text="user input")
with trace(client, run_id=run["id"], name="retrieve") as span:
# retrieval work
pass
with trace(client, run_id=run["id"], name="generate", parent_id=span.span_id):
# generation work
pass
from agentgear import Prompt
prompt = Prompt(name="greeting", template="Hello {{ name }}!", version_id="pv_1")
rendered = prompt.render(name="AgentGear")
# register / version prompt
client.register_prompt(name=prompt.name, content=prompt.template, description="Greeting")
client.create_prompt_version(prompt_id="<prompt_id>", content="Hi {{ name }}!")
from openai import OpenAI
from agentgear.sdk.integrations.openai import instrument_openai_chat
raw_client = OpenAI(api_key="sk-...")
client = AgentGearClient(base_url="http://localhost:8000", api_key="ag_live_...", project_id="proj_123")
instrumented = instrument_openai_chat(raw_client, agentgear=client, model="gpt-4o", prompt_version_id="pv_123")
resp = instrumented.chat.completions.create(model="gpt-4o", messages=[{"role":"user","content":"Hello"}])
from agentgear import AgentGearClient, trace
client = AgentGearClient(
base_url="http://localhost:8000",
api_key="ag_live_...", # from CLI token creation
project_id="proj_123",
)
# Register a prompt (keeps version history)
prompt = client.register_prompt(name="retrieval-chat", content="Answer using {context}")
pv = client.create_prompt_version(prompt_id=prompt["id"], content="Answer using {context}. Be concise.")
# Log a run and nested spans
run = client.log_run(
name="qa-flow",
input_text="What is AgentGear?",
prompt_version_id=pv["id"],
token_usage={"prompt": 150, "completion": 120},
)
with trace(client, run_id=run["id"], name="retrieve") as span:
# do retrieval...
pass
with trace(client, run_id=run["id"], name="generate", parent_id=span.span_id) as _:
# call model...
pass
X-AgentGear-Key: <token>runs.write, prompts.read, prompts.write, tokens.manageAGENTGEAR_ADMIN_USERNAME and AGENTGEAR_ADMIN_PASSWORD, restart, sign in, then clear the env vars if you want to go back to the stored admin user.AGENTGEAR_LOCAL_MODE=true) bypasses auth for dev; keep it false in any shared or remote environment.POST /api/projects, GET /api/projects, GET /api/projects/{id}POST /api/projects/{id}/tokens, GET /api/projects/{id}/tokens, DELETE /api/projects/{id}/tokens/{token_id}POST /api/prompts, GET /api/prompts, GET /api/prompts/{id}, POST /api/prompts/{id}/versions, GET /api/prompts/{id}/versionsPOST /api/runs, GET /api/runs, GET /api/runs/{id}POST /api/spans, GET /api/spans?run_id=GET /api/metrics/summary, GET /api/health| Var | Default | Description |
|---|---|---|
AGENTGEAR_DATABASE_URL | sqlite:///~/.agentgear/agentgear.db | DB connection (absolute path recommended; Postgres e.g. postgresql+psycopg://user:pass@host/db) |
AGENTGEAR_API_HOST | 0.0.0.0 | Bind host |
AGENTGEAR_API_PORT | 8000 | Bind port |
AGENTGEAR_SECRET_KEY | agentgear-dev-secret | Signing/crypto secret |
AGENTGEAR_ALLOW_ORIGINS | * | CORS allowlist |
AGENTGEAR_LOCAL_MODE | false | If true, bypasses auth (dev only) |
AGENTGEAR_ADMIN_USERNAME | None | Optional: override admin login username (e.g. for reset) |
AGENTGEAR_ADMIN_PASSWORD | None | Optional: override admin login password (e.g. for reset) |
/ when you run agentgear ui./projects: list + create projects/projects/:id: overview (stats, prompts, runs, tokens)/projects/:id/tokens: create/revoke tokens (shows raw token once)/runs: list runs with latency/cost/runs/:id: run detail + spans/prompts: prompt registry/prompts/:id: versions + add versioncd frontend
npm install
npm run dev
# set API target if not localhost:
# export VITE_AGENTGEAR_API=http://localhost:8000
Production installs get the built dashboard bundled inside the Python package and served from
/when you runagentgear ui.
/.agentgear --help
agentgear init-db
agentgear create-project --name "Demo"
agentgear create-token --project <project_id> --scopes runs.write prompts.read prompts.write tokens.manage
agentgear list-projects
agentgear demo-data
agentgear ui --host 0.0.0.0 --port 8000 --reload
export AGENTGEAR_DATABASE_URL="postgresql+psycopg://user:pass@host:5432/agentgear"
export AGENTGEAR_LOCAL_MODE=false
agentgear init-db
agentgear ui --host 0.0.0.0 --port 8000 --reload=false
AGENTGEAR_SECRET_KEY secret.projects: id, name, description, created_atapi_keys: id, project_id, key_hash, scopes (JSON), revoked, last_used_atprompts: id, project_id, name, descriptionprompt_versions: id, prompt_id, version, content, metadataruns: id, project_id, prompt_version_id, input/output, tokens, cost, latency, error, metadataspans: id, project_id, run_id, parent_id, name, timing, metadataruff check .pytestnpm run lint --prefix frontendnpm run test --prefix frontendpip install build twine
python -m build
twine upload dist/*
See CONTRIBUTING.md for setup, standards, and review process. PRs welcome!
Apache 2.0. See LICENSE.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.19 | 5 Dec 2025 | 19 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:03 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:1930ab3416ea0aa2e8bf4251af7504f53f6b47d827e123c7a1b1c36344422b03