Provider methods
Provider methods are additional capabilities that providers expose beyond the basic query
and notify
functionality (read more here). These methods allow you to interact with the provider’s API in more specific ways, enabling richer integrations and automation capabilities.
What are Provider Methods?
Provider methods are defined using the PROVIDER_METHODS
list in each provider class. They represent specific actions or queries that can be performed through the provider’s API.
For example, a monitoring service provider might expose methods to:
- Mute/unmute alerts
- Get detailed traces
- Search for specific metrics
- Modify monitoring configurations
Using Provider Methods
Provider methods can be accessed through:
- Keep’s platform interface via the alert action menu
- Keep’s smart AI assistant (e.g., “get traces for this alert”)
- Keep’s API
- Keep’s workflows
Via UI
Methods appear in the alert action menu when available for the alert’s source provider:
The form is automatically populated with the parameters required by the method, if they are available in the alert.
Via AI Assistant
Keep’s AI assistant can automatically discover and invoke provider methods based on natural language requests by understanding multiple contexts:
-
Alert Context: The AI understands:
- The alert’s source provider
- Alert metadata and attributes
- Related services and applications
- Current alert status and severity
-
Provider Context: The AI knows:
- Which providers are connected to your account
- Available methods for each provider
- Required parameters and their types
- Method descriptions and capabilities
-
Historical Context: The AI learns from:
- Similar past incidents
- Previously successful method invocations
- Common patterns in alert resolution
For example:
The AI assistant automatically:
- Identifies relevant provider methods
- Extracts required parameters from context
- Suggests appropriate actions based on the alert type
- Chains multiple methods for comprehensive investigation
Via API
Adding New Provider Methods
To add a new method to your provider:
- Define the method in your provider class:
- Add method metadata to
PROVIDER_METHODS
:
Method Types
- view: Returns data to be displayed (e.g., getting traces, metrics)
- action: Performs an action (e.g., muting an alert, creating a ticket)
Parameter Types
str
: String inputdatetime
: Date/time pickerliteral
: Dropdown with predefined valuesint
: Numeric inputbool
: Boolean input
Auto-Discovery
Keep automatically inspects provider classes to:
- Discover available methods
- Extract parameter information
- Generate UI components
- Enable AI understanding of method capabilities
Best Practices
- Clear Documentation: Provide detailed docstrings for methods
- Type Hints: Use Python type hints for parameters
- Error Handling: Return clear error messages
- Scopes: Define minimum required scopes
- Validation: Validate parameters before execution
Limitations
- Currently supports only synchronous methods
- Parameter types are limited to basic types
- Methods must be instance methods of the provider class