Skip to main content

rends-agent-sdk

PyPI version Python versions License: MIT Docs

Runtime governance for AI agents. A small async SDK that wraps tool calls with synchronous policy enforcement, hash-chained audit logging, and compliance evidence — backed by the Rends platform.

result = await client.govern(action, tool_fn=lambda p: db.query(p["q"]))
# → policy checked, decision logged, tool runs only if allowed

If the action violates policy, the tool function is never invoked and a GovernanceBlockError is raised. Every decision lands in a hash-chained audit trail that satisfies EU AI Act Article 12 logging requirements.

Looking for TypeScript? See @rends/agent-sdk on npm (source).

Install

pip install rends-agent-sdk

# With optional framework adapters
pip install "rends-agent-sdk[langchain]"
pip install "rends-agent-sdk[crewai]"
pip install "rends-agent-sdk[autogen]"
pip install "rends-agent-sdk[all]"

Requires Python ≥ 3.10.

Quick start

import os
from rends_sdk import RendsClient, RendsClientConfig, ActionContext

async with RendsClient(RendsClientConfig(
    api_key=os.environ["RENDS_API_KEY"],     # 'ac_live_...'
    org_id=os.environ["RENDS_ORG_ID"],
    agent_id=os.environ["RENDS_AGENT_ID"],
    mode="enforce",                          # 'enforce' | 'monitor' | 'dry-run'
)) as client:
    result = await client.govern(
        ActionContext(
            action_type="database_query",
            action_name="select_users",
            resource_type="customer_records",
            input_summary="SELECT * FROM users WHERE region = us-east-1",
            metadata={"data_classification": "pii"},
        ),
        tool_fn=lambda params: db.query(
            "SELECT * FROM users WHERE region = $1", params["region"]
        ),
    )

# result.allowed                       — bool
# result.status                        — CheckStatus.PASS / WARN / BLOCK
# result.result                        — the tool's return value (None if blocked)
# result.check.violations              — rules that returned severity=block
# result.telemetry_action_id           — id of the audit-trail row

You can sign up for an API key at rends.ai/sign-up.

Enforcement modes

Mode Behavior
enforce block → raises GovernanceBlockError; pass/warn → tool executes
monitor All decisions logged; nothing blocked, except an agent stopped by the kill switch
dry-run Policy checked, tool not executed, telemetry not sent

monitor is the safe rollout default — turn enforcement on once you've reviewed a few days of decisions in the dashboard.

Kill switch

When an agent is paused or terminated in Rends, its checks are refused and govern() raises AgentStoppedError (a GovernanceBlockError) in enforce and monitor mode, so the tool does not run. Once the agent is resumed, its checks are decided normally again.

Verified against production on 2026-10-30 with this release: paused agent → AgentStoppedError ("Agent is paused (kill switch); the action was not run") in enforce and monitor, tool not run; resumed → allowed, tool ran; terminated → AgentStoppedError, tool not run.

Framework adapters

All five adapters are reachable from rends_sdk.adapters. Each wraps a framework-native tool/function so the agent can keep using its idiomatic API while enforcement runs underneath.

LangChain

from rends_sdk.adapters import govern_tools, RendsCallbackHandler

governed = govern_tools(client, [search, calculator], resource_type="tool")
agent = create_react_agent(llm, tools=governed)

# Or attach a callback for monitor-only telemetry on existing tools:
agent.invoke({"input": "..."}, config={"callbacks": [RendsCallbackHandler(client)]})

→ LangChain integration (if available; see API ref otherwise)

CrewAI

from rends_sdk.adapters import govern_crewai_tool

search = SerperDevTool()
governed = govern_crewai_tool(client, search, resource_type="web_search")
agent = Agent(tools=[governed], ...)

AutoGen

from rends_sdk.adapters import govern_autogen_tool

def search_web(query: str) -> str:
    return tavily.search(query)

governed = govern_autogen_tool(client, search_web, "search_web", resource_type="web_search")
agent.register_function(function_map={"search_web": governed})

OpenAI Agents SDK

from agents import Agent, function_tool
from rends_sdk.adapters import govern_openai_tool

@function_tool
def search_web(query: str) -> str:
    return tavily.search(query)

govern_openai_tool(client, search_web, resource_type="web_search")
agent = Agent(name="Assistant", tools=[search_web])

→ OpenAI Agents SDK integration

Google ADK

from rends_sdk.adapters import govern_adk_tools, RendsADKCallback

governed = govern_adk_tools(client, tools, resource_type="tool")
agent = LlmAgent(name="assistant", tools=governed)

→ Google ADK integration

OpenTelemetry

The SDK ships an OTel adapter that emits a span per governance decision with attributes you can pivot on in any OTLP backend (Jaeger, Datadog, Grafana Tempo, Honeycomb).

from opentelemetry import trace
from rends_sdk.adapters import RendsOtelTracer

tracer = trace.get_tracer("my-app")
RendsOtelTracer(tracer).instrument(client)

# Every govern() call now emits a span automatically.

Span attributes: rends.action_type, rends.action_name, rends.resource_type, rends.status (allowed/blocked/failed), rends.risk_level, rends.duration_ms, rends.org_id, rends.agent_id, rends.framework. Policy violations are recorded as policy.violation span events.

opentelemetry-api is an optional dependency — install it only if you want OTel:

pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp-proto-http

→ OpenTelemetry integration docs

Pipeline

Every govern() call runs five stages:

  1. beforeAction — validates the action shape, computes a SHA-256 input hash.
  2. policyCheck — POST /v1/compliance/check-action (synchronous, ≤ timeout_s).
  3. decisionReturn — parses { allowed, status, violations, warnings }.
  4. executionGate — runs the tool when allowed; raises GovernanceBlockError otherwise (in enforce).
  5. telemetryEmit — POST /v1/telemetry/ingest writes a hash-chained row to the audit trail.

Decisions are Redis-cached on the platform side for sub-50ms p95 latency on the hot path.

API reference

RendsClientConfig

Field Type Default Description
api_key str required API key (ac_live_...)
org_id str required Organization UUID
agent_id str required Agent UUID registered in Deploy
endpoint str https://rends.ai/api/v1 Platform API base URL
mode EnforcementMode ENFORCE enforce / monitor / dry-run
timeout_s float 10.0 Policy-check timeout per call
retries int 2 Retry count for transient failures
fail_open bool False Allow action if policy check errors
on_decision Callable None Fires after every decision
on_error Callable None Fires on SDK-level errors
headers dict[str, str] {} Extra HTTP headers

ActionContext

Field Type Max Description
action_type str 200 Category — tool_call, api_request, data_access, …
action_name str 500 Specific action — database_query, send_email
resource_type str 200 Target — customer_records, email_server
input_summary str 8000 Free-text description of the input
metadata dict — Extra context (sent with telemetry, not policy check)
policy_attributes dict[str, str | int | float | bool] 16 keys Authority add-on: attributes such as amount, currency. Sent only when set (as policyAttributes).
transaction_id str (uuid) — Marks the action as a step of one business transaction. Sent only when set.

Authority fields, today. The production API accepts policy_attributes and transaction_id (verified 2026-10-30: HTTP 200, no error). In the org tested, a check with {"amount": 1, "currency": "USD"} and a transaction_id returned the same decision as without them, and the response carried no authority block. Whether a decision uses them depends on the org's Authority configuration; that path has not been verified in production with this release.

Errors

All exported from rends_sdk:

  • GovernanceBlockError — raised in enforce mode when policy denies the action.
  • GovernancePendingError — a GovernanceBlockError raised when the action is held for human approval; carries decision_id for client.resume().
  • AgentStoppedError — a GovernanceBlockError raised in enforce and monitor mode when the agent is paused or terminated (kill switch).
  • PolicyCheckTimeoutError — raised when timeout_s is exceeded and fail_open=False.
  • ApiError — non-2xx response from the platform.
  • ConfigError — invalid client configuration.
  • RendsError — base class.

Pre-flight check

Want to inspect the policy decision without running the tool?

check = await client.policy_check(ActionContext(
    action_type="data_export",
    action_name="export_pii",
    resource_type="user_data",
    input_summary="Export all PII to CSV",
))
# check.allowed, check.status, check.violations

Documentation

Contributing

Issues and pull requests welcome. See CONTRIBUTING.md.

License

MIT © 2026 Rends AI

Metadata

Release files for rends-agent-sdk 2.0.0

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

Source distribution (sdist)

Source distribution for rends-agent-sdk 2.0.0
File Size Uploaded Provenance Actions
rends_agent_sdk-2.0.0.tar.gz 42.7 kB Without provenance Details for rends_agent_sdk-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rends-agent-sdk 2.0.0
File Interpreter ABI Platform Actions
rends_agent_sdk-2.0.0-py3-none-any.whl Python 3 none any Details for rends_agent_sdk-2.0.0-py3-none-any.whl

Total release size: 84.7 kB

Release files / rends_agent_sdk-2.0.0.tar.gz

Download URL rends_agent_sdk-2.0.0.tar.gz
Size 42.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3f73bd3388602dd12d7854159a22c147db0de26d72a8b60e8f2648849d9b0548
BLAKE2b-256 checksum
How to use checksums
9eb40bdcd56f8041ccfe636b2a0c7aac65fecb547229b2336eb2138280e424e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / rends_agent_sdk-2.0.0-py3-none-any.whl

Download URL rends_agent_sdk-2.0.0-py3-none-any.whl
Size 42.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7562b93971b06db2e09d3376f09419c05b6ef7a1993d80a3df23f027307a5d76
BLAKE2b-256 checksum
How to use checksums
bd8ec3b37ef6f5d8b625ea71921d329f0598b98e4ca9a01d6320b2e8911c0820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for rends-agent-sdk 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

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