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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file observee-0.1.8.tar.gz.
File metadata
- Download URL: observee-0.1.8.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45ae925d60e6137ac6b50d820e5371b7ee2a7d14c33bb6febac2d79f1b56e750
|
|
| MD5 |
c8197c1fd2895381e8c72c469cf26a17
|
|
| BLAKE2b-256 |
692094d0f73dad607ae4ac6643751b1c0595bc6e88f38bd5d7e892d560ad9a94
|
File details
Details for the file observee-0.1.8-py3-none-any.whl.
File metadata
- Download URL: observee-0.1.8-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3f35eeaa920bff1078b0021459ab530d8aaa9b5859350069c6816c868e7b65b
|
|
| MD5 |
61fb7fb55f5754ce081b712fa06f3838
|
|
| BLAKE2b-256 |
41e1cd4b157dda528d2c2d0f93c4702be4822e3ffa55df344eb3e31d3a2b70c1
|