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.1.tar.gz (7.4 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.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for layerinfinite_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1c90e33111e7312921a23674328cce85314a83e4b6aa058b3e82414a12cda39a
MD5 a22220fd6823576cccdbeebf15ae5c22
BLAKE2b-256 ebc7e891714caa603b171a8a7748dcb2a2f014286175635778eb41077489e06f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for layerinfinite_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 32ca205aca29694d4a283488d4f7756d6dd97854a31019a9f350f6dec7d52dce
MD5 6c60e9dfb145d4620abb23211e82d52b
BLAKE2b-256 200919ba6a17b8444635639a2790bbeeea97230732ca472ab7f04a4cdc931601

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