This is the documentation of version 0.62.3. Go to the latest version, 1.0.0-rc.5.

Agent Toolkit plugin

The Agent Toolkit turns a TomTom map into something a user can talk to. Drop in your favourite LLM, wire up a chat box, and your users can plan routes, search for places, inspect traffic, and reshape the map with sentences instead of clicks.

Why it exists

LLMs are great at understanding what someone wants. Maps are great at showing them where things are. The gap between the two is plumbing — a tool registry the model can call, agent state that survives multiple turns, an intent classifier that keeps the prompt small, and a sandbox for the heavy lifts. The Agent Toolkit owns that plumbing so you can focus on the experience.

You bring an LLM and (optionally) a chat UI. The plugin handles the rest.

What you can power with it

A few common shapes the toolkit is good at:

What's in the box

@tomtom-org/maps-sdk-plugin-agent-toolkit is a headless plugin built on Vercel AI SDK. It wires a TomTomMap instance and TomTom services to a curated set of LLM-callable tools and runs the multi-step tool loop via ToolLoopAgent.

You bring:

The plugin provides:

Quickstart

All plugins use @tomtom-org/maps-sdk as a peer dependency — ensure the SDK is installed first. See the Project Setup guide if needed.

Install

npm install @tomtom-org/maps-sdk-plugin-agent-toolkit
npm install ai @ai-sdk/react @ai-sdk/openai   # or @ai-sdk/anthropic, @ai-sdk/azure, etc.

Wire it up

import { TomTomConfig } from '@tomtom-org/maps-sdk/core';
import { TomTomMap } from '@tomtom-org/maps-sdk/map';
import { createMapAgent } from '@tomtom-org/maps-sdk-plugin-agent-toolkit';
import { openai } from '@ai-sdk/openai';
import { useChat } from '@ai-sdk/react';
import { DirectChatTransport } from 'ai';

TomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY' });

const map = new TomTomMap({ mapLibre: { container: 'map' } });

const agent = createMapAgent(map, {
    model: openai('gpt-4o'),

    // Optional: tailor which data-entry kinds the agent can touch. Disabling
    // a kind removes it from analyseData / processData scope AND drops the
    // related recall / display tools from the registry.
    dataEntries: {
        routes: { entryMode: 'single' },          // one route at a time
        byod: { enabled: false },                 // no BYOD tools in this deployment
    },
});

// Wire to any Vercel AI SDK chat interface
const { messages, sendMessage } = useChat({
    transport: new DirectChatTransport({ agent }),
});

Try it out

Once wired, users can interact naturally:

Clean up

agent.destroy();   // resets every built-in and custom state slice that implements reset()

Working with Claude code

If you're using Claude Code to build against this plugin, install the SDK skill, which auto-loads focused context when you ask about the toolkit:

npx skills add tomtom-international/maps-sdk-js --skill tomtom-maps-sdk-js

Trigger keywords include createMapAgent, ToolLoopAgent, analyseData, processData, scopeSchema, scopePrompt, dataEntries, addByodSource, and most other public API names. Drop one into your question and the skill picks it up. AI coding with the SDK covers the other topics it knows.

Where to next

The rest of this section breaks the plugin's surface area into focused topics. Roughly in "learn enough to ship something" order:

API reference

Agent Toolkit Plugin API Reference

Related guides