Metadata-Version: 2.4
Name: agentmetrics
Version: 0.1.0
Summary: Real-time cost visibility & optimization for AI agents.
License: Apache-2.0
Project-URL: Homepage, https://agentmetrics.dev
Project-URL: Repository, https://github.com/agentmetrics/agentmetrics
Project-URL: Documentation, https://agentmetrics.dev/docs
Keywords: ai,agents,observability,cost,langchain,crewai,langgraph
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28

# AgentMetrics SDK

Real-time cost tracking for AI agents. One decorator. Full visibility.

## Install

```bash
pip install agentmetrics
```

## Quick Start

```python
from agentmetrics import sentinel

# Configure once at startup
sentinel.configure(api_key="am_your_key_here")

# Decorate any agent function
@sentinel.track(agent_id="customer_support")
def my_agent(task: str) -> str:
    # Your agent logic here
    return result
```

## Async Support

```python
@sentinel.track(agent_id="async_agent")
async def my_async_agent(task: str) -> str:
    result = await some_llm_call(task)
    return result
```

## With LangGraph

```python
from agentmetrics import sentinel
sentinel.configure(api_key="am_your_key_here")

@sentinel.track(agent_id="langgraph_agent")
def run_graph(state: dict) -> dict:
    return graph.invoke(state)
```

## With CrewAI

```python
from agentmetrics import sentinel
sentinel.configure(api_key="am_your_key_here")

@sentinel.track(agent_id="research_crew")
def run_crew(topic: str) -> str:
    return crew.kickoff(inputs={"topic": topic})
```

## Self-Hosted

Point the SDK at your own server:

```python
sentinel.configure(
    api_key="am_your_key_here",
    base_url="https://your-server.com/v1",
)
```

## Graceful Degradation

If the AgentMetrics server is unreachable, your agent keeps running normally.
The SDK never raises exceptions or blocks execution.

## License

Apache 2.0
