Skip to main content

A comprehensive monitoring solution for AI agent frameworks including Langchain, CrewAI, and Agno. AgentMont provides enhanced metrics and deep observability for production AI agent applications.

Project description

Agent Mont

Agent Mont Logo

Advanced Monitoring for AI Agents

Comprehensive metrics, insights, and visualization for Phidata and Crew AI applications

Python License Version


📊 Overview

Agent Mont is an advanced AgentOps monitoring library designed specifically for Agno and Crew AI applications. It provides real-time insights into your AI agents' performance, resource utilization, and environmental impact.

✨ Key Features

  • 📝 Token Tracking - Precise accounting of input, output, and total tokens
  • 💰 Cost Analysis - Real-time cost calculation based on model-specific pricing
  • ⚡ Performance Metrics - Detailed execution time and resource utilization
  • 🔄 Throughput Monitoring - Tokens processed per second and operation latency
  • 🌱 Environmental Impact - Carbon emission estimates for responsible AI deployment
  • 📋 Comprehensive Logging - Detailed operational logs for debugging and analysis
  • 📊 Interactive Visualization - CLI summaries and Streamlit dashboard for visual insights

🚀 Installation

pip install agent-mont

🔍 Usage

Basic Example

from agent_mont import AgentMontExtended

# Initialize Agent Mont monitoring
mont = AgentMontExtended(model="gpt-4o")

# Start monitoring
mont.start()

# Your Crew AI operations go here
# result = your_ai_function()

# Set token counts
input_text = "Your input text here."
output_text = "Your output text here."
mont.set_token_counts(input_text=input_text, output_text=output_text)

# Measure operation latency
# result = mont.measure_operation(your_function, arg1, arg2)

# End monitoring
mont.end()

# Visualize the results
mont.visualize(method='cli')

Integration with Crew AI

from agent_mont import AgentMontExtended
from crewai import Crew, Agent, Task

# Initialize monitoring
mont = AgentMontExtended(model="gpt-4o")
mont.start()

# Define your Crew agents and tasks
agent = Agent(...)
task = Task(...)
crew = Crew(agents=[agent], tasks=[task])

# Run crew process
result = crew.kickoff()

# Extract token usage from crew output
mont.set_token_usage_from_crew_output(result)

# End monitoring and display metrics
mont.end()
mont.visualize(method='cli')

📖 API Reference

AgentMont Initialization

AgentMont(
    model: str,                      # LLM model identifier (e.g., "gpt-4o")
    enable_monitoring: bool = True,  # Toggle monitoring on/off
    encoding_name: str = "cl100k_base"  # Token encoding scheme
)

Core Methods

Method Description
start() Begin resource and metric monitoring
end() Stop monitoring and compute all metrics
set_token_counts(input_text, output_text) Set token usage based on text
measure_operation(func, *args, **kwargs) Wrap a function call to record its latency
set_token_usage_from_crew_output(crew_output) Extract token usage from a CrewOutput
visualize(method) Visualize metrics using CLI or Streamlit

📈 Visualization

CLI Summary

mont.visualize(method='cli')

Example output:

========== AGENT MONT METRICS ==========
Model: gpt-4o
Execution Time: 2.34s
Total Tokens: 1,245
Cost: $0.0237
Throughput: 532.1 tokens/sec
CPU Usage: 23.7%
Memory Usage: 145.2 MB
Carbon Emissions: 0.00021 gCO2eq
=======================================

Streamlit Dashboard

Create a visualization script:

# visualize.py
from agent_mont import AgentMontExtended

mont = AgentMontExtended(model="gpt-4o")
# Load metrics from logs or set directly
mont.set_token_counts("Example input", "Example output")
mont.end()
mont.visualize(method='streamlit')

Run the dashboard:

streamlit run visualize.py

📝 Logging

All events and metrics are logged to agent_mont.log with timestamps and event categories:

2025-03-15 14:32:17 [INFO] Agent Mont initialized with model: gpt-4o
2025-03-15 14:32:18 [INFO] Monitoring started
2025-03-15 14:32:20 [INFO] Token counts set: 145 input, 267 output
2025-03-15 14:32:21 [INFO] Monitoring ended
2025-03-15 14:32:21 [INFO] Metrics calculated: 412 tokens, $0.0082 cost, 1.73s execution time

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📧 Contact

Faisal Azeez - faisalazeeii786@gmail.com


Made with ❤️ for the AI agent community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_mont-0.1.2.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_mont-0.1.2-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file agent_mont-0.1.2.tar.gz.

File metadata

  • Download URL: agent_mont-0.1.2.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for agent_mont-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a5d9a6ac988da6e4718002e432293c071326565685e925d67a76bcc2bfad24e8
MD5 bde17e52331ca6de8b7aa19b17c82f20
BLAKE2b-256 dd03b6409d415f01ed7b3521b7f4c1ef73a1e7a5c1fab56e1fc0aa4bc340f5fd

See more details on using hashes here.

File details

Details for the file agent_mont-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: agent_mont-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for agent_mont-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0d032931191e5b011f569c9df97567ecee369eecbc35b1c8edeebb865cee594c
MD5 d5e7b5499e0604a17e474ceb9de2d2fe
BLAKE2b-256 906f86aeb1f844777bf74a514ec2f998b0fbfed6d57b59d796c6bc30d745dc9b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page