Skip to main content

Command Palette

Search for a command to run...

Build Your First Agent with Agent Development Kit using TypeScript

Published
5 min read
Build Your First Agent with Agent Development Kit using TypeScript

The Agent Development Kit (ADK) is an open-source, modular framework designed to shift agent creation from basic prompt engineering to a structured, code-first software development approach. It provides developers with the precision and control needed to build complex, enterprise-ready multi-agent systems.

While many examples focus on Python, We are going to built Agent using Typescript

1.Core Features and Benefits of ADK

ADK simplifies end-to-end development by making it feel like traditional software development. Its features are built around several core pillars:

a.Precision and Control

  • Flexible Orchestration: Create predictable pipelines using workflow agents like sequential, parallel, and loop agents.

  • Dynamic Routing: For complex scenarios, agents can adapt their strategy in real-time based on LLM-driven reasoning.

b.Multi-agent Architecture

Instead of one massive agent, ADK allows you to build a hierarchy of specialized agents. A primary agent can delegate specific tasks to these specialized roles, making the system more reliable and scalable.

c.Rich Tool Ecosystem

Agents can leverage pre-built tools such as Google Search and Code Execution, or integrate with custom enterprise APIs and third-party libraries. ADK also allows agents to use other agents as tools.

d. Code-First and Modular Design

Agent logic and orchestration are defined directly in code (TypeScript, Python, or Java), which promotes better testability and version control.

e. Integrated Tooling and Evaluation

  • CLI & Web UI: Easily run, test, and debug your agents locally

  • Built-in Evaluation: Test performance against predefined scenarios to evaluate both the final answer and the reasoning trajectory used to reach it.

2.The Core Agent Architecture

In ADK, an agent is defined by the formula: Agent = Model + Tools + Orchestration.

3.Getting Started with TypeScript

Create an empty adk-agent directory for your project:

adk-agent/

Use the npm tool to install and configure dependencies for your project, including the package file, ADK TypeScript main library, and developer tools. Run the following commands from your adk-agent/ directory to create the package.json file and install the project dependencies:

cd adk-agent/
# initialize a project as an ES module
npm init --yes
npm pkg set type="module"
npm pkg set main="agent.ts"
# install ADK libraries
npm install @google/adk
# install dev tools as a dev dependency
npm install -D @google/adk-devtools

Create the code for a basic agent, including a simple implementation of an ADK Function Tool, called getCurrentTime. Create an agent.ts file in your project directory and add the following code:

import {FunctionTool, LlmAgent} from '@google/adk';
import {z} from 'zod';

/* Mock tool implementation */
const getCurrentTime = new FunctionTool({
  name: 'get_current_time',
  description: 'Returns the current time in a specified city.',
  parameters: z.object({
    city: z.string().describe("The name of the city for which to retrieve the current time."),
  }),
  execute: ({city}) => {
    return {status: 'success', report: `The current time in ${city} is 10:30 AM`};
  },
});

export const rootAgent = new LlmAgent({
  name: 'hello_time_agent',
  model: 'gemini-2.5-flash',
  description: 'Tells the current time in a specified city.',
  instruction: `You are a helpful assistant that tells the current time in a city.
                Use the 'getCurrentTime' tool for this purpose.`,
  tools: [getCurrentTime],
});

Add your API Key

For this tutorial we use the Gemini API, which requires an API key. If you don't already have Gemini API key, create a key in Google AI Studio on the API Keys page.

In a terminal window, write your API key into your .env file of your project to set environment variables:

echo 'GEMINI_API_KEY="YOUR_API_KEY"' > .env

Run your Agent

You can run your ADK agent with the @google/adk-devtools library as an interactive command-line interface using the run command or the ADK web user interface using the web command. Both these options allow you to test and interact with your agent.

npx adk run agent.ts

Run with Web Interface

Run your agent with the ADK web interface using the following command:

npx adk web

This command starts a web server with a chat interface for your agent. You can access the web interface at (http://localhost:8000). Select your agent at the upper right corner and type a request.

Voila you have made it. You have created an agent in no time. Congrats!!!, but still a long way to go.

How it works

In the agent.ts file you can see the following snippet

root_agent = Agent(
   model=’gemini-2.5-flash’, # Model: The reasoning engine (Course 1!)
   name=’root_agent’, # Identity: Required identifier
   description=’A helpful agent.’, # Purpose: What this agent does
   instruction=’You are helpful.’ # Behavior: How to act
   # Tools: You’ll add these in Module 3
   # Orchestration: Handled automatically by the Agent class
)
  • Model ( gemini-2.5-flash): The LLM that provides reasoning and decision-making

  • Tools: Functions the agent calls to take actions (module 3)

  • Orchestration: The Agent class automatically runs the Perceive → Think → Act → Check loop

Will catch up in a new post where we dive in more with ADK Agents. Till then Happy Learning :)