Skip to main content

A monitoring tool for LLM API calls

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Cylestio Monitor

A comprehensive security and monitoring solution for AI agents. Cylestio Monitor provides lightweight, drop-in security monitoring for various frameworks, including Model Context Protocol (MCP) and popular LLM providers.

PyPI version CI Security

Overview

Cylestio Monitor is a Python SDK that provides security and monitoring capabilities for AI agents. While it works as a standalone solution, it integrates seamlessly with the Cylestio UI and smart dashboards for enhanced user experience and additional security and monitoring capabilities across your entire agentic workforce.

For full documentation, visit https://docs.cylestio.com

Installation

pip install cylestio-monitor

Installation for Example Projects

If you're using one of the example projects in a subdirectory with its own virtual environment:

# Navigate to the example directory 
cd examples/agents/your_agent_dir

# Activate your virtual environment
source venv/bin/activate  # (or venv\Scripts\activate on Windows)

# Install the Cylestio Monitor from the parent directory in development mode
pip install -e ../../..

Quick Start

from cylestio_monitor import start_monitoring
from anthropic import Anthropic

# Create your LLM client
client = Anthropic()

# Enable monitoring with a remote API endpoint
start_monitoring(
    agent_id="my_agent",
    config={
        "api_endpoint": "https://your-api-endpoint.com/events"
    }
)

# Use your client as normal
response = client.messages.create(
    model="claude-3-sonnet-20240229",
    max_tokens=1000,
    messages=[{"role": "user", "content": "Hello, Claude!"}]
)

# When finished, stop monitoring
from cylestio_monitor import stop_monitoring
stop_monitoring()

Key Features

  • Zero-configuration setup: Import and enable with just two lines of code
  • Multi-framework support: Works with popular LLM clients and frameworks including Model Context Protocol (MCP)
  • Complete request-response tracking: Captures both outgoing LLM requests and incoming responses
  • Security monitoring: Detects and blocks dangerous prompts
  • Performance tracking: Monitors call durations and response times
  • Flexible storage options: Events can be sent to a remote API endpoint or stored locally in JSON files

Security Features

  • Prompt injection detection: Identify and block malicious prompt injection attempts
  • PII detection: Detect and redact personally identifiable information
  • Content filtering: Filter out harmful or inappropriate content
  • Security rules: Define custom security rules for your specific use case

Framework Support

Cylestio Monitor supports:

  • Direct API calls: Anthropic, Claude models (all versions)
  • LangChain: Chains, agents, and callbacks
  • LangGraph: Graph-based agents and workflows
  • MCP (Model Context Protocol): Tool calls and responses

See docs/compatibility.md for the full compatibility matrix.

Repository Structure

The Cylestio Monitor repository is organized as follows:

cylestio-monitor/
├── src/                       # Source code for the Cylestio Monitor package
│   └── cylestio_monitor/      # Main package
│       ├── patchers/          # Framework-specific patchers (Anthropic, MCP, etc.)
│       ├── events/            # Event definitions and processing
│       ├── config/            # Configuration management
│       └── utils/             # Utility functions
├── examples/                  # Example implementations
│   └── agents/                # Various agent examples demonstrating integration
├── tests/                     # Test suite
│   ├── integration/           # Integration tests
│   └── fixtures/              # Test fixtures
└── docs/                      # Documentation
    ├── compatibility.md       # Framework compatibility information
    ├── getting-started/       # Getting started guides
    ├── advanced-topics/       # Advanced usage documentation
    └── sdk-reference/         # API reference documentation

Testing

Cylestio Monitor uses a comprehensive testing approach with custom tooling to ensure consistent test execution across different environments.

Running Tests

We recommend using our custom test runner which handles dependency mocking and environment setup:

# Run all tests
python tests/run_tests.py

# Run with coverage
python tests/run_tests.py --cov=src --cov-report=term-missing

# Run specific tests
python tests/run_tests.py tests/test_api_client.py

# Run tests with specific markers
python tests/run_tests.py -m "integration"

This approach ensures that tests run consistently regardless of the environment or installed dependencies. See docs/TESTING.md for detailed information about our testing approach.

API Client

The Cylestio Monitor now uses a lightweight REST API client to send telemetry events to a remote endpoint instead of storing them in a local database. This approach offers several advantages:

  • Centralized Event Storage: All events from different agents can be collected in a central location
  • Real-time Monitoring: Events are sent in real-time to the API for immediate analysis
  • Minimal Storage Requirements: No local database maintenance required
  • Scalability: Easily scale monitoring across multiple agents and applications

The API client can be configured by providing an endpoint URL either through the api_endpoint configuration parameter or by setting the CYLESTIO_API_ENDPOINT environment variable.

Contributing

We welcome contributions! Please see our Contributing Guide for details on how to get started.

Documentation

For complete documentation, including detailed guides, API reference, and best practices, visit:

https://docs.cylestio.com

License

MIT

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

cylestio_monitor-0.1.4.tar.gz (171.3 kB view details)

Uploaded Source

Built Distribution

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

cylestio_monitor-0.1.4-py3-none-any.whl (64.5 kB view details)

Uploaded Python 3

File details

Details for the file cylestio_monitor-0.1.4.tar.gz.

File metadata

  • Download URL: cylestio_monitor-0.1.4.tar.gz
  • Upload date:
  • Size: 171.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cylestio_monitor-0.1.4.tar.gz
Algorithm Hash digest
SHA256 748b2f21d0ff901d3546efa9f59f9fca23356ead68a2aa5d628682a3f3e79925
MD5 d329e515bc407ce011b8862080c250d2
BLAKE2b-256 1f6e4f63fb08a511b194661ee95cee91400f225402841cdc343db6676b2d4dac

See more details on using hashes here.

File details

Details for the file cylestio_monitor-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for cylestio_monitor-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8fa5008aa2aa4ec33c8add920ae96387630bffa37ef6868ec79a60d274690bf9
MD5 b30c2a41d337eff84e65a027d5b25760
BLAKE2b-256 158ad458259daf42e66f8f587ec5bcf03212cef10327a18f760457fbaaf5f5e1

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