# Customer Service Assistant

Conversational travel booking agent that searches real flights and hotels with SerpAPI and builds a day-by-day itinerary over a multi-turn chat.

- Category: Customer Support / Chatbots
- Capabilities: agents, memory, workflows, integrations, tooling
- Source code: [python](https://github.com/agnt5dev/templates/tree/main/python/travel_booking_customer_service), [typescript](https://github.com/agnt5dev/templates/tree/main/typescript/travel_booking_customer_service), [go](https://github.com/agnt5dev/templates/tree/main/go/travel_booking_customer_service)
- [All templates](https://agnt5.com/templates.md)

The travel-booking template is a single conversational agent that searches real flights and hotels via SerpAPI's Google Flights/Hotels data, then assembles a day-by-day itinerary. It's a multi-turn chat agent. In Python, passing `context=ctx` into `agent.run(...)` is enough - the SDK loads and saves conversation history on the workflow context automatically, with no separate entity or database. In TypeScript, `agent.run(message, ctx)` does **not** persist history by itself; you must load and pass the prior turns explicitly via the `history` argument if you want the agent to remember earlier turns.

## What you'll build

- A `travel_booking_agent` with three tools: `search_flights`, `search_hotels`, and `create_itinerary`
- Automatic multi-step tool orchestration - when a user asks to "plan my trip," the agent chains flight search, hotel search, and itinerary creation in one turn
- Durable multi-turn conversation state, so the agent never re-asks for details already given
- Airport-code inference so users can say "New York to London" instead of "JFK to LHR"

## Requirements

- Python 3.12+ or Node.js 22+
- `OPENAI_API_KEY`
- `SERPAPI_KEY` from [serpapi.com](https://serpapi.com) (free tier available)
- The AGNT5 CLI

## Install

```bash
curl -LsSf https://agnt5.com/cli.sh | bash
```

## Setup



### Scaffold the project



**Python**

```bash
agnt5 create --template python/travel_booking_customer_service my-travel-agent
cd my-travel-agent
```


**TypeScript**

```bash
agnt5 create --template typescript/travel_booking_customer_service my-travel-agent
cd my-travel-agent
```




### Set environment variables

```bash
cat > .env << EOF
OPENAI_API_KEY=your_openai_api_key_here
SERPAPI_KEY=your_serpapi_key_here
EOF
```


### Install dependencies



**uv (Python)**

```bash
uv sync
```


**pip (Python)**

```bash
pip install -e .
```


**npm (TypeScript)**

```bash
npm install
```




### Start the AGNT5 dev server

```bash
agnt5 dev
```


## How it works

The workflow runs the travel-booking agent with the incoming message - that's the entire workflow body. All of the orchestration logic lives in the agent's instructions and its three tools. The flight-search and hotel-search tools both call SerpAPI's Google Flights/Hotels engines and return the top three options; the itinerary tool builds a day-by-day plan framework once destination and dates are known. When a user asks to "plan my trip," the agent's instructions direct it to call all three tools in sequence within a single turn, rather than asking the user to confirm between each step.

In Python, because the workflow's context is passed into the agent's run call, the conversation history is loaded from and saved back to the workflow's own durable context on every call - there's no separate entity to manage, and a crash between turns resumes with full context intact. In TypeScript, the workflow only forwards `ctx` for tool/HITL access and event emission; to get the same durable multi-turn behavior you need to load prior messages yourself (for example from `ctx` storage) and pass them as the `history` argument to `agent.run(...)`.


> The agent's instructions do the heavy lifting here: airport-code inference, when to ask for missing details, and when to auto-chain all three tools are all prompt-level decisions, not code branches.


## Key files



**Python**

```text
app.py                             - Worker entry point
src/travel_booking/workflows.py    - travel_booking_workflow: runs the agent with context=ctx
src/travel_booking/agents.py       - the travel_booking_agent and its instructions
src/travel_booking/tools.py        - search_flights, search_hotels, create_itinerary (SerpAPI-backed)
```


**TypeScript**

```text
app.ts            - Worker entry point
src/workflows.ts  - travelBookingWorkflow: runs the agent with ctx
src/agents.ts     - createTravelBookingAgent(): builds the agent with its instructions
src/tools.ts      - searchFlights, searchHotels, createItinerary (SerpAPI-backed)
```



## Customize

**Swap the search provider.** `tools.py`/`tools.ts` is the only place SerpAPI is referenced - replace it with another flight/hotel API and keep the same tool signatures.

**Add a booking-confirmation tool.** Give the agent a `confirm_booking` tool once you're ready to move from search results to an actual reservation flow.

**Tune the conversation style.** The agent's tone, required fields, and orchestration rules are all in the instructions string in `agents.py`/`agents.ts` - edit it directly to change behavior.

## Next steps

- Read [/docs/build/agents](https://agnt5.com/docs/build/agents.md) for agent tool use and durable conversation context
- See [/docs/build/workflows](https://agnt5.com/docs/build/workflows.md) for `context=ctx` semantics
- Compare with [tutor_agent](https://agnt5.com/templates/tutor_agent.md) for the handoff pattern instead of a single tool-using agent

> For the complete documentation index, see [llms.txt](/llms.txt).
> A full single-fetch corpus is available at [llms-full.txt](/llms-full.txt).
