TomTom Maps for JavaScript
    Preparing search index...

    Type Alias MapAgentOptions<CS>

    Options for creating an agent toolkit.

    interface MyState extends ToolState {
    fleet: FleetState;
    }

    createMapAgent<MyState>(map, {
    model,
    state: { fleet: new FleetState() },
    });
    type MapAgentOptions<CS extends ToolState = ToolState> = {
        classifier?: Classifier | false;
        includeDefaultTools?: boolean;
        maxSteps?: number;
        model: LanguageModel;
        onClassify?: (result: ClassificationResult | null) => void;
        outputSchemas?: boolean;
        prepareStep?: PrepareStepFunction;
        state?: Omit<CS, keyof ToolState>;
        systemPrompt?: string;
        systemPromptSuffix?: string;
        tools?: { [K in ToolNameHint]?: ToolEntry<CS> | false };
    }

    Type Parameters

    • CS extends ToolState = ToolState

      Full state type. Must extend ToolState. Defaults to base ToolState (no custom slices).

    Index

    Properties

    classifier?: Classifier | false

    Pluggable classifier for automatic tool selection.

    • Omit to use the default LLM-based classifier (uses main model)
    • Pass a Classifier function for custom logic
    • Pass false to disable classification entirely
    includeDefaultTools?: boolean

    Whether to include all built-in default tools. Defaults to true. Set to false to start with no defaults and provide only custom tools via tools.

    maxSteps?: number

    Max multi-step tool loop iterations. Default: 10.

    model: LanguageModel

    AI SDK language model instance. REQUIRED — no default provider.

    onClassify?: (result: ClassificationResult | null) => void

    Called after each classification. Use to observe selected tools or log.

    outputSchemas?: boolean

    Whether to include output schemas on tools. Defaults to true. Set to false for providers that don't support structured tool outputs.

    prepareStep?: PrepareStepFunction

    Custom prepareStep hook, composed with internal classification step. Your activeTools are intersected with the classifier's selection.

    state?: Omit<CS, keyof ToolState>

    Custom state slices merged alongside built-in state. Only custom slices need to be provided — built-in slices are created automatically. Accessible in custom tool execute via the state parameter.

    systemPrompt?: string

    Complete system prompt that replaces the default. If provided, systemPromptSuffix is ignored.

    systemPromptSuffix?: string

    Additional text appended to the built-in prompt. Ignored if systemPrompt is provided.

    tools?: { [K in ToolNameHint]?: ToolEntry<CS> | false }

    Tool overrides merged with default tools.

    • ToolEntry values add a new tool or replace a default.
    • false values exclude a default tool.

    When omitted, all default tools are used as-is.

    // Add a custom tool (defaults included automatically)
    createMapAgent(map, {
    model,
    tools: { getCustomLocation: myTool },
    });

    // Remove a default tool
    createMapAgent(map, {
    model,
    tools: { setLanguage: false },
    });