Quick Start
Build and run your first AI agent with Agent Kernel in under 5 minutes!
Choose Your Framework
Agent Kernel supports multiple frameworks. Pick the one you're most comfortable with:
- OpenAI Agents
- CrewAI
- LangGraph
- Google ADK
OpenAI Agents Quick Start
1. Install
pip install agentkernel[openai]
2. Create Your Agent
Create a file called my_agent.py:
from agents import Agent as OpenAIAgent
from agentkernel.cli import CLI
from agentkernel.openai import OpenAIModule
# Define your agent
general_agent = OpenAIAgent(
name="general",
handoff_description="Agent for general questions",
instructions="You provide assistance with general queries. Give short and direct answers.",
)
math_agent = OpenAIAgent(
name="math",
handoff_description="Specialist agent for math questions",
instructions="You provide help with math problems. Explain your reasoning.",
)
# Register agents with Agent Kernel
OpenAIModule([general_agent, math_agent])
if __name__ == "__main__":
CLI.main()
3. Set API Key
export OPENAI_API_KEY=your-api-key-here
4. Run Your Agent
python my_agent.py
CrewAI Quick Start
1. Install
pip install agentkernel[crewai]
2. Create Your Agent
Create a file called my_agent.py:
from crewai import Agent as CrewAgent
from agentkernel.cli import CLI
from agentkernel.crewai import CrewAIModule
# Define your agents
general_agent = CrewAgent(
role="general",
goal="Agent for general questions",
backstory="You provide assistance with general queries. Give direct and short answers",
verbose=False,
)
math_agent = CrewAgent(
role="math",
goal="Specialist agent for math questions",
backstory="You provide help with math problems. Explain your reasoning at each step.",
verbose=False,
)
# Register agents with Agent Kernel
CrewAIModule([general_agent, math_agent])
if __name__ == "__main__":
CLI.main()
3. Set API Key
export OPENAI_API_KEY=your-api-key-here
4. Run Your Agent
python my_agent.py
LangGraph Quick Start
1. Install
pip install agentkernel[langgraph]
2. Create Your Agent
Create a file called my_agent.py:
from typing import TypedDict
from langgraph.graph import StateGraph, END
from agentkernel.cli import CLI
from agentkernel.langgraph import LangGraphModule
# Define state
class State(TypedDict):
messages: list
# Define nodes
def respond(state: State):
# Your agent logic here
messages = state["messages"]
response = f"Processed: {messages[-1]}"
return {"messages": messages + [response]}
# Build graph
workflow = StateGraph(State)
workflow.add_node("agent", respond)
workflow.set_entry_point("agent")
workflow.add_edge("agent", END)
# Compile graph
graph = workflow.compile()
graph.name = "assistant"
# Register with Agent Kernel
LangGraphModule([graph])
if __name__ == "__main__":
CLI.main()
3. Set API Key
export OPENAI_API_KEY=your-api-key-here
4. Run Your Agent
python my_agent.py
Google ADK Quick Start
1. Install
pip install agentkernel[adk]
2. Create Your Agent
Create a file called my_agent.py:
from adk import Agent as ADKAgent
from agentkernel.cli import CLI
from agentkernel.adk import ADKModule
# Define your agent
agent = ADKAgent(
name="assistant",
model="gemini-2.0-flash-exp",
instructions="You are a helpful AI assistant. Provide clear and concise answers.",
)
# Register with Agent Kernel
ADKModule([agent])
if __name__ == "__main__":
CLI.main()
3. Set API Key
export GOOGLE_API_KEY=your-api-key-here
4. Run Your Agent
python my_agent.py
Testing Your Agent
Once your agent is running, you'll see an interactive CLI:
(kernel) >> Using in-memory session store
AgentKernel CLI (type !help for commands or !quit to exit):
(kernel) >> No agent was requested. Defaulting to first agent in the list
(kernel) >> Selected agent: triage
(kernel) >> Starting new session: 07ec500e-f103-4b0e-8ecb-d794232f5992
(triage) >>
(triage) >> !list
Available agents:
triage
math
general
(triage) >> !select math
(math) >> What is 2 + 2?
[math agent responds]
(math) >> 2 + 2 = 4. This is basic addition where we combine two quantities...
(math) >>
Understanding the Structure
Every Agent Kernel application follows this pattern:
- Define agents using your preferred framework
- Wrap them in an Agent Kernel Module
- Run them using Agent Kernel's execution modes (CLI, API, AWS, etc.)
Next Steps
Add Custom Tools
Enhance your agent with custom tools:
from crewai import Agent, Tool
def search_database(query: str) -> str:
# Your custom logic
return f"Results for: {query}"
search_tool = Tool(
name="search",
description="Search the database",
func=search_database
)
agent = Agent(
role="researcher",
goal="Find information",
backstory="You are a research assistant",
tools=[search_tool],
verbose=False
)