PalveronPalveronDocs

Google ADK

AI governance for the Google Agent Development Kit — automatic policy checks for every tool call, model invocation, and A2A message, with multimodal-aware extraction and MCP context forwarding.

Google ADK Integration

Wire three callbacks into any LlmAgent. Every prompt Gemini sees, every tool the agent runs, and every result that flows back is governed by your Palveron policies. Multimodal-aware (text, image, audio, video). A2A-protocol compatible. MCP context preserved end-to-end.

Installation

pip install palveron-google-adk

Quickstart

from google.adk.agents import LlmAgent
from palveron_google_adk import PalveronAdkGovernance

gov = PalveronAdkGovernance(api_key="pv_live_xxx")

agent = LlmAgent(
    name="customer_support",
    model="gemini-2.0-flash",
    instruction="Help users with their orders.",
    tools=[lookup_order, refund_order],
    before_model_callback=gov.before_model_callback,
    before_tool_callback=gov.before_tool_callback,
    after_tool_callback=gov.after_tool_callback,
)

# Every model prompt, tool input, and tool output is now governed.
result = agent.run("Refund order #12345 for €50,000")
# → PalveronGovernanceError: Blocked — refund exceeds per-call budget policy

What Is Checked

CallbackWhenWhat
before_model_callbackBefore each Gemini callAll Content parts (text + multimodal attachments)
before_tool_callbackBefore each tool runsTool name + arguments
after_tool_callbackAfter each tool returnsTool result before it re-enters the model context

The after_tool_callback is the critical hop — it stops PII or secrets returned by a tool from being silently fed back into the LLM context window.

Configuration

gov = PalveronAdkGovernance(
    api_key="pv_live_xxx",
    base_url="https://gateway.internal.company.com:8080",  # on-prem
    check_model_input=True,    # verify prompts before generation (default)
    check_tool_input=True,     # verify tool args (default)
    check_tool_output=True,    # verify tool results (default)
    fail_open=False,           # block on gateway outage (Enterprise default)
    metadata={"team": "support"},
)

Multimodal

ADK supports text, image, audio, and video parts inside a Content object. The adapter extracts each part and forwards inline data as a Palveron Attachment. The gateway runs modality-appropriate checks (OCR for images, ASR for audio, frame sampling for video).

gov = PalveronAdkGovernance(api_key="pv_live_xxx")
agent = LlmAgent(
    name="ocr_assistant",
    model="gemini-2.0-flash",
    before_model_callback=gov.before_model_callback,
)
# Sensitive text in a screenshot is detected before Gemini sees it.

A2A Protocol Bridge

Wrap an inbound A2A handler so peer-agent messages are governed before reaching your logic:

from palveron_google_adk import wrap_a2a_handler

gov = PalveronAdkGovernance(api_key="pv_live_xxx")

async def handle_message(message, peer_agent_id):
    ...

governed = wrap_a2a_handler(handle_message, gov=gov)

A peer agent shipping a prompt-injection payload is blocked before your handler sees it.

Palveron as an ADK Tool

Register the gateway as a FunctionTool so the model can verify content explicitly during reasoning:

agent = LlmAgent(
    name="drafter",
    model="gemini-2.0-flash",
    instruction="Before sending any reply, call palveron_verify on the draft.",
    tools=[gov.as_tool(), send_email],
)

MCP Context Forwarding

When a tool call originates from an MCP server, the adapter pulls the MCP server name, session id, and chain depth out of ADK's tool_context and forwards them on the Palveron trace as RequestContext. The trace explorer shows the full agentic provenance — no extra wiring on your side.

Governance Records

print(f"Blocked: {gov.blocked_count}")
print(f"Trace IDs: {gov.trace_ids}")

for record in gov.records:
    print(f"{record.event} [{record.surface}]: {record.decision} ({record.latency_ms:.0f}ms)")

Error Handling

from palveron_google_adk import PalveronAdkGovernance, PalveronGovernanceError

try:
    result = agent.run("Refund order #12345 for €50,000")
except PalveronGovernanceError as e:
    print(e.decision)   # "BLOCKED"
    print(e.trace_id)   # "trc_abc123"
    print(e.reason)     # "Refund exceeds per-call budget policy"

Source Code

Open source (MIT): github.com/palveron/adapter-google-adk.

For Flare Agents

If your ADK agent runs on flare-ai-kit, you can pair the automatic callback adapter above with palveron-adk-tool — an explicit FunctionTool the agent calls when it matters (before signing a SparkDEX swap, before posting to X, before forwarding an A2A message). See palveron-adk-tool for Flare agents for the architecture, Flare-specific use cases (DeFi, social, RAG, FDC), and the Coston2 / Flare mainnet attestation flow.

Next Steps

On this page