Intelligent Components
React revolutionized web development with components that combine logic, structure, and style. Now, with assistant-ui, we're adding a fourth dimension: intelligence. Let's learn how to build smart components through a practical banking app example.
The Evolution of Components
Traditional React components combine three elements:
Adding Intelligence
With assistant-ui, we can enhance this component with intelligence using four powerful APIs:
1. Making Components Readable (makeAssistantVisible)
First, let's make our buttons "readable" and interactive:
Now the assistant can:
- Understand the transaction history structure
- Interact with refund buttons
- Help users manage their transactions
2. Adding System Instructions (useAssistantInstructions)
Next, let's give the assistant specific instructions about its role:
3. Creating Tools (makeAssistantTool)
Let's add transaction-specific tools for the assistant:
4. Adding Custom Context (Model Context)
Finally, let's add dynamic context based on the user's transaction patterns:
The Result: An Intelligent Banking Experience
This enhanced component now provides:
- Natural language interaction with transaction history
- Contextual help for understanding transactions
- Automated transaction analysis
- Smart refund assistance
The assistant can now:
- Read and understand transaction details
- Follow banking-specific guidelines
- Use tools to analyze transactions
- Access user patterns for personalized help
This creates a more intuitive and safer banking experience while maintaining the familiar React component model.
Next Steps
Learn more about each API:
- makeAssistantVisible for component understanding
- makeAssistantTool for transaction analysis
- useAssistantInstructions for behavior guidance
- Model Context for dynamic context management