Models
Within AgentKit, models are adapters that wrap a given provider (ex. OpenAI, Anthropic)‘s specific model version (ex. gpt-3.5).
Each Agent can each select their own model to use and a Network can select a default model.
import { openai, anthropic, gemini } from "@inngest/agent-kit";How to use a model
Section titled “How to use a model”Create a model instance
Section titled “Create a model instance”import { openai, createAgent } from "@inngest/agent-kit";
const model = openai({ model: "gpt-3.5-turbo" });const modelWithApiKey = openai({ model: "gpt-3.5-turbo", apiKey: "sk-..." });import { anthropic, createAgent } from "@inngest/agent-kit";
const model = anthropic({ model: "claude-3-5-haiku-latest" });
const modelWithBetaFlags = anthropic({ model: "claude-3-5-haiku-latest", betaHeaders: ["prompt-caching-2024-07-31"],});
const modelWithApiKey = anthropic({ model: "claude-3-5-haiku-latest", apiKey: "sk-...", // Note: max_tokens is required for Anthropic models defaultParameters: { max_tokens: 4096 },});import { gemini, createAgent } from "@inngest/agent-kit";
const model = gemini({ model: "gemini-1.5-flash" });Configure model hyper parameters (temperature, etc.)
Section titled “Configure model hyper parameters (temperature, etc.)”You can configure the model hyper parameters (temperature, etc.) by passing the defaultParameters option:
import { openai, createAgent } from "@inngest/agent-kit";
const model = openai({ model: "gpt-3.5-turbo", defaultParameters: { temperature: 0.5 },});import { anthropic, createAgent } from "@inngest/agent-kit";
const model = anthropic({ model: "claude-3-5-haiku-latest", defaultParameters: { temperature: 0.5, max_tokens: 4096 },
});import { gemini, createAgent } from "@inngest/agent-kit";
const model = gemini({ model: "gemini-1.5-flash", defaultParameters: { temperature: 0.5 },});Providing a model instance to an Agent
Section titled “Providing a model instance to an Agent”import { createAgent } from "@inngest/agent-kit";
const supportAgent = createAgent({ model: openai({ model: "gpt-3.5-turbo" }), name: "Customer support specialist", system: "You are an customer support specialist...", tools: [listChargesTool],});Providing a model instance to a Network
Section titled “Providing a model instance to a Network”import { createNetwork } from "@inngest/agent-kit";
const network = createNetwork({ agents: [supportAgent], defaultModel: openai({ model: "gpt-4o" }),});List of supported models
Section titled “List of supported models”For a full list of supported models, you can always check the models directory here.
"gpt-4.5-preview""gpt-4o""chatgpt-4o-latest""gpt-4o-mini""gpt-4""o1""o1-preview""o1-mini""o3-mini""gpt-4-turbo""gpt-3.5-turbo""claude-3-5-haiku-latest""claude-3-5-haiku-20241022""claude-3-5-sonnet-latest""claude-3-5-sonnet-20241022""claude-3-5-sonnet-20240620""claude-3-opus-latest""claude-3-opus-20240229""claude-3-sonnet-20240229""claude-3-haiku-20240307""claude-2.1""claude-2.0""claude-instant-1.2";"gemini-1.5-flash""gemini-1.5-flash-8b""gemini-1.5-pro""gemini-1.0-pro""text-embedding-004""aqa""grok-2-1212""grok-2""grok-2-latest""grok-3""grok-3-latest""grok-4""grok-4-latest"Environment variable used for each model provider
Section titled “Environment variable used for each model provider”- OpenAI:
OPENAI_API_KEY - Anthropic:
ANTHROPIC_API_KEY - Gemini:
GEMINI_API_KEY - Grok:
XAI_API_KEY
Contribution
Section titled “Contribution”Is there a model that you’d like to see included in AgentKit? Open an issue, create a pull request, or chat with the team on Discord in the #ai channel.
Contribute on GitHub - Fork, clone, and open a pull request.