Build your first AI agent.
AgentFlow combines knowledge grounding, action tools, interactive testing, and multi-channel deployment into a single developer workspace. Follow this guide to initialize an agent and connect your first channel.
Define roles, instructions, and guardrails on the visual canvas.
Index PDFs, crawl websites, and verify grounded vector citations.
Hook up Stripe, Zendesk, Slack, or custom webhook actions.
Go live on your website widget, WhatsApp, email, or via API.
1. Installation
Install the AgentFlow JavaScript/TypeScript SDK via npm, yarn, or pnpm:
npm install @agentflow/sdk2. Authentication
Retrieve your API key from your workspace settings and initialize the client:
import { AgentFlow } from '@agentflow/sdk';
const client = new AgentFlow({
apiKey: process.env.AGENTFLOW_API_KEY, // e.g. af_live_948f2...
});3. Create an agent
Define an agent programmatically or customize one created on the visual canvas:
const agent = await client.agents.create({
name: 'Support Agent',
model: 'gpt-4o',
instructions: 'You are a concise Tier-1 support agent. Ground every reply in official documentation.',
knowledgeSourceIds: ['kb_product_docs', 'kb_refund_policy'],
toolIds: ['tool_stripe_lookup', 'tool_zendesk_ticket'],
});
console.log('Agent ready with ID:', agent.id);4. Embed on your website
Add the lightweight chat widget to your web application using a single script tag:
<!-- Add to your <head> or <body> -->
<script
src="https://cdn.agentflow.ai/widget.js"
data-agent-id="agt_support_101"
data-theme="auto"
async
></script>REST API Direct Access
Execute conversations from any language or backend environment.
curl -X POST https://api.agentflow.ai/v1/conversations \
-H "Authorization: Bearer af_live_948f2..." \
-H "Content-Type: application/json" \
-d '{
"agentId": "agt_support_101",
"message": "Can you check my duplicate invoice #INV-8921?",
"stream": false
}'