Skip to main content

Official Python client for the Adaptive Context Layer (ACL)

Project description

ACL Python SDK (acl-core-py)

Official Python SDK for Adaptive Context Layer (ACL).

Installation

pip install acl-core-py

AI Agent Install And Infra Setup

Use this flow when agents/dev tools install and run ACL in production:

  1. Install SDK
pip install --upgrade acl-core-py
  1. Set environment variables (domain only, never raw server IP)
# Public ACL endpoint behind your domain/reverse proxy
export ACL_BASE_URL="https://backend.yourcompany.com"

# Org-scoped ACL key from ACL dashboard
export ACL_API_KEY="acl_live_xxx"

# Provider key stays only with your app/agent runtime
export OPENAI_API_KEY="sk-xxx"
  1. Initialize client using env vars
import os
from acl import ACLClient

client = ACLClient(
    api_key=os.environ["ACL_API_KEY"],
    base_url=os.environ["ACL_BASE_URL"],
)

Security notes:

  • Do not hardcode keys in source code.
  • Do not expose EC2/public IP in SDK config; always use DNS/domain.
  • Rotate keys immediately if logs/screenshots accidentally leak them.
  • Keep backend behind TLS (https) and firewall to trusted ports only.

Quick Start

from acl import ACLClient

client = ACLClient(api_key="acl_live_...")

result = client.complete(
    prompt="Summarize this incident report.",
    model="gpt-4o",
    llm_api_key="sk-...",
    max_retries=3,
)

if result["success"]:
    print(result["response"])
else:
    print(f"{result['error_code']}: {result['error_message']}")

Latency Controls (v1.9.0)

ACLClient(...) supports these runtime options:

  • emit_post_completion_telemetry (default: True): post-completion telemetry is now non-blocking.
  • precheck_cache_ttl_s (default: 20.0): short TTL cache for adaptive precheck calls.
  • precheck_cache_max_entries (default: 256): max in-memory precheck cache entries.

Every complete() response now includes timing metadata under metadata.acl_timing:

  • precheck_ms
  • provider_ms
  • post_telemetry_ms
  • wall_clock_ms

Runtime Contract

complete() always returns a stable top-level response shape on both success and failure:

  • success
  • error_code
  • error_message
  • provider
  • model
  • text and response

Validation and Safety

  • Fail-fast validation for invalid/missing prompt, unresolved model, missing keys, and malformed provider key formats.
  • Strict provider payload allowlist prevents internal ACL params from leaking to provider APIs.
  • Secrets are redacted from surfaced error messages by default.
  • Default ACL backend base URL: http://backend.fridayaicore.in.

Retry Behavior

  • Retries happen in SDK provider execution middleware (complete() path).
  • Exponential backoff with jitter and cap:
  • attempt 1: random delay 0-0.5s
  • attempt 2: random delay 0-1s
  • attempt 3: random delay 0-2s
  • max cap per attempt: 8s

Compatibility Policy

  • Python: >=3.8
  • Runtime dependencies: requests, urllib3, typing_extensions
  • Release policy: include migration notes whenever response contract or validation behavior changes.

Usage Terms

  • This SDK is proprietary and licensed for ACL service access only.
  • A valid ACL API key is required.
  • Redistribution, resale, sublicensing, and derivative redistribution are not permitted without written approval from ACL Team.

License

UNLICENSED / Proprietary. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acl_core_py-1.9.6.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

acl_core_py-1.9.6-py3-none-any.whl (34.3 kB view details)

Uploaded Python 3

File details

Details for the file acl_core_py-1.9.6.tar.gz.

File metadata

  • Download URL: acl_core_py-1.9.6.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for acl_core_py-1.9.6.tar.gz
Algorithm Hash digest
SHA256 c83d2782d0a322249525f8f399b0a555d8b4c45cb81145a5fc340f7c8213f901
MD5 99a9271a9b569ee8325a63c5770c5a19
BLAKE2b-256 b7281d5be998c7845aee0f5c796e6af1c4b9b0b0c08dc67b9a3b9717cb7b82fe

See more details on using hashes here.

File details

Details for the file acl_core_py-1.9.6-py3-none-any.whl.

File metadata

  • Download URL: acl_core_py-1.9.6-py3-none-any.whl
  • Upload date:
  • Size: 34.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for acl_core_py-1.9.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6213bb8e8ba2f181c7484d8ea7f06eb01ef5250f3702f2d16e43cf7c14c16472
MD5 725b17e02ab2d97c9874819f004c32f8
BLAKE2b-256 9c4f0466fe043505612d5d5ad013fcf64605fc0cf24a60cc234ccd998148c3bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page