<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Google-Adk on RockB</title><link>https://baeseokjae.github.io/tags/google-adk/</link><description>Recent content in Google-Adk on RockB</description><image><title>RockB</title><url>https://baeseokjae.github.io/images/og-default.png</url><link>https://baeseokjae.github.io/images/og-default.png</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 23 Apr 2026 01:21:17 +0000</lastBuildDate><atom:link href="https://baeseokjae.github.io/tags/google-adk/index.xml" rel="self" type="application/rss+xml"/><item><title>Google ADK TypeScript Guide: Build AI Agents with the Official TypeScript SDK</title><link>https://baeseokjae.github.io/posts/google-adk-typescript-guide-2026/</link><pubDate>Thu, 23 Apr 2026 01:21:17 +0000</pubDate><guid>https://baeseokjae.github.io/posts/google-adk-typescript-guide-2026/</guid><description>Complete guide to building AI agents with Google ADK TypeScript — installation, tools, multi-agent orchestration, and production deployment.</description><content:encoded><![CDATA[<p>Google ADK TypeScript lets you build production-grade AI agents in 30 minutes or less. Install <code>@google/adk</code>, define tools as plain TypeScript functions, wire them to a Gemini model, and deploy anywhere — local dev server, Docker, or Cloud Run — with full end-to-end type safety.</p>
<h2 id="what-is-google-adk-for-typescript">What Is Google ADK for TypeScript?</h2>
<p>Google Agent Development Kit (ADK) for TypeScript is an open-source, code-first framework for building, evaluating, and deploying AI agents that use Google&rsquo;s Gemini models. Released in 2026 as part of Google&rsquo;s multi-language ADK rollout (Python, TypeScript, Go, Java), the TypeScript SDK lives at <code>@google/adk</code> on npm and is backed by the same team that builds Gemini. Unlike lightweight wrappers that just call the chat API, ADK gives you a structured runtime: tools are typed functions, sessions have persistent state, and multi-agent pipelines are first-class citizens. In practice, a team of four engineers at a logistics startup replaced 800 lines of hand-rolled LangChain glue code with 200 lines of ADK TypeScript — cutting their p95 agent latency by 38% in the process. ADK also ships <code>@google/adk-devtools</code>, a local UI for inspecting tool calls, agent traces, and session memory during development. If you are a TypeScript developer who wants to build Gemini-powered agents without fighting Python environment issues, ADK TypeScript is your fastest path from prototype to production.</p>
<h2 id="google-adk-typescript-vs-python-vs-other-frameworks">Google ADK TypeScript vs Python vs Other Frameworks</h2>
<p>Choosing a framework is the decision that shapes your entire stack, so it is worth being specific about what ADK TypeScript actually offers relative to alternatives. ADK TypeScript and ADK Python share the same runtime contract — agents defined in either language can be composed via A2A (Agent-to-Agent) protocol — so the choice is primarily about your team&rsquo;s language and tooling preferences, not capability parity. ADK TypeScript ships with full TypeScript types for every public API: agent configs, tool schemas, session objects, and event payloads. This means your IDE catches schema mismatches before runtime, which matters when tool arguments grow complex. Compared to LangChain.js, ADK has a smaller API surface, opinionated defaults (Gemini-first), and an integrated eval harness. Compared to OpenAI Agents SDK, ADK targets Gemini models and Google Cloud, while OpenAI&rsquo;s SDK targets GPT models and OpenAI&rsquo;s platform — mixing them requires extra glue. CrewAI&rsquo;s TypeScript support is community-maintained, not officially backed, so breaking changes land without warning. For teams already using Google Workspace, Vertex AI, or Cloud Run, ADK TypeScript reduces integration overhead significantly because auth, logging, and tracing plug into existing GCP tooling.</p>
<table>
  <thead>
      <tr>
          <th>Framework</th>
          <th>Language</th>
          <th>Model Focus</th>
          <th>Typing</th>
          <th>Multi-Agent</th>
          <th>Eval Tools</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Google ADK</td>
          <td>TS / Python / Go / Java</td>
          <td>Gemini</td>
          <td>Native TS types</td>
          <td>Built-in A2A</td>
          <td>Built-in</td>
      </tr>
      <tr>
          <td>LangChain.js</td>
          <td>TypeScript</td>
          <td>Any</td>
          <td>Partial</td>
          <td>Via LCEL</td>
          <td>LangSmith (separate)</td>
      </tr>
      <tr>
          <td>OpenAI Agents SDK</td>
          <td>Python / TS</td>
          <td>GPT</td>
          <td>Good</td>
          <td>Handoffs</td>
          <td>Partial</td>
      </tr>
      <tr>
          <td>CrewAI</td>
          <td>Python (TS community)</td>
          <td>Any</td>
          <td>Weak</td>
          <td>Built-in</td>
          <td>Partial</td>
      </tr>
  </tbody>
</table>
<h2 id="prerequisites-and-installation">Prerequisites and Installation</h2>
<p>Setting up Google ADK TypeScript requires Node.js 18+, a Google Cloud project with the Gemini API enabled, and an API key or ADC credentials. The install takes under five minutes if you already have a GCP project. ADK ships as two packages: <code>@google/adk</code> (the runtime) and <code>@google/adk-devtools</code> (local inspector UI). The devtools package is optional for production but invaluable during development — it gives you a browser-based trace viewer that shows every tool call, model response, and session state transition in real time. In 2026, 85% of developers regularly use AI tooling for coding, and ADK&rsquo;s devtools are designed to make debugging agent behavior feel like debugging normal application code rather than black-box LLM prompting. You will also want <code>@google-cloud/vertexai</code> if you plan to run agents via Vertex AI instead of the Gemini API directly — both backends are supported and you switch between them with one config line.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># Initialize a new TypeScript project</span>
</span></span><span style="display:flex;"><span>npm init -y
</span></span><span style="display:flex;"><span>npm install @google/adk @google/adk-devtools
</span></span><span style="display:flex;"><span>npm install -D typescript ts-node @types/node
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Set your Gemini API key</span>
</span></span><span style="display:flex;"><span>export GOOGLE_API_KEY<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;your-api-key-here&#34;</span>
</span></span></code></pre></div><p>Create a <code>tsconfig.json</code>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;compilerOptions&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;target&#34;</span>: <span style="color:#e6db74">&#34;ES2022&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;module&#34;</span>: <span style="color:#e6db74">&#34;NodeNext&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;moduleResolution&#34;</span>: <span style="color:#e6db74">&#34;NodeNext&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;strict&#34;</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;outDir&#34;</span>: <span style="color:#e6db74">&#34;./dist&#34;</span>
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><h2 id="building-your-first-adk-typescript-agent">Building Your First ADK TypeScript Agent</h2>
<p>A minimal ADK TypeScript agent has three parts: a model, a tool list, and an agent runner. The model is the Gemini instance that reasons; tools are typed functions the model can call; the runner orchestrates the session loop. Here is a complete working example — a &ldquo;weather assistant&rdquo; that calls a mock weather API and returns a natural language summary. From cold start to first working response takes about 15 minutes once your API key is set. ADK handles the entire tool-call loop internally: the model emits a function call, ADK invokes your TypeScript function, appends the result to the context, and the model generates the final response. You write tools as ordinary async functions — no special base class, no decorator magic — and ADK infers the JSON schema from your TypeScript types automatically.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-typescript" data-lang="typescript"><span style="display:flex;"><span><span style="color:#66d9ef">import</span> { <span style="color:#a6e22e">Agent</span>, <span style="color:#a6e22e">tool</span>, <span style="color:#a6e22e">InMemorySessionService</span>, <span style="color:#a6e22e">Runner</span> } <span style="color:#66d9ef">from</span> <span style="color:#e6db74">&#34;@google/adk&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// Define a typed tool
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">getWeather</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">tool</span>(
</span></span><span style="display:flex;"><span>  <span style="color:#e6db74">&#34;get_weather&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#e6db74">&#34;Returns current weather for a city&#34;</span>,
</span></span><span style="display:flex;"><span>  { <span style="color:#a6e22e">city</span><span style="color:#f92672">:</span> { <span style="color:#66d9ef">type</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;string&#34;</span>, <span style="color:#a6e22e">description</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;City name&#34;</span> } },
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">async</span> ({ <span style="color:#a6e22e">city</span> }<span style="color:#f92672">:</span> { <span style="color:#a6e22e">city</span>: <span style="color:#66d9ef">string</span> }) <span style="color:#f92672">=&gt;</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// Replace with real API call
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#66d9ef">return</span> { <span style="color:#a6e22e">temperature</span>: <span style="color:#66d9ef">22</span>, <span style="color:#a6e22e">condition</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;Sunny&#34;</span>, <span style="color:#a6e22e">city</span> };
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// Create the agent
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">weatherAgent</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Agent</span>({
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">name</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;weather_assistant&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">model</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;gemini-3-flash&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">instruction</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;You help users check the weather. Always use the get_weather tool.&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">tools</span><span style="color:#f92672">:</span> [<span style="color:#a6e22e">getWeather</span>],
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// Run it
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">sessionService</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">InMemorySessionService</span>();
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">runner</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Runner</span>({ <span style="color:#a6e22e">agent</span>: <span style="color:#66d9ef">weatherAgent</span>, <span style="color:#a6e22e">sessionService</span> });
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">async</span> <span style="color:#66d9ef">function</span> <span style="color:#a6e22e">main() {</span>
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">session</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">sessionService</span>.<span style="color:#a6e22e">createSession</span>({ <span style="color:#a6e22e">appName</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;weather&#34;</span> });
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">response</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">runner</span>.<span style="color:#a6e22e">runAsync</span>({
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">sessionId</span>: <span style="color:#66d9ef">session.id</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">userId</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;user-1&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">message</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;What&#39;s the weather in Tokyo?&#34;</span>,
</span></span><span style="display:flex;"><span>  });
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">for</span> <span style="color:#66d9ef">await</span> (<span style="color:#66d9ef">const</span> <span style="color:#a6e22e">event</span> <span style="color:#66d9ef">of</span> <span style="color:#a6e22e">response</span>) {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">event</span>.<span style="color:#66d9ef">type</span> <span style="color:#f92672">===</span> <span style="color:#e6db74">&#34;agent_response&#34;</span>) {
</span></span><span style="display:flex;"><span>      <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#a6e22e">event</span>.<span style="color:#a6e22e">content</span>);
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">main</span>();
</span></span></code></pre></div><p>Run with <code>ts-node index.ts</code> and you will see a streaming response in under two seconds.</p>
<h2 id="working-with-tools-and-function-calling">Working with Tools and Function Calling</h2>
<p>Tools are the primary way ADK agents interact with the world — calling APIs, querying databases, sending notifications, or running code. ADK TypeScript supports three tool patterns: function tools (plain async functions), built-in tools (Google Search, Code Execution), and agent-as-tool (delegating to another agent). Function tools are the most common pattern and the one you will spend 80% of your time with. The ADK runtime uses Zod-compatible schema inference to generate the JSON schema it sends to Gemini, which means your TypeScript types directly control what the model is allowed to pass as arguments — there is no separate schema definition file to keep in sync. Google Search and Code Execution are built-in Gemini capabilities you enable by adding them to the tools array; no additional npm install required. ADK&rsquo;s tool system also handles errors gracefully: if a tool throws, ADK catches the error, formats it as a tool result, and lets the model decide whether to retry with different arguments or apologize to the user.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-typescript" data-lang="typescript"><span style="display:flex;"><span><span style="color:#66d9ef">import</span> { <span style="color:#a6e22e">Agent</span>, <span style="color:#a6e22e">tool</span>, <span style="color:#a6e22e">googleSearch</span>, <span style="color:#a6e22e">codeExecution</span> } <span style="color:#66d9ef">from</span> <span style="color:#e6db74">&#34;@google/adk&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// Custom function tool with complex input type
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">searchCRM</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">tool</span>(
</span></span><span style="display:flex;"><span>  <span style="color:#e6db74">&#34;search_crm&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#e6db74">&#34;Search the company CRM for customer records&#34;</span>,
</span></span><span style="display:flex;"><span>  {
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">query</span><span style="color:#f92672">:</span> { <span style="color:#66d9ef">type</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;string&#34;</span> },
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">limit</span><span style="color:#f92672">:</span> { <span style="color:#66d9ef">type</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;number&#34;</span>, <span style="color:#a6e22e">description</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;Max results (default 5)&#34;</span> },
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">async</span> ({ <span style="color:#a6e22e">query</span>, <span style="color:#a6e22e">limit</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">5</span> }<span style="color:#f92672">:</span> { <span style="color:#a6e22e">query</span>: <span style="color:#66d9ef">string</span>; <span style="color:#a6e22e">limit?</span>: <span style="color:#66d9ef">number</span> }) <span style="color:#f92672">=&gt;</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// Real implementation would call your CRM API
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#66d9ef">return</span> { <span style="color:#a6e22e">results</span><span style="color:#f92672">:</span> [], <span style="color:#a6e22e">total</span>: <span style="color:#66d9ef">0</span>, <span style="color:#a6e22e">query</span> };
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">researchAgent</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Agent</span>({
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">name</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;research_agent&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">model</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;gemini-3-pro&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">instruction</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;You are a research assistant. Use search to find information and code execution to analyze data.&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">tools</span><span style="color:#f92672">:</span> [
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">googleSearch</span>,        <span style="color:#75715e">// Built-in: Google Search
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#a6e22e">codeExecution</span>,       <span style="color:#75715e">// Built-in: Python code execution sandbox
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#a6e22e">searchCRM</span>,           <span style="color:#75715e">// Custom function tool
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>  ],
</span></span><span style="display:flex;"><span>});
</span></span></code></pre></div><h2 id="multi-agent-orchestration-with-adk">Multi-Agent Orchestration with ADK</h2>
<p>Multi-agent orchestration is where ADK TypeScript separates itself from simpler wrappers — it is a first-class feature, not an afterthought. ADK supports two orchestration modes: sequential pipelines (agents run one after another, passing output forward) and hierarchical delegation (an orchestrator agent calls specialist agents as tools via the A2A protocol). In production, multi-agent architectures shine for tasks that require specialization: a research agent gathers information, a writing agent drafts content, and a fact-checking agent verifies claims — all orchestrated by a coordinator that the user talks to directly. Google&rsquo;s internal ADK deployments use this pattern for complex document processing workflows where a single large prompt would exceed context limits or produce inconsistent output. The agent-as-tool pattern means your TypeScript types propagate across the boundary — the orchestrator&rsquo;s tool schema is derived from the sub-agent&rsquo;s input type automatically.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-typescript" data-lang="typescript"><span style="display:flex;"><span><span style="color:#66d9ef">import</span> { <span style="color:#a6e22e">Agent</span>, <span style="color:#a6e22e">tool</span>, <span style="color:#a6e22e">Runner</span>, <span style="color:#a6e22e">InMemorySessionService</span> } <span style="color:#66d9ef">from</span> <span style="color:#e6db74">&#34;@google/adk&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// Specialist agent 1: Research
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">researchAgent</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Agent</span>({
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">name</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;researcher&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">model</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;gemini-3-flash&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">instruction</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;You gather factual information and return structured summaries.&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">tools</span><span style="color:#f92672">:</span> [<span style="color:#a6e22e">googleSearch</span>],
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// Specialist agent 2: Writer
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">writingAgent</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Agent</span>({
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">name</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;writer&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">model</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;gemini-3-pro&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">instruction</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;You write polished content based on research briefs.&#34;</span>,
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// Orchestrator — delegates to specialists as tools
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">orchestrator</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Agent</span>({
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">name</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;orchestrator&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">model</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;gemini-3-pro&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">instruction</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;Coordinate research and writing tasks. Use the researcher first, then the writer.&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">tools</span><span style="color:#f92672">:</span> [
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">researchAgent</span>.<span style="color:#a6e22e">asTool</span>(<span style="color:#e6db74">&#34;research_topic&#34;</span>, <span style="color:#e6db74">&#34;Research a topic and return a brief&#34;</span>),
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">writingAgent</span>.<span style="color:#a6e22e">asTool</span>(<span style="color:#e6db74">&#34;write_article&#34;</span>, <span style="color:#e6db74">&#34;Write an article from a research brief&#34;</span>),
</span></span><span style="display:flex;"><span>  ],
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">runner</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Runner</span>({
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">agent</span>: <span style="color:#66d9ef">orchestrator</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">sessionService</span>: <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">InMemorySessionService</span>(),
</span></span><span style="display:flex;"><span>});
</span></span></code></pre></div><h2 id="connecting-to-gemini-models">Connecting to Gemini Models</h2>
<p>ADK TypeScript is Gemini-native, which means model configuration is cleaner than in generic frameworks that try to abstract over every provider. You pick a model string, and ADK handles authentication, request formatting, streaming, and retry logic. ADK supports Gemini 3 Pro (best reasoning, higher cost) and Gemini 3 Flash (fast, cost-efficient) as of 2026, with full feature support including Code Execution, Google Search grounding, and context caching. Context caching is particularly valuable for agent workloads: if your agent system prompt and tool definitions are large (common in production), caching them on the Gemini side reduces latency and token costs for every session after the first. You can also connect ADK to Vertex AI instead of the Gemini API directly — useful if your organization requires all AI traffic to stay within a VPC or you need enterprise SLAs.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-typescript" data-lang="typescript"><span style="display:flex;"><span><span style="color:#66d9ef">import</span> { <span style="color:#a6e22e">Agent</span> } <span style="color:#66d9ef">from</span> <span style="color:#e6db74">&#34;@google/adk&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">import</span> { <span style="color:#a6e22e">VertexAIProvider</span> } <span style="color:#66d9ef">from</span> <span style="color:#e6db74">&#34;@google/adk/providers&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// Option 1: Gemini API (simplest, uses GOOGLE_API_KEY)
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">apiAgent</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Agent</span>({
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">name</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;api_agent&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">model</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;gemini-3-pro&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">instruction</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;...&#34;</span>,
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// Option 2: Vertex AI (enterprise, uses ADC)
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">vertexAgent</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Agent</span>({
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">name</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;vertex_agent&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">model</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;gemini-3-pro&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">modelProvider</span>: <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">VertexAIProvider</span>({
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">project</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;my-gcp-project&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">location</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;us-central1&#34;</span>,
</span></span><span style="display:flex;"><span>  }),
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">instruction</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;...&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">generationConfig</span><span style="color:#f92672">:</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">enableContextCaching</span>: <span style="color:#66d9ef">true</span>, <span style="color:#75715e">// Cache system prompt across sessions
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>  },
</span></span><span style="display:flex;"><span>});
</span></span></code></pre></div><h2 id="deploying-adk-agents-to-production">Deploying ADK Agents to Production</h2>
<p>ADK agents deploy to any Node.js runtime — local server, Docker container, Cloud Run, or Cloud Functions. The framework ships with an HTTP adapter that wraps your runner in an Express-compatible request handler, so you can expose your agent as a REST API or WebSocket endpoint without writing boilerplate. Cloud Run is the recommended production target for most teams: it scales to zero when idle, autoscales under load, and integrates with Cloud IAP for authentication without any code changes. A typical ADK TypeScript Cloud Run deploy takes about 10 minutes from <code>gcloud run deploy</code> to live HTTPS endpoint. For persistent session state across restarts, swap <code>InMemorySessionService</code> for <code>FirestoreSessionService</code> — one import change, no other code modifications.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-typescript" data-lang="typescript"><span style="display:flex;"><span><span style="color:#66d9ef">import</span> <span style="color:#a6e22e">express</span> <span style="color:#66d9ef">from</span> <span style="color:#e6db74">&#34;express&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">import</span> { <span style="color:#a6e22e">Runner</span>, <span style="color:#a6e22e">FirestoreSessionService</span> } <span style="color:#66d9ef">from</span> <span style="color:#e6db74">&#34;@google/adk&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">import</span> { <span style="color:#a6e22e">createHttpHandler</span> } <span style="color:#66d9ef">from</span> <span style="color:#e6db74">&#34;@google/adk/http&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">sessionService</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">FirestoreSessionService</span>({
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">projectId</span>: <span style="color:#66d9ef">process.env.GCP_PROJECT</span><span style="color:#f92672">!</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">collection</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;agent-sessions&#34;</span>,
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">runner</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Runner</span>({ <span style="color:#a6e22e">agent</span>: <span style="color:#66d9ef">orchestrator</span>, <span style="color:#a6e22e">sessionService</span> });
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">app</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">express</span>();
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">app</span>.<span style="color:#a6e22e">use</span>(<span style="color:#a6e22e">express</span>.<span style="color:#a6e22e">json</span>());
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">app</span>.<span style="color:#a6e22e">post</span>(<span style="color:#e6db74">&#34;/agent&#34;</span>, <span style="color:#a6e22e">createHttpHandler</span>(<span style="color:#a6e22e">runner</span>));
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">app</span>.<span style="color:#a6e22e">listen</span>(<span style="color:#ae81ff">8080</span>);
</span></span></code></pre></div><p>Dockerfile for Cloud Run:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-dockerfile" data-lang="dockerfile"><span style="display:flex;"><span><span style="color:#66d9ef">FROM</span><span style="color:#e6db74"> node:20-slim</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">WORKDIR</span><span style="color:#e6db74"> /app</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">COPY</span> package*.json ./<span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">RUN</span> npm ci --omit<span style="color:#f92672">=</span>dev<span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">COPY</span> dist/ ./dist/<span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#66d9ef">ENV</span> PORT<span style="color:#f92672">=</span><span style="color:#ae81ff">8080</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">CMD</span> [<span style="color:#e6db74">&#34;node&#34;</span>, <span style="color:#e6db74">&#34;dist/server.js&#34;</span>]<span style="color:#960050;background-color:#1e0010">
</span></span></span></code></pre></div><p>Deploy:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>gcloud run deploy my-agent <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  --source . <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  --region us-central1 <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  --allow-unauthenticated <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  --set-env-vars GOOGLE_API_KEY<span style="color:#f92672">=</span>$GOOGLE_API_KEY
</span></span></code></pre></div><h2 id="real-world-use-cases-and-examples">Real-World Use Cases and Examples</h2>
<p>ADK TypeScript&rsquo;s combination of type safety, Gemini integration, and multi-agent support makes it well-suited for a specific class of production problems. The framework earns its keep in workflows where the agent needs to handle ambiguity, call multiple APIs in sequence, and adapt when results are unexpected — the cases where a simple chatbot or a hardcoded automation script both fall short. Customer support automation is a common entry point: an ADK agent handles Tier 1 tickets, calls your CRM and helpdesk APIs via typed tools, escalates to human agents when confidence is low, and logs every decision for audit. Code review assistance is another strong use case — connect ADK to your GitHub API, have the agent read the diff, check your style guide via a vector search tool, and post inline comments. Document processing pipelines (extract, classify, route, summarize) are well-suited to ADK&rsquo;s multi-agent orchestration: each specialist agent handles one step, the orchestrator manages flow, and Firestore persists state between async steps so long-running jobs survive restarts.</p>
<p>A realistic customer support agent:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-typescript" data-lang="typescript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">supportAgent</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Agent</span>({
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">name</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;support_agent&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">model</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;gemini-3-flash&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">instruction</span><span style="color:#f92672">:</span> <span style="color:#e6db74">`You are a customer support agent for Acme Corp.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    Use lookup_ticket to find existing issues.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    Use update_ticket to add notes or change status.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    If you cannot resolve an issue, use escalate_to_human.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    Always confirm actions with the customer before executing them.`</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">tools</span><span style="color:#f92672">:</span> [<span style="color:#a6e22e">lookupTicket</span>, <span style="color:#a6e22e">updateTicket</span>, <span style="color:#a6e22e">escalateToHuman</span>, <span style="color:#a6e22e">searchKnowledgeBase</span>],
</span></span><span style="display:flex;"><span>});
</span></span></code></pre></div><h2 id="troubleshooting-common-issues">Troubleshooting Common Issues</h2>
<p>Most ADK TypeScript issues fall into three categories: authentication errors, tool schema validation failures, and session state corruption. Authentication errors are the most common for new users — <code>GOOGLE_API_KEY</code> must be set for Gemini API mode, or Application Default Credentials must be configured (<code>gcloud auth application-default login</code>) for Vertex AI mode. If you see <code>403 PERMISSION_DENIED</code>, verify your GCP project has the Generative Language API enabled in the Cloud Console. Tool schema validation failures happen when your TypeScript types include constructs Gemini&rsquo;s tool schema spec does not support — union types (<code>string | number</code>), optional nested objects, and recursive types are the common offenders. Simplify tool input types to flat objects with scalar values when possible, or use explicit JSON schema overrides. Session state corruption usually surfaces as &ldquo;agent appears to forget earlier context&rdquo; — check that your session IDs are stable across requests (use a user/conversation ID, not a random UUID per request). The <code>@google/adk-devtools</code> inspector makes all three categories much easier to diagnose: start it with <code>npx adk devtools</code> and open <code>localhost:8888</code> to see full trace logs.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># Common fixes</span>
</span></span><span style="display:flex;"><span>export GOOGLE_API_KEY<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;your-key&#34;</span>          <span style="color:#75715e"># Auth: Gemini API mode</span>
</span></span><span style="display:flex;"><span>gcloud auth application-default login      <span style="color:#75715e"># Auth: Vertex AI mode</span>
</span></span><span style="display:flex;"><span>gcloud services enable generativelanguage.googleapis.com  <span style="color:#75715e"># Enable API</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Start devtools inspector</span>
</span></span><span style="display:flex;"><span>npx adk devtools --port <span style="color:#ae81ff">8888</span>
</span></span></code></pre></div><p>ADK-specific error codes to know:</p>
<ul>
<li><code>TOOL_SCHEMA_INVALID</code> — simplify your tool input types, avoid union types</li>
<li><code>SESSION_NOT_FOUND</code> — session expired or wrong session ID passed</li>
<li><code>CONTEXT_LENGTH_EXCEEDED</code> — enable context caching or trim your system prompt</li>
<li><code>RATE_LIMIT_EXCEEDED</code> — add exponential backoff; switch to Flash for high-volume workloads</li>
</ul>
<h2 id="faq">FAQ</h2>
<p><strong>Q: Is Google ADK TypeScript production-ready in 2026?</strong>
Yes. Google uses ADK internally, and the TypeScript SDK ships with the same runtime guarantees as the Python version. The GitHub repo (<code>google/adk-js</code>) has active maintenance, and breaking changes follow semantic versioning with migration guides.</p>
<p><strong>Q: Can I use Google ADK TypeScript with models other than Gemini?</strong>
ADK is Gemini-first by design. While the provider interface is extensible, official support covers only Gemini 3 Pro and Gemini 3 Flash. Community adapters exist for other models, but they are not Google-maintained. If model-agnosticism is a hard requirement, LangChain.js is a better fit.</p>
<p><strong>Q: How does ADK TypeScript handle long-running tasks that take more than a few seconds?</strong>
ADK supports async session resumption — you can kick off an agent run, store the session ID, and poll for results later. Pair this with <code>FirestoreSessionService</code> and Cloud Tasks for reliable async pipelines. The HTTP adapter also supports server-sent events for streaming results to frontend clients.</p>
<p><strong>Q: What is the pricing for running ADK TypeScript agents?</strong>
ADK itself is free and open-source. You pay for Gemini API calls at standard Gemini pricing — roughly $0.075/1M input tokens for Flash and $1.25/1M input tokens for Pro as of 2026. Cloud Run hosting costs are minimal for moderate traffic (sub-$10/month for a typical support bot handling hundreds of conversations per day).</p>
<p><strong>Q: How do I test ADK TypeScript agents without calling the real Gemini API?</strong>
ADK ships with a mock runner for unit testing. Pass <code>MockModelProvider</code> to your <code>Agent</code> and define expected tool call sequences and model responses. This lets you test tool logic, error handling, and multi-step orchestration in milliseconds without API calls or costs.</p>
]]></content:encoded></item></channel></rss>