Skip to content

API Reference

Quick-lookup table of all public symbols in kompoz.

Core

Symbol Kind Description
Combinator class Abstract base for all combinators
Predicate class Checks a condition, doesn't modify context
PredicateFactory class Factory for parameterized predicates
Transform class Transforms context, fails on exception
TransformFactory class Factory for parameterized transforms
Try class Wraps a function, converts exceptions to failure
Registry class Register and load rules from expressions
ExpressionParser class Parser for rule expressions

Decorators

Symbol Kind Description
@rule decorator Create a simple predicate
@rule_args decorator Create a parameterized predicate factory
@pipe decorator Create a simple transform
@pipe_args decorator Create a parameterized transform factory
@vrule decorator Create a validating rule with error message
@vrule_args decorator Create a parameterized validating rule
@async_rule decorator Create an async predicate
@async_rule_args decorator Create a parameterized async predicate
@async_pipe decorator Create an async transform
@async_pipe_args decorator Create a parameterized async transform
@async_vrule decorator Create an async validating rule
@async_vrule_args decorator Create a parameterized async validating rule
@cached_rule decorator Create a rule with result caching
@async_cached_rule decorator Create an async rule with result caching

Functions

Symbol Kind Description
explain function Generate plain English explanation of a rule
if_then_else function Create conditional combinator
async_if_then_else function Create async conditional combinator
parse_expression function Parse expression string into config dict
use_tracing function Context manager to enable tracing
run_traced function Run with explicit tracing
run_async_traced function Run async combinator with tracing
use_cache function Context manager to enable caching
parallel_and function Async AND that runs children concurrently

Async

Symbol Kind Description
AsyncCombinator class Base class for async combinators
AsyncPredicate class Async predicate
AsyncPredicateFactory class Factory for parameterized async predicates
AsyncTransform class Async transform with error tracking
AsyncTransformFactory class Factory for parameterized async transforms
AsyncRetry class Async retry with backoff

Validation

Symbol Kind Description
ValidationResult class Result with ok, errors, and ctx
ValidatingCombinator class Base for validating combinators
ValidatingPredicate class Predicate with error message
AsyncValidatingCombinator class Async base for validating combinators
AsyncValidatingPredicate class Async predicate with error message

Tracing

Symbol Kind Description
TraceHook protocol Protocol for custom trace hooks
TraceConfig class Configuration for tracing behavior
PrintHook class Simple stdout tracing
LoggingHook class Python logging integration
OpenTelemetryHook class OpenTelemetry integration

Retry & Caching

Symbol Kind Description
Retry class Retry with configurable backoff
AsyncRetry class Async retry with backoff
RetryResult class Result from run_with_info()
CachedPredicate class Predicate with result caching
AsyncCachedPredicate class Async predicate with caching

Concurrency

Symbol Kind Description
AsyncTimeout class Timeout wrapper
with_timeout function Create timeout wrapper
AsyncLimited class Concurrency limiter
limited function Create concurrency limiter
AsyncCircuitBreaker class Circuit breaker pattern
circuit_breaker function Create circuit breaker
CircuitState enum Circuit breaker states
CircuitBreakerStats class Circuit breaker statistics

Temporal

Symbol Kind Description
during_hours function Check if current hour is in range
on_weekdays function Check if today is Monday-Friday (tz-aware)
on_days function Check if today is one of the specified days (tz-aware)
after_date function Check if today is after date (tz-aware)
before_date function Check if today is before date (tz-aware)
between_dates function Check if today is in date range (tz-aware)

Utilities

Symbol Kind Description
Always class Always succeeds
Never class Always fails
Debug class Prints context and succeeds