Skip to main content

Behavioral Firewall and Cryo-Sleep State Parking for AI Agents

Project description

LetsPing Python SDK

PyPI version License: MIT Python Versions

The official state management infrastructure for Human-in-the-Loop (HITL) AI agents.

LetsPing is a behavioral firewall and governance layer. It provides mathematically secure state-parking (Cryo-Sleep) and execution governance for autonomous agents built on frameworks like LangGraph, CrewAI, and custom architectures.

Features

  • The Behavioral Shield: Silently profiles your agent's execution paths via Markov Chains. Automatically intercepts 0-probability reasoning anomalies (hallucinations/prompt injections).
  • Cryo-Sleep State Parking: Pauses execution and securely uploads massive agent states directly to storage using Signed URLs, entirely bypassing serverless timeouts and webhook payload limits.
  • Smart-Accept Drift Adaptation: Approval decisions mathematically alter the baseline. Old unused reasoning paths decay automatically via Exponential Moving Average (EMA).

Installation

pip install letsping

Configuration

Set your API key as an environment variable (recommended) or pass it directly.

export LETSPING_API_KEY="lp_live_..."

Usage

1. The "Ask" Primitive (Blocking)

Use this when you want to pause a script until a human approves.

from letsping import LetsPing

client = LetsPing()

# Pauses here for up to 24 hours (default)
decision = client.ask(
    service="payments-agent",
    action="transfer_funds",
    payload={
        "amount": 5000,
        "currency": "USD",
        "recipient": "acct_99"
    },
    priority="critical"
)

# Execution resumes only after approval
print(f"Transfer approved by {decision['metadata']['actor_id']}")

2. Async / Non-Blocking (FastAPI/LangGraph)

For high-concurrency environments or event loops.

import asyncio
from letsping import LetsPing

async def main():
async def main():
    client = LetsPing()
    
    # Non-blocking wait, with massive state snapshot
    # The state is AES-GCM encrypted and direct-uploaded to S3, bypassing payloads
    decision = await client.aask(
        service="github-agent",
        action="merge_pr",
        payload={"pr_id": 42},
        timeout=3600, # 1 hour timeout
        state_snapshot=graph.get_state()
    )

asyncio.run(main())

3. LangChain / Agent Integration

LetsPing provides a compliant tool interface that can be injected directly into LLM agent toolkits (LangChain, CrewAI, etc). This allows the LLM to decide when to ask for help.

from letsping import LetsPing

client = LetsPing()

tools = [
    # ... your other tools (search, calculator) ...
    
    # Inject the human as a tool
    client.tool(
        service="research-agent",
        action="review_draft",
        priority="high"
    )
]

Error Handling

The SDK uses typed exceptions for control flow.

  • ApprovalRejectedError: Raised when the human explicitly clicks "Reject".
  • TimeoutError: Raised when the duration (default 24h) expires without a decision.
  • LetsPingError: Base class for API or network failures.

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

letsping-0.1.6.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

letsping-0.1.6-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for letsping-0.1.6.tar.gz
Algorithm Hash digest
SHA256 c7d1520d9b3747a5429a09fd257c526ced8093fda0be4e14c56319ec1c5969ac
MD5 bc54cdd67c58d3a9a342b2487d5c135b
BLAKE2b-256 36086f065694d18da483dff524a30f8938f4f01792c263e8dbec6ff5ec372958

See more details on using hashes here.

File details

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

File metadata

  • Download URL: letsping-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for letsping-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b11a93eae99e8438ad9d2df3814e7c25b37060c92b7185721eb3ac3e0b5a4db0
MD5 a013e978576e667137b079eb324c011a
BLAKE2b-256 2d749cdbb1e21311dc1212ff0863f7c1b5e05f5cb493691e671b26dd5423a866

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