Agent Mont
Advanced Monitoring for AI Agents
Comprehensive metrics, insights, and visualization for Phidata and Crew AI applications
📊 Overview
Agent Mont is an advanced AgentOps monitoring library designed specifically for Phidata 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:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
Metadata
Release files for agent-mont 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agent_mont-0.1.3.tar.gz | 13.0 kB | Without provenance | Details for agent_mont-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agent_mont-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for agent_mont-0.1.3-py3-none-any.whl |
Total release size: 25.8 kB
Release files / agent_mont-0.1.3.tar.gz
| Download URL | agent_mont-0.1.3.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd0194ed834bb6d31e4f9d72fb186d490870f6a9f5ecfdccce02328936b6dd3f
|
|
BLAKE2b-256 checksum How to use checksums |
0f5ba0a3422e66ec98e6b4a5f3560d4acfdb9301d8baab052afa446542f51e39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Release files / agent_mont-0.1.3-py3-none-any.whl
| Download URL | agent_mont-0.1.3-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e01b76c002cf3dd51e66fc05c9528a5e6dba0e761cb774392d3ac44a4cf6db37
|
|
BLAKE2b-256 checksum How to use checksums |
7722943854e49484992333d62bac8e6548ba8ca5262adf8cb780160262568364
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Security for agent-mont 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.