From Chatting to Getting Things Done: LLM, RAG, Function Calling & Harness in AI Travel Planning
The article walks through a step‑by‑step evolution of AI—from large language models and prompt engineering to retrieval‑augmented generation, function calling, agents, and harnesses—illustrated with a concrete travel‑planning scenario, showing how each technology adds real‑world capability.
Stage 1: How AI Understands Human Language
To make AI useful, it must first understand input. This relies on three core concepts: LLM , Token , and Prompt . An LLM can be seen as a hyper‑talkative word‑chain generator that predicts the next token based on preceding context. User input is split into Tokens , the smallest units of meaning, likened to LEGO bricks, each with a unique token ID. The whole sentence becomes a Prompt ; different prompts (e.g., “Plan a Hangzhou trip” vs. “Write a detailed Hangzhou itinerary with accommodation and dining”) lead to very different outputs. Crafting effective prompts is called Prompt engineering .
Stage 2: AI’s Limited Memory
During a conversation, the system packages all previous messages as the Context and feeds it to the model. Because the model’s context window is finite, long dialogues are compressed: only the most critical points are retained as a summary, which becomes the model’s Memory . Consequently, after a lengthy chat the AI may only remember “Hangzhou, West Lake, near subway, allergy” and forget the exact itinerary length. This is not true forgetting but a necessary truncation due to memory limits.
Stage 3: Letting AI “Read Books” with Retrieval‑Augmented Generation (RAG)
When the AI lacks specific knowledge—e.g., the name of a company‑sponsored lakeside B&B—it cannot answer because it has never read that private document. RAG solves this by allowing the model to retrieve relevant fragments from a private knowledge base (company docs, personal notes) before generating a response. The process consists of three steps:
Build the index : split all documents into searchable chunks and store them.
Retrieve : at query time, fetch the most relevant chunks.
Generate : feed the retrieved chunks together with the user question to the LLM, which produces an answer grounded in the external material.
RAG improves answer accuracy but still cannot perform actions such as booking a train ticket on 12306.
Stage 4: Giving AI “Hands” with Function Calling and MCP
To enable actual actions like ticket booking, the model must be able to call external tools. Function calling lets a large model output a standardized call to an API (e.g., weather, ticketing, hotel search). The surrounding program receives the call, executes the real‑world request, and returns the result for the model to incorporate into its reply.
Traditional function calling requires a separate adapter for each new tool, leading to repetitive work. The Model Context Protocol (MCP) addresses this by defining a universal “socket” interface. All third‑party tools implement the MCP “plug”, so the AI only needs to integrate with MCP once to access any compliant service, dramatically simplifying development.
Stage 5: The “Ultimate Form” – AI Agent
Combining a powerful LLM, RAG, and Function‑calling/MCP yields an Agent . An Agent is more than a chatbot; it packages reasoning, planning, tool invocation, and result recording into an autonomous system that can accomplish a goal end‑to‑end. For a travel‑planning task, the Agent would automatically: check weather, filter hotels within budget, match flight times, and generate a rich itinerary.
Stage 6: Making AI Learn Your Preferences with Skills
Repeatedly specifying personal rules (e.g., “quiet artistic hotels with breakfast”) is cumbersome. Skills are reusable, standardized modules that encode such preferences (e.g., a “Hotel‑filter Skill”). When the Agent needs to book a hotel, it invokes the relevant Skill, applying the user’s constraints without re‑entering them each time.
Key differences:
Prompt is a one‑off instruction, like a sticky note that disappears after use and consumes context tokens.
Skill is a persistent, programmatic capability, like a reference book that can be called repeatedly without occupying context.
Skills reduce token usage, lower execution cost, and let the AI assistant become increasingly attuned to long‑term habits.
Stage 7: Controlling Powerful Agents with Harness
An unconstrained Agent could act unpredictably—e.g., overspend on a hotel or duplicate orders. Harness provides safety rails by adding three layers of control:
Supply complete context so the Agent never “forgets” critical constraints.
Define hard boundaries (budget limits, prohibited sites, etc.).
Automatic verification and feedback: inspect the Agent’s output and trigger corrective actions when errors are detected.
These safeguards ensure the Agent operates productively within a controlled, secure environment.
Conclusion: Your AI Travel Butler Is On the Way
Reviewing the journey: starting from a chat‑only LLM, adding RAG for external knowledge, Function calling/MCP for tool access, evolving into an autonomous Agent, and finally wrapping everything with a Harness for safety. When such an integrated system plans a Hangzhou trip, it will parse the user’s prompt, apply personal Skills, retrieve up‑to‑date local guides via RAG, call weather, ticket, and hotel APIs through MCP, respect budget and policy limits enforced by Harness, and output a detailed itinerary. This is no longer science‑fiction but an emerging technical reality, with each concept acting as a patch that addresses the shortcomings of the previous layer.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
