Skip to main content
Connect a Google Agent Development Kit (ADK) agent to Civic using streamable HTTP transport. Reference implementations are available in Python (Claude), TypeScript (Gemini), and Go (Gemini).

Architecture

User Message
    |
    v
  Runner  -->  LlmAgent  -->  LLM (Claude / Gemini)
    |              |
    |              v
    |         MCPToolset  --(StreamableHTTP)-->  Civic MCP Hub
    |              |                                  |
    v              v                                  v
  Session     Tool Discovery              Guardrails / Audit / Revocation
              + Invocation
ComponentPurpose
LlmAgentWraps an LLM with instructions and tools
MCPToolsetConnects to Civic’s MCP Hub, discovers and invokes tools
RunnerOrchestrates agent execution and streams response events
SessionServiceManages conversation state

Prerequisites

Get Your Credentials

How to generate a Civic token and configure toolkit URL parameters

Environment Variables

All implementations require:
CIVIC_URL=https://app.civic.com/hub/mcp?profile=your-toolkit
CIVIC_TOKEN=your-civic-token
Plus an LLM API key depending on the language — see each tab below.
Requirements: Python 3.10+, uv (recommended) or pip, an Anthropic API key

Installation

pip install google-adk python-dotenv

Additional env var

ANTHROPIC_API_KEY=your-anthropic-key

Connecting to Civic

ADK has native Anthropic model support via google.adk.models.anthropic_llm.Claude — no LiteLlm dependency needed. Register Claude with the model registry and reference the model by string:
import os
from dotenv import load_dotenv
from google.adk.agents import Agent
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams
from google.adk.models.anthropic_llm import Claude
from google.adk.models.registry import LLMRegistry

load_dotenv()

# Register Claude for native Anthropic model support
LLMRegistry.register(Claude)

root_agent = Agent(
    model="claude-sonnet-4-6",
    name="civic_assistant",
    instruction="You are a helpful assistant with access to external tools through Civic.",
    tools=[
        McpToolset(
            connection_params=StreamableHTTPConnectionParams(
                url=os.environ["CIVIC_URL"],
                headers={"Authorization": f"Bearer {os.environ['CIVIC_TOKEN']}"},
            ),
        )
    ],
)

Running the Agent

Option A: ADK web consoleADK ships with a built-in development UI:
uv run adk web
Open http://localhost:8000 and select civic_agent from the dropdown.Option B: Programmatic runner
import asyncio
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.genai import types

async def main():
    session_service = InMemorySessionService()
    runner = Runner(
        agent=root_agent,
        app_name="my-app",
        session_service=session_service,
    )
    await session_service.create_session(
        app_name="my-app", user_id="user-1", session_id="session-1"
    )

    message = types.Content(
        role="user",
        parts=[types.Part(text="What events do I have today?")],
    )
    async for event in runner.run_async(
        user_id="user-1", session_id="session-1", new_message=message
    ):
        if event.is_final_response():
            for part in event.content.parts:
                if part.text:
                    print(part.text)

asyncio.run(main())
Use types.Part(text=...) — not types.Part.from_text(...). The from_text class method was removed in recent versions of the Google Gen AI SDK.

Production Configuration

Lock to a specific toolkit using the profile URL parameter:
CIVIC_URL=https://app.civic.com/hub/mcp?profile=your-production-toolkit

Reference Implementation

google-adk-reference-implementation-civic

Complete implementations in Python, TypeScript, and Go with deployment guides

Next Steps

Agent Deployment

Production deployment guide: profile locking, URL params, authentication

Guardrails

Constrain what tools your agent can call

Audit Trail

Query what your agent did via Civic Chat

Get Credentials

Token generation and URL parameter reference