Skip to main content

redberry-sdk

Records an AI agent's model and tool calls with OpenTelemetry and sends them to the customer's own Redberry install. Redberry uses these records to keep a tamper-evident evidence chain for each agent and to price its risk.

The SDK sends only to the Redberry install in your own cloud account (or to an endpoint you set). It does not send anything to Redberry directly.

Install

pip install redberry-sdk                    # core
pip install "redberry-sdk[providers]"       # plus instrumentation for model providers (OpenAI, Anthropic, ...)
pip install "redberry-sdk[all]"             # providers, agent frameworks and vector databases

Python 3.11 or later.

Extra Installs instrumentation for
providers OpenAI, Anthropic, Amazon Bedrock, Cohere, Mistral, Ollama, Vertex AI, Google GenAI, Groq, Together, Replicate
frameworks LangChain, LlamaIndex, CrewAI, Haystack, OpenAI Agents SDK
vectordb Chroma, Pinecone, Qdrant, Weaviate
openai-agents the OpenAI Agents SDK itself, for its valp.* integration
hasher the optional per-run signing path

Quick start

import redberry_sdk

redberry_sdk.init(agent="refund-agent")   # your agent's name, as you will approve it in the Redberry portal

Call init() once, before the agent makes its first model call. Model calls made through supported libraries are then recorded automatically.

Serverless functions (AWS Lambda, Azure Functions, Cloud Run functions) can be frozen as soon as a request returns. Flush before returning:

@redberry_sdk.flush_after
def handler(event, context):
    ...

or call redberry_sdk.flush() yourself.

Temperature. Redberry prices an agent from its sampled behaviour, so the agent's model calls must run at temperature 1.0.

Where records go

On these platforms the SDK finds your install automatically and authenticates with the platform's own identity; no keys are needed:

Platform How the install is found Authentication
Google Cloud (Cloud Run services, jobs, functions) the install in the same project the service account's ID token
AWS (Lambda, ECS) s3://redberry-<account>-<region>/ingest.json AWS Signature Version 4 with the role's credentials
Azure (Functions, Container Apps) the Redberry API, by the managed identity the managed identity's Entra ID token

Elsewhere, set the ingest address explicitly.

Environment variable Meaning
REDBERRY_INGEST_URL the install's ingest address (overrides discovery)
REDBERRY_CLOUD gcp, aws or azure, when it cannot be detected
REDBERRY_API_URL the Redberry API (Azure discovery)
REDBERRY_AZURE_APP_ID_URI Redberry's application ID URI in Entra ID, if not the default
REDBERRY_GCP_REGION the install's region on Google Cloud, when it cannot be detected
REDBERRY_OTEL_ENDPOINT an OTLP/HTTP endpoint to send to instead (for testing)
REDBERRY_DISCOVERY_RETRY_S how often, in seconds, finding the install is tried again after it failed (default 300)
REDBERRY_AUTH_RETRY_S how long a refused batch is retried while access is being granted (default 300)
REDBERRY_AGENT_ID the agent's name, if not passed to init()
REDBERRY_ALLOW_MISSING_INSTRUMENTATION 1 to start even when a library's instrumentation is not installed
REDBERRY_ALLOW_CONTENT_CAPTURE_OFF 1 to record metadata only, deliberately
REDBERRY_MAX_REQUEST_SNAPSHOT_BYTES the largest request recorded verbatim

Settings can also be placed in a .env file next to the agent. Settings from earlier versions of the SDK, under a different prefix, are still accepted.

Records the SDK could not deliver are counted by redberry_sdk.dropped_spans().

When records cannot be delivered

The SDK never stops your agent. When it cannot find your install, it logs an error naming the cause and keeps trying every 5 minutes; as soon as the cause is fixed, records are sent again, with no restart or redeploy.

Code Cause Fix
RB-SDK-DISC-001 On Google Cloud, the metadata server reports no region (Compute Engine, GKE) Set REDBERRY_GCP_REGION to the region of your install
RB-SDK-DISC-002 On AWS, the install's ingest.json could not be read Check that the install ran in this account and region, and that this function was chosen as an agent (run the install again and select it)
RB-SDK-DISC-003 On Azure, the install could not be found Check that the app has a managed identity and was chosen as an agent (run the install again and select it)
RB-SDK-DISC-004 The agent is named, but not on Google Cloud, AWS or Azure, and no endpoint is set Set REDBERRY_INGEST_URL

License

Apache License 2.0. See LICENSE and NOTICE.

Metadata

Release files for redberry-sdk 0.2.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 redberry-sdk 0.2.0
File Size Uploaded Provenance Actions
redberry_sdk-0.2.0.tar.gz 105.6 kB With provenance Details for redberry_sdk-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for redberry-sdk 0.2.0
File Interpreter ABI Platform Actions
redberry_sdk-0.2.0-py3-none-any.whl Python 3 none any Details for redberry_sdk-0.2.0-py3-none-any.whl

Total release size: 228.2 kB

Release files / redberry_sdk-0.2.0.tar.gz

Download URL redberry_sdk-0.2.0.tar.gz
Size 105.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6be84e851f0f1fb07c661b2ec342529253a4fe6781301742af08dd6cf6c470d0
BLAKE2b-256 checksum
How to use checksums
04ed8c91b6e3430e6548afc555a888042de2d0de25bce2a3a3a5f22af5db0b12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / redberry_sdk-0.2.0-py3-none-any.whl

Download URL redberry_sdk-0.2.0-py3-none-any.whl
Size 122.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3ade487cf6ff3c2cf0fa592d365c957f77633dde36a168f2d6aeabca7e1ab68
BLAKE2b-256 checksum
How to use checksums
2392f380c66cca57b453779a441ebd8501e7cb842d18bf4c488bb74158b05a86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for redberry-sdk 0.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for redberry_sdk-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

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

0.2.0 This release

2 release files Full 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