> **Building with AI coding agents?** If you're using an AI coding agent, install the official Scalekit plugin. It gives your agent full awareness of the Scalekit API — reducing hallucinations and enabling faster, more accurate code generation.
>
> - **Claude Code**: `/plugin marketplace add scalekit-inc/claude-code-authstack` then `/plugin install <auth-type>@scalekit-auth-stack`
> - **GitHub Copilot CLI**: `copilot plugin marketplace add scalekit-inc/github-copilot-authstack` then `copilot plugin install <auth-type>@scalekit-auth-stack`
> - **Codex**: run the bash installer, restart, then open Plugin Directory and enable `<auth-type>`
> - **Skills CLI** (Windsurf, Cline, 40+ agents): `npx skills add scalekit-inc/skills --list` then `--skill <skill-name>`
>
> `<auth-type>` / `<skill-name>`: `agentkit`, `full-stack-auth`, `mcp-auth`, `modular-sso`, `modular-scim` — [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Google ADK

Build a Google ADK agent that reads a user's Gmail inbox. Scalekit handles OAuth, token storage, and returns tools as native ADK tool objects compatible with any ADK agent.

[Full code on GitHub](https://github.com/scalekit-inc/google-adk-agent-example)

## Install

```sh
pip install scalekit-sdk-python google-adk
```

## Initialize

```python
import os
import asyncio
import scalekit.client

scalekit_client = scalekit.client.ScalekitClient(
    client_id=os.getenv("SCALEKIT_CLIENT_ID"),
    client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),
    env_url=os.getenv("SCALEKIT_ENV_URL"),
)
actions = scalekit_client.actions
```

## Connect the user to Gmail

```python
response = actions.get_or_create_connected_account(
    connection_name="gmail",
    identifier="user_123",
)
if response.connected_account.status != "ACTIVE":
    link = actions.get_authorization_link(connection_name="gmail", identifier="user_123")
    print("Authorize Gmail:", link.link)
    input("Press Enter after authorizing...")
```

See [Authorize a user](/agentkit/tools/authorize/) for production auth handling.

## Build and run the agent

`actions.google.get_tools()` returns native ADK tool objects. Pass them directly to a Google ADK `Agent`:

```python
from google.adk.agents import Agent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.genai import types

tools = actions.google.get_tools(
    identifier="user_123",
    connection_names=["gmail"],
)

agent = Agent(
    name="gmail_assistant",
    model="gemini-2.0-flash",
    instruction="You are a helpful Gmail assistant.",
    tools=tools,
)

async def main():
    session_service = InMemorySessionService()
    runner = Runner(agent=agent, app_name="gmail_app", session_service=session_service)
    session = await session_service.create_session(app_name="gmail_app", user_id="user_123")

    message = types.Content(
        role="user",
        parts=[types.Part(text="Fetch my last 5 unread emails and summarize them")],
    )
    async for event in runner.run_async(
        user_id="user_123",
        session_id=session.id,
        new_message=message,
    ):
        if event.is_final_response():
            print(event.response.text)

asyncio.run(main())
```
**Multiple Gmail accounts:** If a user has multiple Gmail connections, pass the specific `connection_names` value from your Scalekit dashboard to scope tools to the right one.

## Use MCP instead

Google ADK supports MCP via `MCPToolset`. Connect to a Scalekit-generated MCP URL to skip tool setup:

```python
from google.adk.agents import Agent
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset, StreamableHTTPConnectionParams

agent = Agent(
    name="gmail_assistant",
    model="gemini-2.0-flash",
    instruction="You are a helpful Gmail assistant.",
    tools=[
        MCPToolset(
            connection_params=StreamableHTTPConnectionParams(url=mcp_url)
        )
    ],
)
```

See [Generate user MCP URLs](/agentkit/mcp/generate-user-urls/) to get `mcp_url`.

---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
