Skip to main content

entropy0

Python SDK for Entropy0 — pre-ingestion source trust for AI agents.

pip install entropy0

What it does

Entropy0 evaluates source-level infrastructure signals before an agent fetches an external URL. One call before requests.get() or httpx.get() returns whether the source is allowed to fetch under your selected policy.

Quick start

import os
from entropy0 import Entropy0Client

client = Entropy0Client()  # reads ENTROPY0_API_KEY from env

result = client.decide("github.com")
print(result.action)          # "proceed"
print(result.scores.trust)    # 96
print(result.should_fetch)    # True

result = client.decide("githvb.com")
print(result.action)          # "deny"
print(result.reason_codes)    # ["BRAND_MISMATCH", "NEWLY_REGISTERED_DOMAIN"]
print(result.should_fetch)    # False

Get an API key at entropy0.ai/signup. The Developer plan is free.

Actions

Action Meaning
proceed Source infrastructure posture is consistent with normal automated interaction
proceed_with_caution Acceptable; keep interaction read-only
sandbox Elevated signals; interact only in a constrained environment
escalate_to_human Ambiguous or high-risk; request human review
deny Infrastructure posture is inconsistent with safe automated interaction

result.should_fetch is True for proceed and proceed_with_caution. result.is_allowed and result.is_safe are aliases for the same check.

should_fetch / is_allowed / is_safe reflect whether the recommended action allows automated fetch under the selected policy. They are not a guarantee that the source or page content is safe.

Usage

Sync client

from entropy0 import Entropy0Client

with Entropy0Client(api_key="sk_ent0_...") as client:
    result = client.decide("example.com")
    if result.should_fetch:
        # fetch the URL
        ...
    else:
        print(f"Blocked ({result.action}): {result.reason_codes}")

Async client

from entropy0 import AsyncEntropy0Client

async with AsyncEntropy0Client() as client:
    result = await client.decide("example.com")

Batch

results = client.batch(["github.com", "githvb.com", "pypi.org"])
for r in results:
    print(r.target_value, r.action, r.scores.trust)

URL evaluation (Team+ plans)

decide_url passes the full URL path to the API. On Developer/free plans it automatically falls back to domain evaluation.

result = client.decide_url("https://github.com/user/repo/raw/main/script.sh")

Interaction context

The defaults (fetch / read_only / medium / balanced) are suitable for most RAG pipelines. Override when needed:

result = client.decide(
    "example.com",
    interaction_kind="api_call",
    interaction_mode="read_write",
    interaction_sensitivity="high",
    policy_profile="strict",
)

LangChain example

from langchain_core.tools import tool
from entropy0 import Entropy0Client, SAFE_ACTIONS

_client = Entropy0Client()

@tool
def entropy0_decide(url: str) -> str:
    """
    Call this before fetching, reading, summarizing, citing, or acting on
    any external URL or domain. If the returned action is not 'proceed' or
    'proceed_with_caution', do NOT call fetch_url — report the action and
    reason_codes to the user instead.
    """
    result = _client.decide(url)
    return (
        f"action={result.action} trust={result.scores.trust} "
        f"threat={result.scores.threat} reason_codes={result.reason_codes}"
    )

Error handling

from entropy0 import Entropy0Client, AuthenticationError, RateLimitError, APIError

try:
    result = client.decide("example.com")
except AuthenticationError:
    # bad or missing API key
    ...
except RateLimitError as e:
    # e.retry_after is seconds until reset (if provided by the API)
    ...
except APIError as e:
    # e.status_code for the HTTP status
    ...

Links

Release files for entropy0 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for entropy0 0.1.3
File Size Uploaded
entropy0-0.1.3.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for entropy0 0.1.3
File Interpreter ABI Platform
entropy0-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / entropy0-0.1.3.tar.gz

Download URL entropy0-0.1.3.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0473c831030c3a714213a5dc84f6d14e734dfc728cacc8e45a707ec1f3105152
BLAKE2b-256 checksum
How to use checksums
074907c62e47aad5f9d962a67c30fc70701958c6fc9bd6182c332ab496cd306c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / entropy0-0.1.3-py3-none-any.whl

Download URL entropy0-0.1.3-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d79bb54a06f8b1f263cfb4c3c4fd85fe78edc1ad3ef4b7a51cf640e09a258c9
BLAKE2b-256 checksum
How to use checksums
2c2695e867d91dc86b5d39787ba01732dd47142efc5c0c306a25a11c8688233f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page