Collaborative Travel Assistant Agent
A collaborative travel planning assistant built with Smolagents that helps users plan trips through conversation, with consent-based tool usage, feasibility checking, and personalized recommendations.
π― Goal
A personalized travel-planning assistant that guides users toward well-informed trip decisions through:
- Collaborative conversation with consent-based tool usage
- Progressive disclosure to avoid overwhelming users
- Feasibility checking before finalizing plans
- User preference modeling for personalized recommendations
π οΈ Tools Available
user_input_toolβ Ask contextual questions and wait for user responsesinfer_task_commonground_from_conversationβ Summarize agreed-upon constraints/preferencesinfer_user_profile_from_conversationβ Build actionable bullet-point profile of inferred user preferencesweb_search_tool(Bing) β Look up current travel information (max 3 results) with user consentvisit_webpage_toolβ Extract information from specific web pages with user consentfeasibility_guard(new) β Quick PASS/FAIL on time/budget realism with concrete adjustment suggestions
π Key Requirements
| ID | Requirement | Linked Principle |
|---|---|---|
| R1 | Consent before external calls β Ask "Proceed to look up X?"; only search on explicit "yes" | G3, G7 |
| R2 | Chunked replies (2β3 bullets) + "Want more?" prompt | G5, G8 |
| R3 | Common ground & user model refresh after key info is learned | G1, G3 |
| R4 | Feasibility-first β Run feasibility_guard before proposing final plans |
G4, G6 |
| R5 | Keep tone casual; end each turn with 1 clear next question/choice | G1 |
π Quick Start
Installation
pip install 'smolagents[litellm]'
pip install 'smolagents[gradio]'
pip install markdownify ddgs
Load the Agent
from smolagents import CodeAgent
# Load from HuggingFace Hub
agent = CodeAgent.from_hub(
"mathilda1110/travel-assistant-agent",
trust_remote_code=True
)
# Or load directly from agent.py
from agent import create_travel_assistant
agent = create_travel_assistant()
Use the Agent
# Run a single query
response = agent.run("I want to plan a 4-day trip to Japan with a budget of Β₯90,000")
# Or interact in a loop
agent.memory.reset()
while True:
user_input = input("You: ")
if user_input.lower() in ['exit', 'quit']:
break
response = agent.run(user_input)
print(f"Agent: {response}")
Using with Gradio UI
from agent import create_travel_assistant
from smolagents.gradio_ui import GradioUI
agent = create_travel_assistant()
GradioUI(agent).launch()
π§ Configuration
Model Setup
The agent uses AWS Bedrock by default. Set environment variables:
export AWS_ACCESS_KEY_ID=your_key
export AWS_SECRET_ACCESS_KEY=your_secret
export AWS_REGION_NAME=us-east-1
export MODEL_ID=us.meta.llama3-3-70b-instruct-v1:0 # Optional, for custom model
Alternatively, you can use any model supported by LiteLLM by passing a custom model to create_travel_assistant(model=your_model).
Web Search Setup
For web search functionality, you may need to set up Bing API keys:
export BING_SUBSCRIPTION_KEY=your_key
π¨ Key Improvements Over Baseline
1. Consent-Based Tool Usage
- Before: Agent triggered web searches without asking
- After: Agent asks "I can fetch live prices. Proceed? (Yes/No)" before searching
- Benefit: Transparent actions, fewer failed/unused calls
2. Chunked Information Disclosure
- Before: Long, dense replies with many items at once
- After: 2β3 key points at a time, with "Want more details?" prompt
- Benefit: Reduced cognitive load, better user experience
3. Feasibility Guard
- Before: Plans could exceed budget/time without warnings
- After: Automatic feasibility check before finalizing plans with concrete adjustments
- Benefit: Early detection of unrealistic plans, actionable fixes
π Framework
Built with Smolagents - a lightweight, code-first agent framework from Hugging Face.
π License
Apache 2.0
π€ Author
mathilda1110
Note: This agent follows human-centered AI design principles (Microsoft Guidelines for Human-AI Interaction) to provide a better collaborative experience.
Model tree for mathilda1110/travel-assistant-agent
Base model
meta-llama/Llama-3.1-70B