A clean, single-agent travel planning system built with Claude API and direct tool integration (no MCP needed!).
Flub Agent is a simple, powerful travel planning assistant that uses Claude's native function calling with direct Python tool integration for flight search and other travel services.
- Single Agent Architecture: One Claude agent with direct access to all tools
- No MCP Complexity: Tools are simple Python functions - no servers to run
- Natural Tool Selection: Claude automatically uses the right tools for each query
- Conversation Context: Maintains history for multi-turn planning
- Easy to Extend: Add new tools by creating Python functions
- Python 3.10+
- An Anthropic API key
- (Optional) Bun or Node.js for iMessage integration
- Clone and navigate to the repository
cd flub-agent- Install dependencies
# Python dependencies
pip install -r requirements.txt
# Optional: For iMessage integration
bun install- Set up environment variables
Create a
.envfile:
ANTHROPIC_API_KEY=your_anthropic_api_key_here- Run the agent
# Test the agent
python main.py
# Or start the API server for iMessage integration
python agent_server.pyfrom src.simple_agent import SimpleFlubAgent
# Create agent
agent = SimpleFlubAgent()
# Ask a question
response = agent.process("What's the cheapest flight from EWR to LAX on 2025-11-10?")
print(response)agent = SimpleFlubAgent()
# First query
response1 = agent.process("Find flights from NYC to LA on December 1st")
print(response1)
# Follow-up with context
response2 = agent.process("What's the cheapest option?")
print(response2)
# Clear history when done
agent.clear_history()flub-agent/
├── src/
│ ├── simple_agent.py # Main agent using Claude function calling
│ └── tools/ # Tool functions
│ ├── __init__.py
│ └── flight_search.py # Flight search tools
├── main.py # Test/demo entry point
├── agent_server.py # HTTP API server for iMessage integration
├── imessage-watcher.ts # TypeScript iMessage watcher
├── requirements.txt # Python dependencies
├── package.json # Node dependencies
├── .env # Environment variables (create this)
├── README.md # This file
├── CONVERTING_MCPS.md # Guide for converting MCP servers
└── IMESSAGE_SETUP.md # iMessage integration guide
User Query
↓
SimpleFlubAgent (Claude with Function Calling)
│
├─ Tool: search_flights()
├─ Tool: find_best_price()
└─ Tool: [Add more tools...]
│
↓
Claude automatically selects and calls appropriate Python functions
↓
Unified Response
search_flights
- Search for flights between airports on a specific date
- Parameters: date, from_airport, to_airport, adults, max_results
- Returns: List of flights with pricing, duration, and details
find_best_price
- Find the cheapest flight for a route and date
- Parameters: date, from_airport, to_airport, adults
- Returns: Cheapest flight with price comparisons
To add a new tool:
- Create a tool file in
src/tools/:
# src/tools/weather.py
def get_weather(city: str, date: str):
"""Get weather forecast for a city on a specific date."""
# Your implementation
return {"temperature": 72, "conditions": "sunny"}- Export it in
src/tools/__init__.py:
from .flight_search import search_flights, find_best_price
from .weather import get_weather
__all__ = ['search_flights', 'find_best_price', 'get_weather']- Register it in
src/simple_agent.py:
# Import the tool
from tools import get_weather
# Add to self.tools list
self.tools.append({
"name": "get_weather",
"description": "Get weather forecast for a city on a specific date",
"input_schema": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"},
"date": {"type": "string", "description": "Date in YYYY-MM-DD format"}
},
"required": ["city", "date"]
}
})
# Add to _call_tool method
def _call_tool(self, tool_name: str, tool_input: Dict[str, Any]):
if tool_name == "get_weather":
return get_weather(**tool_input)
# ... existing toolsThat's it! No servers to run, no HTTP endpoints to configure.
SimpleFlubAgent(api_key: Optional[str] = None)Methods:
process(message: str) -> str: Process a message and return responseclear_history(): Clear conversation history
Want to respond to text messages automatically? Check out IMESSAGE_SETUP.md!
Quick start:
# Terminal 1: Start the API server
python agent_server.py
# Terminal 2: Start the iMessage watcher
bun run watchNow text your Mac: "What's the best flight from EWR to LAX tomorrow?"
See main.py for a working example:
from datetime import datetime, timedelta
from src.simple_agent import SimpleFlubAgent
agent = SimpleFlubAgent()
tomorrow = (datetime.now() + timedelta(days=1)).strftime("%Y-%m-%d")
response = agent.process(f"What is the best flight from EWR to LAX on {tomorrow}?")
print(response)Required:
ANTHROPIC_API_KEY: Your Anthropic API key
Make sure ANTHROPIC_API_KEY is set in your .env file.
Make sure you're running from the project root:
cd /path/to/flub-agent
python main.pyIf a tool fails, check the error message in the response. The agent will report tool errors gracefully.
MIT License
For issues and questions, please open an issue on the repository.