Learn the basics of AgentKit in a few minutes.
Install AgentKit
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?
Create an agent
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:Test our agent
npx
, we’ll start the server and point it to our AgentKit server:http://localhost:8288/functions
) and click the “Invoke” button:Adding a second Agent
Creating a Network
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:agents
property defines the agents that are part of the networkrouter
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 returning undefined
).Test our network
http://localhost:8288/functions
) and click the “Invoke” button of the DevOps team function with the following payload: