Skip to main content
LangChainAPI

Connect Mobility Timetable API to LangChain

Step-by-step setup guide and copy-paste integration snippet for running Mobility Timetable API (Real-time departures and stops for demo network.) with LangChain.

Tool Details

Configuration Snippet

agent_tools.(ts|py)

Copy the configuration below and add it to your LangChain settings to grant your agent direct access to this tool:

LangChain

agent_tools.(ts|py)

from langchain_core.tools import tool
import httpx

@tool
async def search_mobility-timetable-api(query: str) -> str:
    """Real-time departures and stops for demo network."""
    url = "https://example.com/mobility/api/departures"
    async with httpx.AsyncClient() as client:
        res = await client.get(url, params={"stop": query})
        res.raise_for_status()
        return res.text

Agent Capabilities & Use Cases

  • Find next departures from a stop
  • Plan a route between two stops

Step-by-Step Setup Guide

  1. 1
    Prepare LangChainEnsure LangChain is installed and updated to support local or remote tool invocations.
  2. 2
    Paste ConfigurationSave the configuration block into `agent_tools.(ts|py)` and restart your client or runtime.
  3. 3
    Test the ConnectionAsk your agent to perform a sample query or task using Mobility Timetable API to confirm zero errors.

Interface Metadata

Access MechanismDirect
AuthenticationAPI Key
ReliabilityStable
Parent SystemExample Mobility