Skip to main content

Decision intelligence layer for AI agents — Layerinfinite

Project description

Layerinfinite Python SDK

Layerinfinite is a decision intelligence middleware for AI agents — it records action outcomes, computes composite trust scores, and recommends the highest-performing next action so your agents learn from every decision. Drop it between any LLM agent and your production infrastructure in minutes.

Installation

pip install layerinfinite-sdk

Quick Start

from layerinfinite import LayerinfiniteClient, LogOutcomeRequest

client = LayerinfiniteClient(api_key="layerinfinite_your_key")

# Ask Layerinfinite which action to take
scores = client.get_scores(
    agent_id="my-agent",
    issue_type="billing_dispute"
)
print(scores.top_action.action_name)   # e.g. "escalate_to_senior"
print(f"Policy: {scores.policy}")      # exploit | explore | escalate

# Log the outcome after the action runs
client.log_outcome(LogOutcomeRequest(
    agent_id="my-agent",
    action_id=scores.top_action.action_id,
    context_id=scores.context_id,
    issue_type="billing_dispute",
    success=True,
    outcome_score=0.9,
    business_outcome="resolved"
))

Context Manager

with LayerinfiniteClient(api_key="layerinfinite_your_key") as client:
    scores = client.get_scores(agent_id="agent-1", issue_type="payment_failed")
    # Session is automatically closed on exit

LangChain Integration

from layerinfinite import LayerinfiniteClient, LogOutcomeRequest
from langchain_core.tools import tool

layerinfinite = LayerinfiniteClient(api_key="layerinfinite_your_key")

@tool
def resolve_ticket(agent_id: str, issue_type: str) -> str:
    """Resolve a support ticket using Layerinfinite-guided action."""
    scores = layerinfinite.get_scores(agent_id=agent_id, issue_type=issue_type)
    action = scores.top_action.action_name
    # ... run the action ...
    layerinfinite.log_outcome(LogOutcomeRequest(
        agent_id=agent_id,
        action_id=scores.top_action.action_id,
        context_id=scores.context_id,
        issue_type=issue_type,
        success=True, outcome_score=0.85, business_outcome="resolved"
    ))
    return action

Error Handling

from layerinfinite import LayerinfiniteClient, LayerinfiniteAuthError, LayerinfiniteRateLimitError
import time

client = LayerinfiniteClient(api_key="layerinfinite_your_key")
try:
    scores = client.get_scores(agent_id="agent-1", issue_type="billing")
except LayerinfiniteAuthError:
    print("Invalid API key — check LAYERINFINITE_API_KEY")
except LayerinfiniteRateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")
    time.sleep(e.retry_after)

Configuration

Parameter Default Description
api_key required Your Layerinfinite API key
base_url https://your-app.railway.app API base URL
timeout 10.0 Request timeout in seconds
max_retries 3 Max retries on 429/5xx

Links

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

layerinfinite_sdk-0.1.6.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

layerinfinite_sdk-0.1.6-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file layerinfinite_sdk-0.1.6.tar.gz.

File metadata

  • Download URL: layerinfinite_sdk-0.1.6.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for layerinfinite_sdk-0.1.6.tar.gz
Algorithm Hash digest
SHA256 3fd34c69200ae86a1d83a4ad16f191c1491244182f0e28e5532476e2e61ba270
MD5 e718a1aa5b68883d1a724972810d533a
BLAKE2b-256 f4a2855ae2bdc719bd86614f564978764aa5243951d12bcfc28261496e7fc36b

See more details on using hashes here.

File details

Details for the file layerinfinite_sdk-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for layerinfinite_sdk-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b3c587a669f1159bb2826c26ef13c4fed19f447cf3c22a0891756652ab31f2bf
MD5 c639cb687cae5464ebd3a7780b852ec8
BLAKE2b-256 0d31a389da361663b15f7f32698d1dae82eca3d4e5b416eb8d70d3abf34f3b30

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