Skip to main content

Python SDK for tool usage logging and monitoring

Project description

Observe Python SDK

A Python SDK for MCP tool and prompt usage logging and monitoring.

Installation

pip install observee

Usage

You can set the MCP server name either globally or per decorator:

Global Configuration

from observee import ObserveeConfig, observee_usage_logger, observee_prompt_logger

# Set the MCP server name globally
ObserveeConfig.set_mcp_server_name("your-mcp-server-name")

@observee_usage_logger
async def your_tool_function():
    # Your tool code here
    pass

@observee_prompt_logger
async def your_prompt_function():
    # Your prompt code here
    pass

API Key Configuration (Developers and Enterprise Customers)

from observee import ObserveeConfig

# Set your API key
ObserveeConfig.set_api_key("your-api-key")

Tool Usage Logging

from observee import ObserveeConfig, observee_usage_logger

@observee_usage_logger
async def your_tool_function():
    # Your tool code here
    pass

Prompt Usage Logging

from observee import ObserveeConfig, observee_prompt_logger

@observee_prompt_logger
async def your_prompt_function():
    # Your prompt code here
    pass

Features

  • Tool and prompt usage logging with async support
  • Automatic logging of:
    • Tool/prompt name
    • Input parameters
    • Response data
    • Execution duration (for tools)
    • Error information (if any)
  • Configurable logging endpoint (defaults to Observe API)
  • Error handling and reporting
  • Performance tracking (for tools)
  • Flexible MCP server name configuration
  • API key support for enhanced features
  • Privacy protection: Input/response data only logged when API key is provided

Logging Details

Tool Usage Logging

The SDK automatically logs the following information for each tool usage:

  • MCP server name
  • Tool name (derived from function name)
  • Tool input parameters (as JSON)
  • Tool response
  • Execution duration in milliseconds
  • Any errors that occur during execution

Prompt Usage Logging

The SDK automatically logs the following information for each prompt usage:

  • MCP server name
  • Prompt name (derived from function name)
  • Prompt input parameters (as JSON)
  • Prompt response
  • Any errors that occur during execution

Privacy Protection

For privacy protection, detailed input and response data is only logged when an API key is configured. Without an API key, only basic metadata is logged:

  • For tools: server name, tool name, and execution duration
  • For prompts: server name and prompt name

Logs are sent asynchronously to avoid impacting tool/prompt performance.

Requirements

  • Python 3.8 or higher
  • Dependencies:
    • httpx
    • pydantic

License

GPL v3 - see LICENSE file for details

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

observee-0.1.9.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

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

observee-0.1.9-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file observee-0.1.9.tar.gz.

File metadata

  • Download URL: observee-0.1.9.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for observee-0.1.9.tar.gz
Algorithm Hash digest
SHA256 473e118195fbae922554e2dab36ab6c8073bbfb2193ac34c9038904b7998481c
MD5 306b127b5349691224546065be2dccf1
BLAKE2b-256 8a1aab108e2910cf96e20f43ab2712f83c67d05ad5a5a224bc73e5d616718aae

See more details on using hashes here.

File details

Details for the file observee-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: observee-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for observee-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ac396a40548cf02ac66a643d6dc76fba18be23707bbead0aa0eb28986dce4e9e
MD5 9e77f8a36db94b0c80ba5d3cb04aec72
BLAKE2b-256 b253b887518e50223df53a55057a36c23f6bab71d9f47bb50f980e8e2335843e

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