Prerequisites
- API key for your chosen LLM provider
- Basic programming knowledge
- Node.js 20+ installed (required for frontend development)
- npm or yarn package manager
- Basic TypeScript knowledge
- Manual Setup
- CLI (Coming Soon)
1
Create Project Structure
Create a new directory and initialize the project:Install AG-Kit dependencies:Initialize TypeScript:
2
Create Your Agent
Create your agent file with a simple OpenAI-based agent:Create For more advanced Agent configuration options, see the LangGraph Agent reference.
src/agent.ts:3
Create Server
Create your server file to run your agent:Create Note: When using ES modules, you must use the
src/server.ts:.js extension in imports.For more server configuration options, see Run Agent.4
Configure Environment
Create a Add development scripts:Add to
.env file with your API key:AG-Kit supports multiple LLM providers through OpenAI-compatible APIs. Choose your preferred model:- OpenAI
- Zhipu GLM-4
- Qwen
- DeepSeek
- Local (Ollama)
package.json:5
Start the Server
Start your agent server:You should see:
6
Test with cURL
Test your agent with a simple request:You should get a streaming response with events like:
7
Create Frontend
Create a new directory for the frontend and set it up:Create Create Create Add to Start the frontend:Open
index.html:src/main.tsx:vite.config.ts:package.json:http://localhost:5173 in your browser!For more UI component options, see the UI Components reference.8
Try It Out
Test your agent with these messages:
- “Hello, how are you?” - Basic greeting
- “What can you help me with?” - Capability exploration
- “Tell me about AI” - Knowledge demonstration
- “Write a short poem” - Creative task
- “Alert me with a message” - Test the custom tool (TypeScript frontend only)
What You’ve Built
Congratulations! You’ve created:- An Agent with custom tools and state management
- A Backend Service that handles Agent requests
- A Frontend Application with real-time chat
Architecture
Next Steps
Now that you have a working Agent, explore more features:Core Concepts
Understand Agents, State, and Tools
Agent Reference
Complete Agent API documentation
Tools
Add more capabilities with tools
Run Agent
Server configuration and deployment
UI Components
Build custom user interfaces
Deployment
Deploy to production
Troubleshooting
Server won't start
Server won't start
- Check that port 9000 is not in use
- Verify your
.envfile has the API key - Check console for error messages
Frontend can't connect
Frontend can't connect
- Ensure the Agent server is running
- Check the server URL in your frontend configuration
- Verify CORS settings in server config
Agent not responding
Agent not responding
- Check your OpenAI API key is valid
- Verify you have API credits
- Check server logs for errors
Setup errors
Setup errors
Learn More
- Core Concepts - Deep dive into AG-Kit architecture
- Examples - More example applications
- API Reference - Complete API documentation
- Community - Join our Discord and GitHub