Best Practices
Agent Design Patterns
Section titled “Agent Design Patterns”News Scraper + Summarizer
Section titled “News Scraper + Summarizer”Start (cron: "0 9 * * *") -> HTTP API (fetch news API) -> Agent (summarize top stories) -> EndSocial Media Monitor
Section titled “Social Media Monitor”Start (mention trigger) -> Agent (classify intent: question, complaint, praise, spam) -> If/Else (is spam?) -> True: End -> False: Agent (generate response with brand memory) -> EndResearch Assistant
Section titled “Research Assistant”Start (manual) -> Agent (break down query into sub-questions) -> Parallel Fork -> HTTP API (source 1) -> HTTP API (source 2) -> Parallel Join -> Agent (synthesize findings) -> EndCode Review Bot
Section titled “Code Review Bot”Start (webhook from GitHub) -> HTTP API (fetch PR diff) -> Agent (review code for bugs and style) -> EndCost Optimization
Section titled “Cost Optimization”- Use cheaper models for simple tasks —
gpt-4o-minihandles most classification and formatting - Limit chat history — Set
chatHistoryLimitto 10-20 messages instead of unlimited - Use routing strategies — Let the system pick the optimal model per request
- Set budget limits — Configure daily/monthly budgets to prevent runaway costs
- Cache with brand memory — Pre-load common knowledge instead of re-fetching
Common Mistakes
Section titled “Common Mistakes”- Overly broad system prompts — Be specific about what the agent should do
- Missing error handling — Use guardrail nodes to catch bad inputs
- No budget limits — Always set daily limits on production agents
- Too many tool iterations — Set
maxToolIterationsto prevent infinite loops - Ignoring chat history costs — Long conversations can be expensive with large models