Sentinel Python SDK Specification
sentinel-python-sdk/
├── src/
│ └── sentinel/
│ ├── __init__.py
│ ├── init.py
│ ├── registration/
│ │ ├── __init__.py
│ │ ├── project.py
│ │ └── task.py
│ ├── wrappers/
│ │ ├── __init__.py
│ │ ├── anthropic.py
│ │ ├── openai.py
│ │ └── litellm.py
│ ├── converters/
│ │ ├── __init__.py
│ │ └── format_converter.py
│ └── api/
│ ├── __init__.py
│ └── client.py
├── tests/
├── docs/
├── setup.py
├── pyproject.toml
└── README.md
Required packages:
- requests>=2.28.0
- openai>=1.0.0
- anthropic>=0.3.0
- litellm>=0.1.0
- pydantic>=2.0.0
- python-dotenv>=1.0.0
3. Feature Specifications
3.1 Initialization (sentinel.init)
Function: init(api_key: str, project_id: Optional[str] = None)
Description: Initializes the SDK and performs all necessary setup
Process:
Validates API key
Sets up global configuration
Calls register_project if project_id not provided
Automatically patches supported LLM clients
Error handling:
Invalid API key
Network connectivity issues
Invalid project_id format
Function: register_project(name: str, metadata: Optional[Dict] = None) -> str
Description: Registers a new project with Sentinel
Returns: project_id
Error handling:
Duplicate project names
Invalid metadata format
Network errors
Function: register_task(name: str, project_id: str, metadata: Optional[Dict] = None) -> str
Description: Registers a new task within a project
Returns: task_id
Error handling:
Invalid project_id
Duplicate task names
Invalid metadata format
Implementation: Monkey-patching approach for each supported client
Supported clients:
Wrapper functionality:
Intercept client initialization
Wrap completion/chat methods
Call submit_request before API call
Call submit_response after API response
Maintain original client behavior
Implement converters for each client format to OpenAI format
Standard format structure:
{
"messages" : List [Dict [str , str ]],
"model" : str ,
"temperature" : float ,
"max_tokens" : int ,
"additional_params" : Dict
}
Minimum test coverage: 90%
Test types:
Unit tests for all components
Integration tests for client wrapping
End-to-end tests for full workflow
Mock external API calls
Test all error cases
Performance testing for overhead measurement
5. Documentation Requirements
Docstring format: Google style
Documentation files:
README.md with quick start guide
API reference (auto-generated)
Integration guide
Examples directory
Code comments for complex logic
Type hints for all functions
6. Performance Considerations
Maximum latency overhead: 50ms per request
Asynchronous submission of metrics
Local caching of project/task IDs
Minimal memory footprint
Efficient format conversion
Specify the Python versions the package should support
List any operating system or environment-specific considerations
Describe how the final package should be delivered (e.g., GitHub repository, PyPI package)
Specify any continuous integration or deployment requirements