> For the complete documentation index, see [llms.txt](/llms.txt).
> A full single-fetch corpus is available at [llms-full.txt](/llms-full.txt).
---
title: Build a travel booking agent
description: A single agent that searches real flights and hotels via SerpAPI, builds a day-by-day itinerary, and handles multi-turn conversations about a trip.
tags: ["Agents", "Tools", "Conversation"]
date: 2026-06-12
last_verified: 2026-06-12
audience: both
---

This cookbook builds a travel booking agent that searches live flight and hotel
data, builds a day-by-day itinerary, and handles a full multi-turn conversation
about a trip inside a single durable workflow run.

## What you build

- A `travel_booking_agent` with three tools: flight search, hotel search, and itinerary creation.
- A workflow that takes a user message and runs the agent to completion.
- Real-time data from SerpAPI Google Flights and Google Hotels.
- Conversation-aware responses that carry context across multiple turns.

## Workflow shape

```python
@workflow
async def travel_booking_workflow(ctx: WorkflowContext, message: str) -> dict:
    result = await travel_booking_agent.run(message, context=ctx)
    return {"status": "completed", "output": result.output}
```

The agent handles all the tool orchestration internally. The workflow is a single
durable step that checkpoints the agent's tool calls and model responses.

## Agent and tools

The agent decides when to call each tool based on the conversation:

```python
travel_booking_agent = Agent(
    name="travel_booking_agent",
    model="openai/gpt-4o-mini",
    instructions="...",  # see agents.py
    tools=[search_flights, search_hotels, create_itinerary],
)
```

| Tool | Data source | What it returns |
|---|---|---|
| `search_flights` | SerpAPI Google Flights | Top 3 options with price, airline, times, duration |
| `search_hotels` | SerpAPI Google Hotels | Top 3 options with price, rating, reviews, amenities |
| `create_itinerary` | Agent-generated | Day-by-day plan combining flight and hotel details |

For a trip-planning request, the agent always runs all three tools in sequence —
flights first, then hotels, then itinerary — without prompting the user between steps.

## Tool inputs

**search_flights**

```python
search_flights(
    departure_id="JFK",    # airport code, inferred from city name
    arrival_id="LHR",
    outbound_date="2025-12-15",
    return_date="2025-12-22",   # omit for one-way
    adults=1,
)
```

**search_hotels**

```python
search_hotels(
    location="London, UK",
    check_in_date="2025-12-15",
    check_out_date="2025-12-22",
    adults=1,
)
```

**create_itinerary**

```python
create_itinerary(
    destination="London",
    travel_dates="Dec 15–22 2025",
    preferences="Solo traveler, budget-conscious",
)
```

## Conversation awareness

The agent receives the full conversation history on every turn. The instructions
explicitly require it to check what the user already said before asking for more
details:

- It infers airport codes from city names (New York → JFK, Paris → CDG).
- It never re-asks for information already provided earlier in the thread.
- After presenting results it proactively offers the next step.

## Prerequisites

- An AGNT5 account. Sign up at [app.agnt5.com](https://app.agnt5.com).
- Python 3.11+ and [uv](https://docs.astral.sh/uv/getting-started/installation/).
- An [OpenAI API key](https://platform.openai.com/api-keys).
- A [SerpAPI key](https://serpapi.com/) for live flight and hotel data.

---

## Step 1: Install the CLI

Follow the [CLI install guide](/docs/install-cli.md) to install `agnt5` and authenticate. Come back when `agnt5 auth status` confirms you are signed in.

---

## Step 2: Create the project

```bash
agnt5 create --template python/travel_booking my-travel-bot
cd my-travel-bot
uv sync
```

---

## Step 3: Configure environment variables

```bash
cp .env.example .env
```

Open `.env` and set both keys:

```bash
OPENAI_API_KEY="sk-..."
SERPAPI_KEY="your-serpapi-key"
```

---

## Step 4: Deploy

```bash
agnt5 deploy
```

---

## Step 5: Run the agent

You can run the workflow directly from Studio. Open your deployment, select `travel_booking_workflow` from the Components list, and click **Run Workflow**. Pass a natural-language travel request as the `message` input.

The agent runs `search_flights`, `search_hotels`, and `create_itinerary` in one turn and returns a complete travel plan with specific flight options, hotel options, and a day-by-day itinerary.

<DocsImage
  src="/docs/integrations/Trace-dev-light.png"
  darkSrc="/docs/integrations/Trace-dev-dark.png"
  alt="Studio showing a completed travel_booking_workflow run with the agent trace expanded, displaying search_flights and search_hotels tool calls and the final itinerary output."
  caption="Studio traces every agent iteration, tool call, and model response. Click any step to inspect its input, output, tokens, and duration."
  width={1682}
  height={1060}
/>

Go to **Runs** to see the full execution history. Each agent iteration, tool call, and model response is recorded as a step in the trace.

<DocsImage
  src="/docs/integrations/Runs-light.png"
  darkSrc="/docs/integrations/Runs-dark.png"
  alt="Studio Runs list showing completed travel_booking_workflow runs with status, duration, and timestamp."
  caption="The Runs list shows every workflow execution. Click a run to open its trace."
  width={1746}
  height={954}
/>

---

## Production checklist

- **SerpAPI quota**: each tool call consumes one SerpAPI search credit. Monitor usage for high-volume deployments.
- **Airport code inference**: the agent infers codes from common cities. For uncommon airports, pass the IATA code directly in the message.
- **Itinerary detail**: `create_itinerary` returns a framework. The agent combines it with real flight and hotel data to produce the final response. The quality of the day-by-day plan depends on the model.
- **Secrets**: never commit `.env`. Inject `OPENAI_API_KEY` and `SERPAPI_KEY` as secrets in your deployment environment.

---

## Next steps

- [Build a deep research agent](/cookbooks/deep-research-agent.md): same agent-plus-tools pattern with Wikipedia and web search.
- [Build a durable human-approval AI workflow](/cookbooks/durable-human-approval-ai-workflow.md): add an approval gate before the agent acts on a booking.
- [Debug AI workflows with traces, not scattered logs](/cookbooks/workflow-native-observability.md): inspect every tool call and model response in the trace.
