Skip to main content

moltrust-adk

Trust verification interceptor for Google ADK — gate outbound Agent-to-Agent (A2A) calls on a target agent's MolTrust trust score using ADK's RequestInterceptor hook.

When a RemoteA2aAgent is about to call a remote agent, this interceptor checks the remote's 0–100 behavioral trust score at GET /skill/trust-score/{did} and — in block mode — aborts the call (returning an ADK Event) if the score is below your threshold.

Install

pip install moltrust-adk

This pulls google-adk[a2a] (the A2A extra provides the RemoteA2aAgent / RequestInterceptor machinery).

Usage

from google.adk.agents import RemoteA2aAgent
from google.adk.a2a.agent.config import A2aRemoteAgentConfig
from moltrust_adk import create_trust_interceptor

agent = RemoteA2aAgent(
    name="my-remote-agent",
    agent_card="https://example.com/.well-known/agent.json",
    config=A2aRemoteAgentConfig(
        request_interceptors=[
            create_trust_interceptor(
                did="did:moltrust:...",   # target remote agent's DID
                min_score=60,
                action="block",           # "block" | "warn" | "log"
            )
        ]
    ),
)

create_trust_interceptor returns an ADK RequestInterceptor whose before_request hook runs before every A2A send_message.

What it does

  • block — if the target's score is < min_score, is withheld, or the agent is unregistered, the interceptor returns an Event and the remote call never happens (fail-closed). A high enough score passes the request through unchanged.
  • warn / log — never blocks; emits a warning / info log on a negative check (dry-run / observability mode).
  • Fail-open on errors — a MolTrust transport/registry hiccup allows the call (a monitoring dependency must not break your agent graph).

Target identity (DID)

The outbound A2AMessage does not carry the remote's identity, so the target did is supplied at wiring time (you know which remote you're calling). Alternatively, pass did_key="..." to read it from a2a_request.metadata[...].

Tiers — keyless by default

  • Tier 1 (keyless): no API key required (rate-limited). This is the default.
  • Tier 2 (free account): pass api_key=... (or set MOLTRUST_API_KEY) for higher rate limits — sent as the X-API-Key header.

Every request carries User-Agent: moltrust-adk/<version> so MolTrust can attribute traffic to this integration.

Trust score vs. AGT

The trust score (0–100) is a recomputable behavioral signal — its on-chain solvency component is independently verifiable at /credits/solvency/{did}. It is not the AGT token; no token is required to read a score.

⚠️ Experimental

RemoteA2aAgent and the RequestInterceptor API are marked @a2a_experimental in google-adk — the API may change between ADK releases. Pin your google-adk version if you need stability.

License

MIT — see LICENSE.

Metadata

Release files for moltrust-adk 0.1.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 moltrust-adk 0.1.0
File Size Uploaded
moltrust_adk-0.1.0.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moltrust-adk 0.1.0
File Interpreter ABI Platform
moltrust_adk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.8 kB

Release files / moltrust_adk-0.1.0.tar.gz

Download URL moltrust_adk-0.1.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f96c5529f4c0b4d8a4b1515b217c92caab76519f54cde29686fcec451aa74e2f
BLAKE2b-256 checksum
How to use checksums
48767192f9d86ce14150aa86f64dc52ed6e9b3f8fe75a34bafdd5a26b8e71d3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / moltrust_adk-0.1.0-py3-none-any.whl

Download URL moltrust_adk-0.1.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbc849603162927cad22eea2702332648c0880752a494df0d6f4ff79e1f0db0a
BLAKE2b-256 checksum
How to use checksums
b77ec4c2d627290474c91f65e9ce47da689e9717cdd6a62815ddf80b4b1d625b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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