Project Structure
Step 1: Define Onboarding Steps
Keep step definitions in a config file so they’re easy to update:config/steps.ts
Step 2: Progress Tools
Tools for tracking and querying onboarding progress:tools/get-progress.ts
tools/mark-step-complete.ts
tools/index.ts
Step 3: Prompt
prompts/index.ts
Step 4: Agent Definition
agent.ts
Step 5: Main Entry Point
main.ts
Key Patterns
Long-Running Conversations
Onboarding happens over days or weeks. Use highmaxTurns and summarizeAfter to preserve context without losing important progress information:
Progress-Aware Agent
The agent callsget-progress at the start of each conversation to know exactly where the user is. This means it can pick up right where they left off — even days later.
Step Validation with Enums
Using TypeScript enums for step IDs ensures the LLM can only mark valid steps as complete:Next Steps
Memory
Long conversation management
Knowledge (RAG)
Power the docs search
Customer Support
Support agent example
Best Practices
Tips for effective agents