This guide will help you create your first AI agent with ADK-TS. You’ll learn how to set up the framework, create a simple agent, and make your first query.
1
Install ADK-TS
Install the ADK-TS package using your preferred package manager:
npm install @iqai/adk
ADK-TS requires Node.js version 22.0 or higher.
2
Set up your API key
ADK-TS supports multiple LLM providers. For this quickstart, we’ll use Google Gemini. Get your API key from Google AI Studio.Create a .env file in your project root:
.env
GOOGLE_API_KEY=your_google_api_key_here
ADK-TS also supports OpenAI, Anthropic, and other providers. See the installation guide for details.
3
Create your first agent
Create a new file agent.ts and add the following code:
agent.ts
import { AgentBuilder } from "@iqai/adk";// Simple one-liner agentconst response = await AgentBuilder.withModel("gemini-2.5-flash").ask( "What is the capital of France?");console.log(response);
That’s it! This creates an agent using Google’s Gemini model and asks a question.
4
Run your agent
Execute your agent with Node.js:
node agent.ts
You should see a response from the AI model with information about Paris being the capital of France.
Let’s enhance our agent to return structured data using Zod schemas:
import { AgentBuilder } from "@iqai/adk";import { z } from "zod";// Define the output structureconst outputSchema = z.object({ capital: z.string().describe("The capital city name"), country: z.string().describe("The country name"), population: z.number().optional().describe("Population of the capital city"), funFact: z.string().describe("An interesting fact about the city"),});// Create agent with structured outputconst { runner } = AgentBuilder.withModel("gemini-2.5-flash") .withOutputSchema(outputSchema) .build();// Ask a question and get typed responseconst response = await runner.ask("Tell me about France");console.log(`Country: ${response.country}`);console.log(`Capital: ${response.capital}`);console.log(`Population: ${response.population?.toLocaleString()}`);console.log(`Fun fact: ${response.funFact}`);
The response is fully typed based on your Zod schema, giving you autocomplete and type safety!
Tools allow your agent to perform actions. Let’s create a shopping cart agent with custom tools:
import { AgentBuilder } from "@iqai/adk";import { addItemTool, viewCartTool } from "./tools";const { runner } = AgentBuilder.create("shopping_cart_agent") .withModel("gemini-2.5-flash") .withInstruction(` You are a shopping cart assistant. Help users manage their cart. You can add items and view the cart. Always be helpful with pricing. `) .withTools(addItemTool, viewCartTool) .withQuickSession({ state: { cart: [], cartCount: 0 } }) .build();// Interact with the agentconst response = await runner.ask( "Add 2 apples at $1.50 each to my cart");console.log(response);