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

The palveron-google-adk adapter is not yet published to PyPI.

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 when a policy such as "Refund budget" blocks the call

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 personal data 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. Today the gateway governs the request's text content and checks each attachment's type and size; dedicated image, audio, or video analysis in the gateway is not available today (see the Multi-Modal guide). ADK itself sends the request to Gemini once the result allows it.

gov = PalveronAdkGovernance(api_key="pv_live_xxx")
agent = LlmAgent(
    name="ocr_assistant",
    model="gemini-2.0-flash",
    before_model_callback=gov.before_model_callback,
)
# The screenshot's text content is governed; the image is checked by type and
# size and forwarded to Gemini (no in-gateway image analysis today).

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, with 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)   # "cktrace..."
    print(e.reason)     # 'The security policy "Refund budget" matched one of its configured patterns in this request and blocked it. The full details are stored with this record.'

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 Flare attestation flow (Coston2).

Next Steps

On this page