Skip to main content
Travel planning agent with web search for finding flights, hotels, and creating itineraries.

Simple

Agents: 1 — Single agent with search tool handles research and planning.

Workflow

  1. Receive travel request
  2. Search for flights and hotels
  3. Generate detailed itinerary

Setup

pip install praisonaiagents praisonai duckduckgo-search
export OPENAI_API_KEY="your-key"

Run — Python

from praisonaiagents import Agent
from praisonaiagents import duckduckgo

agent = Agent(
    name="TravelPlanner",
    instructions="You are a travel planning agent. Create detailed itineraries.",
    tools=[duckduckgo]
)

result = agent.start("Plan a 3-day trip to Tokyo")
print(result)

Run — CLI

praisonai "Plan a weekend trip to Paris" --web-search

Run — agents.yaml

framework: praisonai
topic: Travel Planning
roles:
  travel_planner:
    role: Travel Planning Specialist
    goal: Create comprehensive travel plans
    backstory: You are an expert travel planner
    tools:
      - duckduckgo
    tasks:
      plan_trip:
        description: Plan a 3-day trip to Tokyo
        expected_output: A detailed itinerary
praisonai agents.yaml

Serve API

from praisonaiagents import Agent
from praisonaiagents import duckduckgo

agent = Agent(
    name="TravelPlanner",
    instructions="You are a travel planning agent.",
    tools=[duckduckgo]
)

agent.launch(port=8080)
curl -X POST http://localhost:8080/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Plan a weekend getaway to Barcelona"}'

Advanced Workflow (All Features)

Agents: 1 — Single agent with memory, persistence, structured output, and session resumability.

Workflow

  1. Initialize session for trip tracking
  2. Configure SQLite persistence for travel history
  3. Search and plan with structured output
  4. Store itinerary in memory for modifications
  5. Resume session for trip updates

Setup

pip install praisonaiagents praisonai duckduckgo-search pydantic
export OPENAI_API_KEY="your-key"

Run — Python

from praisonaiagents import Agent, Task, Agents, Session
from praisonaiagents import duckduckgo
from pydantic import BaseModel

# Structured output schema
class Itinerary(BaseModel):
    destination: str
    duration: str
    daily_plans: list[str]
    estimated_cost: str
    recommendations: list[str]

# Create session for trip tracking
session = Session(session_id="trip-001", user_id="user-1")

# Agent with memory and tools
agent = Agent(
    name="TravelPlanner",
    instructions="Create structured travel itineraries.",
    tools=[duckduckgo],
    memory=True
)

# Task with structured output
task = Task(
    description="Plan a 3-day trip to Tokyo with budget",
    expected_output="Structured itinerary",
    agent=agent,
    output_pydantic=Itinerary
)

# Run with SQLite persistence
agents = Agents(
    agents=[agent],
    tasks=[task],
    memory=True
)

result = agents.start()
print(result)

# Resume later
session2 = Session(session_id="trip-001", user_id="user-1")
history = session2.search_memory("Tokyo")

Run — CLI

praisonai "Plan a trip to Tokyo" --web-search --memory --verbose

Run — agents.yaml

framework: praisonai
topic: Travel Planning
memory: true
memory_config:
  provider: sqlite
  db_path: travel.db
roles:
  travel_planner:
    role: Travel Planning Specialist
    goal: Create structured travel plans
    backstory: You are an expert travel planner
    tools:
      - duckduckgo
    memory: true
    tasks:
      plan_trip:
        description: Plan a 3-day trip to Tokyo with budget
        expected_output: Structured itinerary
        output_json:
          destination: string
          duration: string
          daily_plans: array
          estimated_cost: string
          recommendations: array
praisonai agents.yaml --verbose

Serve API

from praisonaiagents import Agent
from praisonaiagents import duckduckgo

agent = Agent(
    name="TravelPlanner",
    instructions="Create structured travel itineraries.",
    tools=[duckduckgo],
    memory=True
)

agent.launch(port=8080)
curl -X POST http://localhost:8080/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Plan a trip to Paris", "session_id": "trip-001"}'

Monitor / Verify

praisonai "test planning" --web-search --verbose

Cleanup

rm -f travel.db

Features Demonstrated

FeatureImplementation
WorkflowMulti-step travel planning
DB PersistenceSQLite via memory_config
Observability--verbose flag
ToolsDuckDuckGo search
ResumabilitySession with session_id
Structured OutputPydantic Itinerary model

Next Steps