Quick Start Guide
Build your first agentic AI solution with Kodey.ai in minutes
This guide will walk you through creating, configuring, and deploying your first AI agent on the Kodey.ai platform. By the end, you'll have a functioning agent that can be accessed via API, WebSocket, or embedded in a web application.
Prerequisites
Before you begin, ensure you have:
- Node.js v18 or higher installed
- A Kodey.ai account (sign up at developer.kodey.ai if you don't have one)
- Your Kodey.ai API key (available from your developer dashboard)
Step 1: Install the Kodey CLI
The Kodey CLI is the fastest way to get started. Open your terminal and run:
npm install -g @kodey/cli
Verify the installation was successful:
kodey --version
Step 2: Create a New Agent Project
Initialize a new agent project:
kodey init my-first-agent
cd my-first-agent
This creates a new directory with all the necessary files for your agent.
Step 3: Configure Your Agent
Open the generated config/agent_config.yaml
file and customize your agent:
agent:
name: "my_assistant"
description: "A helpful assistant that can answer questions and perform tasks"
type: "assistant"
# Configure which tools your agent can use
tools:
- name: "web_search"
enabled: true
- name: "calculator"
enabled: true
# Choose your preferred language model
model:
provider: "anthropic"
model_name: "claude-3-sonnet"
Then set up your API keys by creating a .env
file:
KODEY_API_KEY=your_kodey_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key
Step 4: Add a Custom Tool (Optional)
Create a custom tool to extend your agent's capabilities:
- Create a new file in the tools directory:
mkdir -p tools/custom
touch tools/custom/weather_tool.py
- Implement your tool:
# tools/custom/weather_tool.py
from kodey.tools import BaseTool
import requests
class WeatherTool(BaseTool):
"""Tool for fetching current weather information."""
name = "weather"
description = "Gets the current weather for a given location"
def _run(self, location: str) -> str:
"""Get weather for the specified location."""
# Example implementation - replace with actual API call
api_key = self.get_env_variable("WEATHER_API_KEY")
response = requests.get(
f"https://api.weatherapi.com/v1/current.json?key={api_key}&q={location}"
)
data = response.json()
return f"Current weather in {location}: {data['current']['temp_c']}°C, {data['current']['condition']['text']}"
- Register your tool in the agent config:
tools:
- name: "weather"
enabled: true
config:
api_key: "${WEATHER_API_KEY}"
- Add the required API key to your
.env
file:
WEATHER_API_KEY=your_weather_api_key
Step 5: Test Your Agent Locally
Run your agent in development mode to test it:
kodey dev
This starts a local development server where you can interact with your agent through a test interface. Try sending messages like:
- "What's the weather in New York?"
- "Calculate 15% of 85.75"
- "Tell me about machine learning"
Step 6: Deploy Your Agent
When you're satisfied with your agent's functionality, deploy it to the Kodey.ai platform:
kodey deploy
After a successful deployment, you'll receive:
- A unique agent URL
- API endpoint information
- WebSocket connection details
- HTML code snippet for web integration
Step 7: Integrate Your Agent
REST API Integration
To use your agent via the REST API:
// JavaScript example
async function callAgent(message) {
const response = await fetch('https://api.kodey.ai/agents/my-first-agent', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
messages: [{ role: 'user', content: message }]
})
});
return response.json();
}
// Usage
callAgent("What's the weather in London?").then(console.log);
Web Integration
To embed your agent in a web application, use the provided HTML snippet:
<div id="kodey-agent"></div>
<script src="https://cdn.kodey.ai/embed.js"></script>
<script>
Kodey.init({
agentId: 'my-first-agent',
targetElementId: 'kodey-agent',
apiKey: 'YOUR_PUBLIC_API_KEY'
});
</script>
Next Steps
Congratulations! You've built and deployed your first Kodey.ai agent. Here are some next steps to enhance your agent:
- Add More Tools: Explore the
tools/
directory to add more capabilities - Customize Behavior: Adjust your agent's personality and responses in the config
- Set Up Workflows: Create complex sequences using the workflow agent type
- Connect Data Sources: Integrate databases or APIs using the data connectors
For more detailed information, check out:
Happy building!