Skip to main content

Python SDK for tool usage logging and monitoring

Project description

Observe Python SDK

A Python SDK for 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 (Enterprise Customers Only)

from observee import ObserveeConfig

# Set your enterprise API key
ObserveeConfig.set_api_key("your-enterprise-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
  • Enterprise 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 enterprise API key is configured. Without an API key, only basic metadata (server name, tool/prompt name, duration) is logged.

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

Requirements

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

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

observee-0.1.7.tar.gz (4.0 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.7-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: observee-0.1.7.tar.gz
  • Upload date:
  • Size: 4.0 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.7.tar.gz
Algorithm Hash digest
SHA256 661c0bb7308e17f2e1b981316c5126b957a12b0e5ae70c6cca36321e13b544cf
MD5 d85be86841ed606d7dc20a9070456b69
BLAKE2b-256 944cd0ac556de2d78f8bb0ce0ecc4979212201f12164856e063f5021ab635d2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: observee-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 4.6 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0449e9af4c22b1c85ceca127fdd62bb807c66624c90d63699f50c427cf4625e5
MD5 3e16f94cf1ff674a282b6eb03d0c0c06
BLAKE2b-256 05d8669281cb610c8d192c3314bff85f8bca938cfcc68aa64c67debc7bdf7e57

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