Skip to main content

Python SDK for AgenticSettle — verify any AI agent's output, settle with pre-paid token escrow, earn the Verified badge.

Project description

agentic-settle

Python client SDK for the AgenticSettle Pro settlement engine.

A deliberately thin wrapper over the REST API so AI-native applications can spend less than 30 seconds wiring up on-chain settlement for their agents.

pip install agentic-settle

Quickstart (synchronous)

import os
from agentic_settle import SettleClient

client = SettleClient(
    base_url="https://api.agenticsettle.io",
    api_key=os.environ["AGENTIC_SETTLE_API_KEY"],
)

receipt = client.settle(
    agent_id="gpt-4o",
    request_content="What is the capital of France?",
    result_content="Paris",
    target_wallet="0x0000000000000000000000000000000000000000",
)

print(receipt.status, receipt.chain_tx_hash)

Quickstart (asyncio)

import asyncio
from agentic_settle import AsyncSettleClient

async def main() -> None:
    client = AsyncSettleClient(api_key="...")
    receipt = await client.settle(
        agent_id="claude-3.5",
        request_content="...",
        result_content="...",
        target_wallet="0x...",
    )
    print(receipt)

asyncio.run(main())

Environment variables

The client falls back to the following env vars when constructor arguments are omitted:

Variable Purpose
AGENTIC_SETTLE_BASE_URL Base URL of the settlement service
AGENTIC_SETTLE_API_KEY API key (preferred)
BRUCE_SECRET_KEY Legacy fallback for local dev convenience

VOP Layer 0 — embed verification in the agent loop

Instead of bolting verification on after the fact, the VOP façade embeds it inside the agent execution loop: one call drives verification → settlement decision → feedback, and (when you pass an agent callable) the FAIL → retry → refund ladder. It is dependency-free and deterministic over an injectable verify_fn — wire verify_fn to SettleClient.verify in production, or pass a stub in tests.

from agentic_settle import VOP, Task, Criteria, RetryPolicy

vop  = VOP(verify_fn=client.verify)            # verify_fn(req, res, sla) -> verdict dict
task = Task(
    id="t1",
    description="Draft a customer outreach email",
    criteria=Criteria(sla={"min_words": 50}),
)

result = my_agent(task)                          # your code produces the result
out = vop.verify(task=task, result=result,
                 retry_policy=RetryPolicy(max_retries=2))

if out.status == "PASS":
    ...                                          # out.decision == "SETTLE"
elif out.status == "PARTIAL":
    print(out.feedback.summary)                  # out.decision == "PARTIAL_SETTLE"
else:
    ...                                          # RETRY / REFUND / ESCALATE / FAIL_FINAL

A2A (agent-to-agent) chains

TaskChain runs a pipeline of agents where each step is VOP-verified before the chain proceeds. The weakest verified step bounds the chain payout.

from agentic_settle import VOP, TaskChain, ChainStep, Criteria

chain = TaskChain(steps=[
    ChainStep(id="research", description="Gather sources", agent=research_agent,
              criteria=Criteria(sla={"min_sources": 3})),
    ChainStep(id="draft",    description="Write the draft", agent=writing_agent,
              criteria=Criteria(sla={"min_words": 200})),
])
chain_result = VOP(verify_fn=client.verify).execute_chain(chain)
print(chain_result.status, chain_result.settlement_bps)

Framework integrations (optional extras)

VOP ships as optional-import plugins for popular agent frameworks. The core install pulls neither LangChain nor AutoGen — install an extra only when you wire the matching adapter into a live run:

pip install "agentic-settle[langchain]"   # VOPCallback
pip install "agentic-settle[autogen]"     # with_vop / VOPVerifiedAgent
pip install "agentic-settle[all]"         # both
# LangChain — verify an LLM/chain's final output as it is produced
from langchain_openai import ChatOpenAI
from agentic_settle.vop import VOP, Task, Criteria
from agentic_settle.integrations import VOPCallback

vop = VOP(verify_fn=client.verify)
cb  = VOPCallback(vop=vop, task=Task(id="t1", description=prompt,
                                     criteria=Criteria(sla={"min_words": 50})))
llm = ChatOpenAI(callbacks=[cb])
llm.invoke(prompt)
print(cb.result.decision)                  # SETTLE | REFUND | ...
# AutoGen — VOP-verify each generated reply
from agentic_settle.vop import VOP, Task, Criteria
from agentic_settle.integrations import with_vop

vop     = VOP(verify_fn=client.verify)
guarded = with_vop(my_reply_fn, vop=vop,
                   task=Task(id="t1", description=prompt, criteria=Criteria(sla={...})))
reply, result = guarded(messages)          # result is a VOPResult

Both modules import without their framework installed (they degrade to a plain base / plain callable), so they stay unit-testable with a stub verify_fn.

What's in the box

  • SettleClient — synchronous client (httpx under the hood)
  • AsyncSettleClient — asyncio variant for high-throughput agents
  • SettleRequest — request payload model (pydantic v2)
  • SettleReceipt — response receipt model (pydantic v2)
  • VOP / Task / Criteria / RetryPolicy / VOPResult — Layer 0 verification façade
  • TaskChain / ChainStep — A2A chain settlement
  • integrations.VOPCallback (LangChain), integrations.with_vop / VOPVerifiedAgent (AutoGen)

Type annotations ship with py.typed.

License

Apache-2.0

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

agentic_settle-1.0.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

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

agentic_settle-1.0.0-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file agentic_settle-1.0.0.tar.gz.

File metadata

  • Download URL: agentic_settle-1.0.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for agentic_settle-1.0.0.tar.gz
Algorithm Hash digest
SHA256 56bd44b08a55c567e917a9b6c7f2f5c7d2a0645df142db5e8942aed1744b2874
MD5 1ffa23e6dee1393b6005a690869d290d
BLAKE2b-256 9766d474a20b40aed59c84e6dfe9e2da94f9a36e42402f8371136b126f96f1e0

See more details on using hashes here.

File details

Details for the file agentic_settle-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: agentic_settle-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for agentic_settle-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9bdd763a4a39d447701b4ab85fe9e328944e0c9d7c8f7589ac41d6f184e8b4ab
MD5 a6f1648a993d67d25fd88be202755498
BLAKE2b-256 fb94de9d0e2606e6eb8ba1510d648e5897b54a088f809a8e9a122b78e1e85090

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