Skip to main content

Python SDK for pushing AI-asset inventory snapshots to Trust3 AI governance.

Project description

trust3-ai-collector-sdk

Python SDK for pushing AI-asset inventory snapshots directly to Trust3 governance.

Describe your agents, tools, models, identities, and the relationships between them using a typed generic model. The SDK maps the snapshot to the governance bulk ingest format and POSTs it to the governance API.

  • Direct — pushes to the Trust3 governance bulk ingest API
  • Typed — closed enums prevent invalid asset or relationship kinds at construction time
  • Resilient — automatic retry on transport errors and 5xx responses
  • Idempotent — push a full snapshot every time; governance upserts, so re-sending is safe

Installation

pip3 install trust3-ai-collector-sdk

Requires Python ≥ 3.9 and a Trust3 governance API key. See the AI Assets Collector documentation for platform setup and credentials.


Quick start

import os
from trust3_ai_collector_sdk import (
    Asset, AssetKind, IdentityKind,
    InventoryClient, InventoryClientConfig,
    InventorySnapshot,
    Relationship, RelationshipKind,
)

snap = InventorySnapshot(
    source="my_platform",
    account="prod.example.com",
    vendor="Acme Corp",
    product_name="My Platform",
    environment="prod",
)
snap.assets += [
    Asset(kind=AssetKind.AGENT, id="billing_agent", name="Billing Agent",
          owners=["ops-team@example.com"], provider="openai", model_name="gpt-4o"),
    Asset(kind=AssetKind.MODEL, id="openai:gpt-4o", name="GPT-4o", provider="openai"),
]
snap.relationships += [
    Relationship(kind=RelationshipKind.USES_MODEL,
                 from_id="billing_agent", from_kind=AssetKind.AGENT,
                 to_id="openai:gpt-4o", to_kind=AssetKind.MODEL),
]

config = InventoryClientConfig(
    api_server_host=os.environ["TRUST3_API_SERVER_HOST"],
    api_key=os.environ["TRUST3_API_KEY"],
)

with InventoryClient(config) as client:
    result = client.submit(snap)
    print(f"pushed {result.assets_pushed} assets, governance HTTP {result.governance_status}")

Set TRUST3_API_SERVER_HOST to your Trust3 API hostname (for example https://api.na.trust3ai.com) and TRUST3_API_KEY to your governance API key.


Configuration

config = InventoryClientConfig(
    api_server_host="https://api.na.trust3ai.com",
    api_key="your-trust3-api-key",
)
field description
api_server_host Trust3 API server base URL
api_key Your Trust3 governance API key

Error handling

from trust3_ai_collector_sdk.errors import InventoryValidationError, InventoryTransportError

try:
    result = client.submit(snap)
except InventoryValidationError as e:
    print(f"rejected (HTTP {e.status_code}): {e.response_text}")
except InventoryTransportError as e:
    print(f"failed after retries: {e}")

License

Proprietary software. Copyright Privacera, Inc. All rights reserved. Use is subject to your Trust3 AI agreement with Privacera.


Further reading

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

trust3_ai_collector_sdk-0.1.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file trust3_ai_collector_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for trust3_ai_collector_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0aef061c6ec2741358d6ef4caa42fcb18480f930c7603a2edc160a556cd8e9b
MD5 30b1a2f744f5ca27f2338aeb1d604394
BLAKE2b-256 05e50d5229cf2dede2c395b87e056316c55b164c9c1c1769b0ea4902da3f3462

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