Client Constructor

Both InfiniumClient and AsyncInfiniumClient accept the same parameters:

from infinium import InfiniumClient

client = InfiniumClient(
    agent_id="your-agent-id",
    agent_secret="your-agent-secret",
    base_url="https://platform.i42m.ai/api/v1",
    timeout=30.0,
    max_retries=3,
    enable_rate_limiting=True,
    requests_per_second=10.0,
    user_agent="infinium-python/1.0.0",
    enable_logging=False,
    log_level="INFO",
    verify_ssl=True,
)

Parameters

ParameterTypeDefaultDescription
agent_idstrrequiredYour agent’s UUID from the Infinium platform
agent_secretstrrequiredYour agent’s secret key
base_urlstr"https://platform.i42m.ai/api/v1"API endpoint
timeoutfloat30.0Per-request timeout in seconds
max_retriesint3Number of retry attempts for retryable errors
enable_rate_limitingboolTrueEnable client-side rate limiting
requests_per_secondfloat10.0Maximum requests per second (when rate limiting is enabled)
user_agentstr"infinium-python/1.0.0"User-Agent header value
enable_loggingboolFalseEnable SDK debug logging
log_levelstr"INFO"Logging level (when logging is enabled)
verify_sslboolTrueVerify SSL certificates

Context Managers

Both clients implement context manager protocols for automatic cleanup:

# Sync
with InfiniumClient(agent_id="...", agent_secret="...") as client:
    client.send_task(...)
# client.close() called automatically

# Async
async with AsyncInfiniumClient(agent_id="...", agent_secret="...") as client:
    await client.send_task(...)
# client.close() called automatically

If you don’t use a context manager, call close() explicitly when done.

SSL Configuration

For local development with self-signed certificates:

client = InfiniumClient(
    agent_id="...",
    agent_secret="...",
    verify_ssl=False,  # Disable SSL verification
)

Warning: Never disable SSL verification in production.

Logging

Enable SDK logging for debugging:

client = InfiniumClient(
    agent_id="...",
    agent_secret="...",
    enable_logging=True,
    log_level="DEBUG",  # DEBUG, INFO, WARNING, ERROR
)

Or configure logging manually:

from infinium import setup_logging

setup_logging(level="DEBUG")

This configures Python’s logging module for the infinium logger.

Rate Limiting

The built-in rate limiter uses a token bucket algorithm:

client = InfiniumClient(
    agent_id="...",
    agent_secret="...",
    enable_rate_limiting=True,
    requests_per_second=10.0,  # 10 requests per second
)
  • Thread-safe for sync usage
  • Async-safe for async usage
  • Burst size: 20 (allows short bursts above the rate)
  • Automatically throttles when the limit is reached

To disable:

client = InfiniumClient(
    agent_id="...",
    agent_secret="...",
    enable_rate_limiting=False,
)

Retry Configuration

Retries use exponential backoff with jitter:

client = InfiniumClient(
    agent_id="...",
    agent_secret="...",
    max_retries=3,   # Retry up to 3 times
    timeout=30.0,    # 30 second timeout per request
)

Only retryable errors trigger retries (5xx, network errors, timeouts). See Error Handling for the full list.

API Endpoints

The SDK communicates with three endpoints:

MethodPathAuthPurpose
POST/agents/{agentId}/traceAgent credentialsSend a trace
GET/agents/{agentId}/interpreted-result/{traceId}Agent credentialsGet Maestro interpretation
GET/prompts/{promptId}/v/{version}Prompt credentialsFetch Prompt Studio content

Agent credentials are sent as x-agent-id and x-agent-key headers. Prompt credentials use x-prompt-id and x-prompt-key.