Skip to main content

Official Python SDK for Ainfera — trust scoring and agent discovery for the AI agent economy. Powered by NVIDIA NIM and NeMo Guardrails.

Project description

ainfera-sdk

PyPI Python License

Official Python SDK for Ainfera — trust scoring and agent discovery for the AI agent economy.

Powered by NVIDIA NIM inference and NeMo Guardrails safety evaluation.

Install

pip install ainfera-sdk

Requires Python 3.10+.

Quick start

from ainfera_sdk import AinferaClient, TrustBadge

client = AinferaClient(api_key="your-api-key")

# Trust score
score = client.get_trust_score("research-agent")
print(f"{score.grade} {score.overall_score}")

# Search the marketplace (NIM-powered semantic search)
agents = client.search_agents("research assistant", min_trust=700)
for a in agents:
    print(f"  {a.name}{a.grade}")

# Embeddable trust badge
print(TrustBadge.markdown_badge("research-agent"))

The SDK reads AINFERA_API_KEY from the environment if no key is passed. The base URL can be overridden with AINFERA_API_URL or the base_url= kwarg.

Features

  • Trust scoring — get, evaluate, and track composite trust scores (AAA → CCC)
  • Agent discovery — semantic search powered by NVIDIA NIM embeddings
  • Trust badge — embeddable badge URLs (JSON, SVG, HTML, Markdown)
  • GitHub / CI integration — trust checks for PR gates
  • Framework-agnostic — works with LangChain, CrewAI, AutoGen, and custom agents

Flat interface (recommended)

client.get_trust_score(agent_id)                 # TrustScore
client.get_trust_history(agent_id, days=30)      # list[TrustHistoryEntry]
client.evaluate_trust(agent_id)                  # triggers NeMo Guardrails eval

client.search_agents(query, min_trust=700)       # list[PublicAgent]
client.get_agent(agent_id)                       # PublicAgent
client.publish_agent(agent_id)                   # PublicAgent
client.register_agent({...})                     # from ainfera.yaml

client.get_badge_url(agent_id, size="md")        # JSON badge URL
client.get_badge_svg(agent_id)                   # SVG URL
client.trust_check(agent_id, commit_sha="abc")   # TrustCheckResult

Async

import asyncio
from ainfera_sdk import AsyncAinfera

async def main() -> None:
    async with AsyncAinfera(api_key="...") as client:
        score = await client.trust.get_score("research-agent")
        print(score.grade, score.overall_score)

asyncio.run(main())

Resource-style interface (also available)

Resource What it does
client.trust Trust scores, history, anomalies, evaluate, CI check
client.registry Public marketplace search, publish, register
client.agents Owned-agent CRUD and lifecycle
client.execution Invoke agents and inspect execution runs
client.billing Billing overview and metered usage

Trust badge

from ainfera_sdk import TrustBadge

TrustBadge.svg_url("research-agent")
TrustBadge.markdown_badge("research-agent")
TrustBadge.html_snippet("research-agent", size="md")

Error handling

All non-2xx responses raise a typed exception inheriting from AinferaError.

from ainfera_sdk import AuthError, NotFoundError, RateLimitError, ServerError

try:
    client.get_trust_score("ag_missing")
except NotFoundError:
    ...
except AuthError:
    ...
Exception HTTP status
AuthError 401, 403
ValidationError 400, 422
NotFoundError 404
RateLimitError 429
ServerError 5xx
ApiError anything else non-2xx

Examples

See examples/:

Development

git clone https://github.com/ainfera-ai/sdk-python.git
cd sdk-python
pip install -e ".[dev]"

python -m pytest tests/ -v
ruff check ainfera_sdk/
mypy ainfera_sdk/ --strict
python -m build

Links

License

Apache-2.0. Copyright © Ainfera.

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

ainfera_sdk-0.2.0.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

ainfera_sdk-0.2.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file ainfera_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: ainfera_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ainfera_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7f7128578d1a6554008352b44d3d10892bfd484f156dc5f315977085da5884ef
MD5 155a0385d4166a464db98bf8e05f0f25
BLAKE2b-256 03e094b41d2aa1314bbab000d7aa64da0d50c75c7e66f5ad5c08fc3b85a27d4a

See more details on using hashes here.

File details

Details for the file ainfera_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ainfera_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ainfera_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc953d2e9168edf53de160a43e0e0e1d0c06b0178fc1164ac3e140e0075af00e
MD5 2a37140a395644df905a2bf3ff36c989
BLAKE2b-256 7f5838d5a5295368fda3c417b75bfd14538e52a13fab002d54919f984be0ec2a

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