Follow this guide by forking the quick-start example locally by running:
Creating a single agent
1
Install AgentKit
Within an existing project, install AgentKit and Inngest from npm:You can always find the latest release version on npm.
Important: Starting with AgentKit v0.9.0,
inngest
is a required peer dependency. You must install both packages together to ensure proper runtime compatibility and prevent conflicts.Don't have an existing project?
Don't have an existing project?
To create a new project, create a new directory and initialize it using your package manager:
2
Create an agent
To start, we’ll create our first “Agent.” An Agent is an entity that has a specific role to answer questions or perform tasks (see “tools” below).Let’s create a new file, You’ll also need to set your provider API keys as environment variables:
index.ts
. Using the createAgent
constructor, give your agent a name
, a description
, and its initial system
prompt. The name
and description
properties are used to help the LLM determine which Agent to call.You’ll also specify which model
you want the agent to use. Here we’ll use Anthropic’s Claude 3.5 Haiku model. (Model reference)Your agent can be whatever you want, but in this quick start, we’ll create a PostgreSQL database administrator agent:index.ts
terminal
3
4
Test our agent
To test our agent, we’ll use the Inngest dev server to visually debug our agents. Using Now, open the dev server and select the functions tab (
In the Invoke function modal, specify the input prompt for your agent and click the “Invoke function” button:
You’ll be redirected to watch the agent run and view the output:
npx
, we’ll start the server and point it to our AgentKit server:terminal
http://localhost:8288/functions
) and click the “Invoke” button:

Invoke payload

Creating a multi-agent network
1
Adding a second Agent
Agents collaborate in a Network by sharing a common State.Let’s update our Database Administrator Agent to include a tool to save the answer to the question in the database:Let’s now create a second Database Security Agent:Our second Security Expert Agent is similar to the first, but with a different system prompt specifically for security questions.We can now create a network combining our “Database Administrator” and “Database Security” Agents, which enables us to answer more complex questions.
Tools are based on Tool
Calling,
enabling your Agent to interact with the State of the
Network, store data in external databases, or dynamically fetch data from
third-party APIs.
2
Creating a Network
Create a network using the The highlighted lines are the key parts of our AI Agent behavior:
createNetwork
constructor. Define a name
and include our agents from the previous step in the agents
array.You must also configure a router
that the Router will use to determine which agent to call:- The
agents
property defines the agents that are part of the network - The
router
function defines the logic for which agent to call next. In this example, we call the Database Administrator Agent followed by the Security Expert Agent before ending the network (by returningundefined
).
3
Test our network
We’ll use the same approach to test our network as we did above.With your Inngest dev server running, open the dev server and select the functions tab (The network will now run through the Agents to answer the questions:
You can inspect the answers of each Agent by selecting the Finalization step and inspecting the JSON payload in the right panel:
http://localhost:8288/functions
) and click the “Invoke” button of the DevOps team function with the following payload:Invoke payload


Next steps
Congratulations! You’ve now created your first AI Agent with AgentKit. In this guide, you’ve learned that:- Agents are the building blocks of AgentKit. They are used to call a single model to answer specific questions or perform tasks.
- Networks are groups of agents that can work together to achieve more complex goals.
- Routers, combined with State, enable you to control the flow of your Agents.
Adding Tools to Agents
Let your Agent act and gather data with tools
Implementing reasoning-based routing
Learn how to dynamically route between agents
Support Agent with "Human in the loop"
This AgentKit example shows how to build a Support Agent Network with a “Human
in the loop” pattern.
AgentKit SWE-bench
This AgentKit example uses the SWE-bench dataset to train an agent to solve coding problems. It uses advanced tools to interact with files and codebases.