mathilda1110's picture
Upload README.md with huggingface_hub
d2106e7 verified
|
Raw History Blame Contribute Delete
4.7 kB
metadata
license: apache-2.0
base_model: meta-llama/Llama-3.3-70B-Instruct
tags:
  - agent
  - travel
  - planning
  - collaborative
  - smolagents
library_name: smolagents

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 responses
  • infer_task_commonground_from_conversation – Summarize agreed-upon constraints/preferences
  • infer_user_profile_from_conversation – Build actionable bullet-point profile of inferred user preferences
  • web_search_tool (Bing) – Look up current travel information (max 3 results) with user consent
  • visit_webpage_tool – Extract information from specific web pages with user consent
  • feasibility_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.