Skip to content

Configuration

This guide covers all configuration options available in the Rizk SDK.

SDK Initialization

The Rizk SDK can be initialized with various configuration options:

from rizk.sdk import Rizk
client = Rizk.init(
# Required
app_name="my_app",
api_key="your_api_key_here",
# Optional
opentelemetry_endpoint="https://api.rizk.tools",
enabled=True,
telemetry_enabled=True,
headers={"custom-header": "value"},
disable_batch=False,
resource_attributes={
"service.name": "my_service",
"service.version": "1.0.0",
"deployment.environment": "production"
},
policies_path="/path/to/policies",
llm_service=my_custom_llm_service
)

Configuration Options

Required Options

OptionTypeDescription
app_namestrName of your application
api_keystrYour Rizk API key

Optional Options

OptionTypeDefaultDescription
opentelemetry_endpointstrNoneOpenTelemetry collector endpoint
enabledboolTrueWhether tracing is enabled
telemetry_enabledboolTrueWhether telemetry is enabled
headersDict[str, str]{}Custom headers for API requests
disable_batchboolFalseWhether to disable batch processing
resource_attributesDict[str, str]{}Additional resource attributes
policies_pathstrNonePath to custom policies directory
llm_serviceAnyNoneCustom LLM service implementation

Environment Variables

You can also configure the SDK using environment variables:

RIZK_API_KEY=your_api_key_here
RIZK_OPENTELEMETRY_ENDPOINT=https://api.rizk.tools
RIZK_ENABLED=true
RIZK_TELEMETRY_ENABLED=true
RIZK_DISABLE_BATCH=false
RIZK_POLICIES_PATH=/path/to/policies

Resource Attributes

Resource attributes help identify your application in telemetry data:

resource_attributes = {
"service.name": "my_service",
"service.version": "1.0.0",
"deployment.environment": "production",
"custom.attribute": "value"
}
client = Rizk.init(
app_name="my_app",
api_key="your_api_key",
resource_attributes=resource_attributes
)

Custom Policies

You can specify a custom path for your policies:

client = Rizk.init(
app_name="my_app",
api_key="your_api_key",
policies_path="/path/to/your/policies"
)

The policies directory should contain YAML files with policy definitions.

Custom LLM Service

You can provide your own LLM service implementation:

class MyCustomLLMService:
async def generate(self, prompt: str, **kwargs):
# Your custom LLM implementation
pass
client = Rizk.init(
app_name="my_app",
api_key="your_api_key",
llm_service=MyCustomLLMService()
)

Next Steps