Skip to content

Other Configuration Classes

Additional configuration classes.

LoggingConfig

from mamba_agents.config import LoggingConfig

config = LoggingConfig(
    level="INFO",
    format="json",
    redact_sensitive=True,
)
Option Type Default Description
level str "INFO" Log level
format str "text" Output format
redact_sensitive bool True Redact secrets

ErrorRecoveryConfig

from mamba_agents.config import ErrorRecoveryConfig

config = ErrorRecoveryConfig(
    retry_level=2,
    max_retries=3,
    base_wait=1.0,
)
Option Type Default Description
retry_level int 2 Aggressiveness (1-3)
max_retries int 3 Max attempts
base_wait float 1.0 Initial backoff

API Reference

LoggingConfig

Bases: BaseModel

Configuration for logging behavior.

Supports structured JSON logging, request/response body logging, and automatic redaction of sensitive data.

ATTRIBUTE DESCRIPTION
level

Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL).

TYPE: LogLevel

structured

Enable JSON format logging.

TYPE: bool

include_request_body

Log request bodies (opt-in for privacy).

TYPE: bool

include_response_body

Log response bodies (opt-in for privacy).

TYPE: bool

body_size_limit

Maximum bytes to log for bodies.

TYPE: int

include_correlation_id

Include correlation IDs in logs.

TYPE: bool

redact_authorization

Redact Authorization headers.

TYPE: bool

redact_api_keys

Redact API keys in query params.

TYPE: bool

sensitive_patterns

Custom regex patterns to redact.

TYPE: list[str]

ErrorRecoveryConfig

Bases: BaseModel

Configuration for error recovery and retry behavior.

Error recovery aggressiveness is configurable on a scale of 1-3: - Level 1 (Conservative): Minimal retries, fail fast - Level 2 (Balanced): Default behavior - Level 3 (Aggressive): Maximum retry attempts

ATTRIBUTE DESCRIPTION
retry_level

Aggressiveness level (1-3).

TYPE: RetryLevel

tool_max_retries

Override for tool retry count.

TYPE: int | None

model_max_retries

Override for model retry count.

TYPE: int | None

initial_backoff_seconds

Initial wait before retry.

TYPE: float

max_backoff_seconds

Maximum wait between retries.

TYPE: float

circuit_breaker_threshold

Failures before circuit opens.

TYPE: int

circuit_breaker_timeout

Seconds before retry after circuit opens.

TYPE: float

retryable_tool_errors

Tool error types that trigger retry.

TYPE: list[str]

retryable_model_errors

Model error types that trigger retry.

TYPE: list[str]

validate_retry_level classmethod

validate_retry_level(v: int) -> int

Validate retry level is in range 1-3.

Source code in src/mamba_agents/config/retry.py
@field_validator("retry_level")
@classmethod
def validate_retry_level(cls, v: int) -> int:
    """Validate retry level is in range 1-3."""
    if v not in (1, 2, 3):
        raise ValueError("retry_level must be 1, 2, or 3")
    return v

get_tool_retries

get_tool_retries() -> int

Get tool retry count based on configuration.

RETURNS DESCRIPTION
int

Number of retries for tool calls.

Source code in src/mamba_agents/config/retry.py
def get_tool_retries(self) -> int:
    """Get tool retry count based on configuration.

    Returns:
        Number of retries for tool calls.
    """
    if self.tool_max_retries is not None:
        return self.tool_max_retries
    return _TOOL_RETRIES[self.retry_level]

get_model_retries

get_model_retries() -> int

Get model retry count based on configuration.

RETURNS DESCRIPTION
int

Number of retries for model calls.

Source code in src/mamba_agents/config/retry.py
def get_model_retries(self) -> int:
    """Get model retry count based on configuration.

    Returns:
        Number of retries for model calls.
    """
    if self.model_max_retries is not None:
        return self.model_max_retries
    return _MODEL_RETRIES[self.retry_level]

get_backoff_multiplier

get_backoff_multiplier() -> float

Get exponential backoff multiplier based on retry level.

RETURNS DESCRIPTION
float

Backoff multiplier for exponential backoff.

Source code in src/mamba_agents/config/retry.py
def get_backoff_multiplier(self) -> float:
    """Get exponential backoff multiplier based on retry level.

    Returns:
        Backoff multiplier for exponential backoff.
    """
    return _BACKOFF_MULTIPLIERS[self.retry_level]