Project Structure
Step 1: Define Your Prompt
Start with well-structured instructions that tell the agent how to behave, when to use tools, and how to respond.prompts/index.ts
Step 2: Create Your Tools
Each tool lives in its own file with clear input validation and structured responses.tools/search-orders.ts
tools/create-ticket.ts
tools/index.ts
Step 3: Configure the Agent
agent.ts
Step 4: Wire Everything in main.ts
main.ts
Setting Up the Knowledge Base
Upload your documentation to power RAG:Key Takeaways
- Separate concerns: tools, prompts, and agent config in their own files
- Always identify: call
identify()beforeagent.process()for proper memory and tracing - Track metrics: use
track()in tools and main.ts to power dashboards - Handle errors: validate input, try/catch in main, return error objects from tools
- Write specific instructions: tell the agent exactly when and how to use each tool
- Use RAG wisely: write a specific
searchPromptso the agent knows when to search
Next Steps
Collections Agent
WhatsApp collections example
Knowledge (RAG)
Learn more about RAG
Best Practices
Tips for effective agents
Project Structure
Organize your project