Catalog PyPI
PACKAGE EXPLORERView in registry

agent-governance-telemetry

PyPI

Framework-agnostic agent governance and telemetry library

agentsaigovernancemonitoringopentelemetrytelemetry
Versions collected1
Direct dependencies7From release 0.1.0
Last observed20 Oct, 22:04 UTC

README

Version 0.1.0 documentation

Agent Governance Library

Framework-agnostic Python library for monitoring and governing AI agents with automatic telemetry, cost tracking, and OpenTelemetry integration.

Features

  • Framework Agnostic: Works with any Python agent framework (ADK, Strands, LangGraph, custom)
  • Automatic Tracking: Token counting, cost calculation, duration measurement
  • OpenTelemetry: Built-in traces, metrics, and logs
  • Zero Impact: Non-blocking telemetry, graceful error handling
  • Simple Integration: Single decorator to add governance

Installation

pip install agent-governance

Quick Start

1. Set Platform URL

export AGENT_GOVERNANCE_PLATFORM_URL=https://your-platform-url
export AGENT_GOVERNANCE_API_KEY=your-api-key  # optional

2. Add Decorator to Your Agent

from agent_governance import track_agent

@track_agent(
    agent_id="my-agent-001",
    agent_name="My Agent",
    framework="strands"  # or "adk", "langgraph", "custom"
)
async def my_agent(query: str):
    # Your agent code here
    return result

That's it! Every execution is now tracked automatically.

Usage Examples

With Strands SDK

from agent_governance import track_agent
from strands import Agent
from strands.models import VertexAIModel

model = VertexAIModel(model="gemini-2.0-flash-exp")
agent = Agent(name="my_agent", model=model)

@track_agent(agent_id="strands-agent-001", framework="strands")
async def execute_agent(query: str):
    response = await agent.run(query)
    return {"result": response.content}

With LangGraph

from agent_governance import track_agent
from langgraph.prebuilt import create_react_agent

agent = create_react_agent(model=llm, tools=[])

@track_agent(agent_id="langgraph-agent-001", framework="langgraph")
async def execute_agent(query: str):
    result = await agent.ainvoke({"messages": [...]})
    return {"result": result}

With Google ADK

from agent_governance import track_agent

@track_agent(agent_id="adk-agent-001", framework="adk")
async def execute_agent(query: str):
    # Your ADK agent code
    return result

With Custom Framework

from agent_governance import track_agent

@track_agent(agent_id="custom-agent-001", framework="custom")
def my_custom_agent(input_data):
    # Any Python function
    result = process(input_data)
    return result

What Gets Tracked

For every agent execution:

MetricDescription
agent_idUnique identifier
agent_nameHuman-readable name
execution_idPer-call UUID
frameworkFramework used
timestampExecution time
durationTime taken (seconds)
input_tokensRequest tokens
output_tokensResponse tokens
total_tokensSum of tokens
costCalculated cost ($)
statussuccess/error
errorError message if failed

Configuration

Environment Variables

# Required
export AGENT_GOVERNANCE_PLATFORM_URL=https://your-platform-url

# Optional
export AGENT_GOVERNANCE_API_KEY=your-api-key

Decorator Parameters

@track_agent(
    agent_id="my-agent",           # Required: Unique identifier
    agent_name="My Agent",         # Optional: Display name
    api_key="...",                 # Optional: Override env var
    platform_url="https://...",    # Optional: Override env var
    framework="strands"            # Optional: Framework name
)

Cost Tracking

Automatic cost calculation based on token usage:

ModelInput (per 1M tokens)Output (per 1M tokens)
gemini-2.0-flash$0.075$0.30
gemini-1.5-pro$1.25$5.00
gpt-4o$2.50$10.00
gpt-4o-mini$0.15$0.60

OpenTelemetry Integration

The library automatically:

  • Creates spans for each execution
  • Records metrics (executions, tokens, cost, duration)
  • Sends traces to your platform
  • Exports to OTLP-compatible backends

Error Handling

The library is designed to never break your agent:

  • Telemetry failures are caught and logged
  • Non-blocking async operations
  • Graceful degradation if platform is unavailable

Requirements

  • Python >= 3.9
  • opentelemetry-api >= 1.20.0
  • opentelemetry-sdk >= 1.20.0
  • opentelemetry-exporter-otlp >= 1.20.0
  • requests >= 2.31.0

Platform Setup

This library requires a governance platform to receive telemetry. You can:

  1. Deploy the included platform (see platform documentation)
  2. Use any OTLP-compatible backend
  3. Build your own receiver

Development

# Install in development mode
pip install -e .

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

License

MIT License - see LICENSE file for details

Support

Contributing

Contributions welcome! Please read CONTRIBUTING.md first.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.012 Feb 20267

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

NOT_FOUND
yourusername/agent-governance

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:04 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:054274c551b0606f8977ee01c8d62cd7d52ac49b96bf4d16b747387ad0f6a9ec