Quickstart

Get your first agent run showing in the dashboard in under two minutes.

1. Create an account

Sign up at app.agentmetrics.dev. No credit card required.

2. Get an API key

After signing in, go to Settings in the sidebar and click Generate key. Copy it — it won't be shown again.

Keep your key secret

Store your API key in an environment variable, not in source code or version control. If a key is committed to a repository, rotate it immediately from Settings.

3. Install the SDK

Shell
pip install agentmetrics

4. Configure

Call configure() once at startup before any tracking calls. Read the key from an environment variable.

Python
import os
import agentmetrics

agentmetrics.configure(api_key=os.environ["AGENTMETRICS_API_KEY"])

5. Enable token and cost tracking

Call instrument() once after configure(). It patches the OpenAI and Anthropic clients to automatically capture token counts and cost on every LLM call.

Python
agentmetrics.instrument()

6. Wrap your agent

Python
@agentmetrics.track(agent_id="my-agent")
def my_agent(task: str) -> str:
    answer = call_llm(task)  # your agent logic here
    return answer

7. Run your agent

Call your agent normally. AgentMetrics wraps it transparently.

Python
result = my_agent("summarize this document")

8. Check your dashboard

Open app.agentmetrics.dev. Your run will appear within a few seconds.


What gets tracked automatically

After the decorator or wrapper is added, every invocation captures:

  • Duration (wall-clock, from call to return)
  • Success or failure status
  • Error message if the function raises or throws
  • Cost and token usage (when instrument() is called)

Next steps