Skip to main content

Runtime Backends

The Waxell Runtime uses pluggable backends for different deployment scenarios. This enables the same code to run locally and in production.

Backend Protocols

ProtocolDefault (Runtime)Production (Infra)
TokenSemaphoreInMemoryTokenSemaphoreRedisTokenSemaphore
TaskStatusProviderInMemoryTaskStatusProviderCeleryTaskStatusProvider
RuntimeBackendInMemoryBackendDjangoRuntimeBackend
GovernanceHook(none)PolicyGovernanceHook

Local Development

In local development, defaults are used automatically:

from waxell_runtime import RuntimeConfig

# Uses in-memory implementations
config = RuntimeConfig.get()

No Redis, Celery, or Django required for local development.

Production Configuration

Production backends are configured by the waxell-infra Django app:

# settings.py
INSTALLED_APPS = [
...
'waxell_infra', # Automatically configures runtime backends
]

The infra app's ready() hook configures:

  • RedisTokenSemaphore for rate limiting
  • CeleryTaskStatusProvider for async task tracking
  • DjangoRuntimeBackend for persistence
  • PolicyGovernanceHook for policy enforcement

Custom Backends

You can implement custom backends by following the protocols:

from waxell_runtime.protocols import TokenSemaphore

class CustomSemaphore(TokenSemaphore):
async def acquire(self, key: str, tokens: int) -> bool:
# Custom implementation
pass

async def release(self, key: str, tokens: int) -> None:
# Custom implementation
pass

Next Steps