Installation
First, install the Icepick SDK:Basic Setup
Create your agent in a separate file (e.g.,lib/agents/my-agent.ts):
API Routes Integration
Create an API route to handle agent execution (pages/api/agent.ts or app/api/agent/route.ts):
Pages Router
App Router
Client-Side Usage
Use the agent from your React components:Server Actions (App Router)
For App Router, you can also use Server Actions:Environment Configuration
Add your Hatchet configuration to.env.local:
Deployment
When deploying to Vercel or other platforms, ensure your environment variables are configured and your agent workflows are properly registered. For serverless deployments, consider usingrunNoWait() for long-running agents and add a get endpoint to subscribe to the result to avoid timeout issues.
