docs/dev-guides/agent-context/google-adk.md
Build autonomous data agents with Google ADK that are grounded in your enterprise data context from DataHub — ownership, lineage, documentation, quality signals, and more.
The integration works two ways:
McpToolsetpip install google-adk)pip install datahub-agent-context[google-adk]
from datahub.sdk.main_client import DataHubClient
from datahub_agent_context.google_adk_tools import build_google_adk_tools
client = DataHubClient.from_env()
# Read-only tools by default; set include_mutations=True for write operations
tools = build_google_adk_tools(client, include_mutations=False)
Wire the tools into an ADK Agent:
from google.adk.agents import Agent
agent = Agent(
model="gemini-2.5-flash",
name="datahub_agent",
description="A data discovery assistant with access to DataHub.",
instruction="Use the available tools to search for datasets, get entity details, and trace lineage. Always include URNs in your answers.",
tools=tools,
)
Full working examples: basic_agent.py · simple_search.py
Instead of embedding tools, you can connect ADK to the DataHub MCP server using McpToolset:
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams
toolset = McpToolset(
connection_params=StreamableHTTPConnectionParams(
url="https://<tenant>.acryl.io/integrations/ai/mcp"
),
headers={"Authorization": f"Bearer {YOUR_TOKEN}"},
)
# Initialize eagerly so the AsyncExitStack is owned in this task
await toolset.get_tools()
agent = Agent(
model="gemini-2.5-flash",
name="datahub_agent",
instruction="You help users find datasets in DataHub.",
tools=[toolset],
)
Call await toolset.close() when done.
Don't set GOOGLE_API_KEY — ADK falls back to Application Default Credentials automatically. Make sure you've run gcloud auth application-default login.
client.config) and token permissions.instruction prompt, or try a model with better tool-calling (Gemini 2.0+).AsyncExitStack / task errors with McpToolset? Call await toolset.get_tools() in the same async task that owns the toolset, and await toolset.close() in a finally block.pip install datahub-agent-context[google-adk] google-adk.Links: Google ADK Docs · Agent Context Kit · MCP Server Guide