import { Agent, openai } from '@runflow-ai/sdk';
import { createTool } from '@runflow-ai/sdk';
import { z } from 'zod';
const onboardingAgent = new Agent({
name: 'Onboarding Assistant',
instructions: `You are an onboarding specialist.
- Guide users step by step
- Celebrate their progress
- Provide helpful resources
- Detect when they're stuck and offer help
- Track completion of onboarding steps`,
model: openai('gpt-4o'),
memory: {
maxTurns: 50, // Long conversation
summarizeAfter: 20,
summarizePrompt: 'Summarize onboarding progress, completed steps, and next actions',
},
rag: {
vectorStore: 'onboarding-docs',
k: 3,
},
tools: {
markStepComplete: createTool({
id: 'mark-step-complete',
description: 'Mark an onboarding step as complete',
inputSchema: z.object({
stepName: z.string(),
userId: z.string(),
}),
execute: async ({ context }) => {
await updateOnboardingProgress(
context.stepName,
context.userId
);
return { success: true };
},
}),
},
});
// Interactive onboarding session
const sessionId = `onboarding_user_${userId}`;
// Step 1
await onboardingAgent.process({
message: 'Start onboarding for new user',
sessionId,
userId,
});
// User responds
await onboardingAgent.process({
message: 'I want to create my first agent',
sessionId,
userId,
});
// Agent guides through agent creation...