Skip to main content

Full Example: Book Recommendation Agent

Here’s a complete example that demonstrates the various language constructs working together, including multiple until statements:

Key Takeaways

This example demonstrates several important Based patterns:
  1. State Management: Using the state dictionary to persist user intent and preferences across conversation turns
  2. Multiple Until Conditions: Handling different user intents (recommendations, new releases, availability) with separate until blocks
  3. Nested Loops: Using inner loop-until patterns for collecting additional information when needed
  4. API Integration: Making HTTP requests to external services and using .ask() to extract structured data from responses
  5. Dynamic Responses: Building personalized responses based on extracted user data

Conclusion

The Based language provides a powerful yet intuitive framework for building conversational agents. By mastering the core constructs—particularly the essential loop-talk-until pattern—you can create sophisticated conversation flows that handle complex interactions while maintaining readability and maintainability. Remember that Based is designed to be declarative, allowing you to focus on the “what” rather than the “how” of conversational AI. This approach dramatically reduces the amount of code needed to create powerful agents while increasing reliability and ease of maintenance. The combination of the core language constructs with platform-specific functions allows you to build agents that take full advantage of each deployment platform’s unique capabilities while maintaining a consistent codebase and user experience.