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.5.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.5-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: layerinfinite_sdk-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 ca8a9e2659a9fa32c04198b791f4309f37b5dfa2a3f8a8a945f3c8a1c14baf94
MD5 70557c9c9220f8632b778ce9647fbfaf
BLAKE2b-256 c411fc8783521748be17c91d1367e083b364b5dbc78f17b086e30f5f2be26965

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for layerinfinite_sdk-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 46f6de79f6f457b766f1181855524a09d49681ec20beafe1a29c7003818ec5ad
MD5 5caba6137c6894bf69821844b59edaf8
BLAKE2b-256 c0b89ed556452b27cf728509bdffc76311d83d62fc5462e78aeea65ffc1d86dd

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