LangChain LangGraph
Module 1 Module 2 Module 3
Module 2 · Tools, State and Multi-Agent
1 2.1 MCP
2 2.1 Travel Agent
3 2.2 Runtime Context
4 2.2 State
5 2.3 Multi Agent
6 2.4 Wedding Planners
7 Bonus: RAG
8 Bonus: SQL
SUM Module Summary
HomeLangChainModule 2 · Tools, State and Multi-Agent2.1 Travel Agent
📓 Notebook 📖 Explained
LANGCHAIN MODULE 2 · LESSON 2.1b

Travel Agent: using remote MCP
Kiwi Flight Tools · Memory · Async

This lesson connects Kiwi's remote MCP server to a LangChain Agent, letting the Agent call flight-search tools while using thread_id to preserve memory for one conversation.

1 From local MCP to remote MCP

The previous lesson used stdio to start a local MCP server. This lesson switches to a remote MCP server: Kiwi provides flight-related tools over the network, and the Agent does not need to know how Kiwi implements them.

ComparisonLocal stdio MCPRemote MCP
Connection methodcommand + args start a subprocessurl connects to a remote service
Best forLocal scripts, internal tools, development debuggingThird-party platforms, cloud services, shared capabilities
Example in this lessonresources/2.1_mcp_server.pyhttps://mcp.kiwi.com

2 Connect Kiwi MCP server

The notebook uses MultiServerMCPClient to connect to travel_server. The returned tools become the external capabilities for the travel Agent.

Python
client = MultiServerMCPClient(
    {
        "travel_server": {
            "transport": "sse",
            "url": "https://mcp.kiwi.com",
        }
    }
)

tools = await client.get_tools()
transport

sse means connecting to the remote MCP server through Server-Sent Events. Later lessons also use streamable_http.

3 Check which tools the server exposes first

Before giving tools to the Agent, printing their names is a practical debugging step. It confirms that the connection worked and helps you understand which actions the model can call.

Python
for msg in tools:
    pprint(msg.name)
    print()
Debugging habit

Remote MCP tool sets can change. Inspect the tool names and descriptions before writing the system prompt to reduce the chance that the model misuses a tool.

4 Create the travel Agent

The travel Agent has three core configuration pieces: model, MCP tools and checkpointer. InMemorySaver lets conversations with the same thread_id retain context.

Python
from langgraph.checkpoint.memory import InMemorySaver

agent = create_agent(
    deepseek_model(),
    tools=tools,
    checkpointer=InMemorySaver(),
    system_prompt="You are a travel agent. No follow up questions.",
)

tools

Flight-search capabilities provided by Kiwi MCP.

checkpointer

Saves message history and state in the same thread.

system_prompt

Asks the Agent to act as a travel agent and avoid follow-up questions.

5 Start an async query with thread_id

For the actual call, the notebook uses ainvoke and configurable.thread_id. This lets one travel-planning request be associated with later conversation turns.

Python
config = {"configurable": {"thread_id": "1"}}

response = await agent.ainvoke(
    {
        "messages": [
            HumanMessage(
                content="Get me a return flight from Melbourne to Changsha on Sep 1st 2026 and return on Sep 18st 2026."
            )
        ]
    },
    config,
)

print(response["messages"][-1].content)
Dates and tool parameters

Flight tools are usually sensitive to dates, airports, passenger counts and similar parameters. "No follow up questions" in the system prompt forces the model to search from available information, but missing parameters can make results less stable.

6 Lesson takeaway