Token导航 LogoToken导航TokenDH.com
待分类执行命令github未标认证来源可访问许可证需确认审计提醒

arcgis-ai-componentsarcgis ai 组件

Agent Skill

arcgis-ai-components 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

326

周安装

14

GitHub Stars

13

下载量

114
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:arcgis-ai-components(arcgis ai 组件)
来源仓库:https://github.com/saschabrunnerch/arcgis-maps-sdk-js-ai-context
仓库路径:skills/arcgis-ai-components
安装命令:
npx skills add https://github.com/saschabrunnerch/arcgis-maps-sdk-js-ai-context --skill arcgis-ai-components
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/saschabrunnerch/arcgis-maps-sdk-js-ai-context --skill arcgis-ai-components

简介

为 Web 地图添加自然语言交互能力,让用户通过聊天方式查询空间数据。

  • 适用于需要智能问答、自动标注或交互式地图探索的应用场景。
  • 作为 5.0 版本新增组件,目前处于 Beta 阶段,API 未来可能存在变更。
  • 推荐通过 CDN 方式加载以减少构建复杂度,但需关注版本升级带来的影响。
  • arcgis-ai-components 属于待分类类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

ArcGIS AI Components

Use this skill when adding AI assistant capabilities to a web map, enabling users to interact with map data through natural language chat. This is a new package in 5.0 (@arcgis/ai-components) with no 4.x equivalent.

Beta: AI Components are in beta as of 5.0. APIs may change in future releases.

Import Patterns

CDN (Recommended for AI Components)

AI components auto-register when loaded via the SDK CDN:

<!-- Load ArcGIS Maps SDK (includes ai-components registration) -->
<script type="module" src="https://js.arcgis.com/5.0/"></script>

Direct ESM Imports (Build Tools)

import "@arcgis/ai-components/components/arcgis-assistant";
import "@arcgis/ai-components/components/arcgis-assistant-navigation-agent";
import "@arcgis/ai-components/components/arcgis-assistant-data-exploration-agent";
import "@arcgis/ai-components/components/arcgis-assistant-help-agent";
import "@arcgis/ai-components/components/arcgis-assistant-agent";

Utility Functions

import {
  invokeTextPrompt,
  invokeStructuredPrompt,
  invokeToolPrompt,
  sendTraceMessage,
  getEmbeddings,
  cosineSimilarity,
} from "@arcgis/ai-components/utils";

Core Architecture

The AI assistant uses a component + agent architecture:

  • arcgis-assistant - The chat UI container. Manages conversation, routes user messages to registered agents, and displays responses.
  • Agent components - Slotted children of the assistant. Each agent handles a specific domain (navigation, data exploration, help). The assistant orchestrates which agent handles each query.
arcgis-assistant
  ├── arcgis-assistant-navigation-agent      (pan, zoom, go to locations)
  ├── arcgis-assistant-data-exploration-agent (query data, statistics, charts)
  ├── arcgis-assistant-help-agent            (answer questions about the map/agents)
  └── arcgis-assistant-agent                 (custom agent wrapper)

Basic Setup

Minimal Example (CDN)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>AI Assistant</title>
    <script type="module" src="https://js.arcgis.com/5.0/"></script>
    <style>
      html,
      body {
        height: 100%;
        margin: 0;
      }
    </style>
  </head>
  <body>
    <calcite-shell>
      <arcgis-map id="my-map" item-id="c13bffcad4a244a99062e915e9bc1dc3">
        <arcgis-zoom slot="top-left"></arcgis-zoom>
      </arcgis-map>
      <calcite-shell-panel slot="panel-end" width="l">
        <calcite-panel>
          <arcgis-assistant
            reference-element="#my-map"
            heading="Map Assistant"
            description="Ask questions about the data on this map."
            entry-message="Hello! I can help you explore this map."
          >
            <arcgis-assistant-navigation-agent></arcgis-assistant-navigation-agent>
            <arcgis-assistant-data-exploration-agent></arcgis-assistant-data-exploration-agent>
            <arcgis-assistant-help-agent></arcgis-assistant-help-agent>
          </arcgis-assistant>
        </calcite-panel>
      </calcite-shell-panel>
    </calcite-shell>
  </body>
</html>

arcgis-assistant Component

Properties

PropertyAttributeTypeDefaultDescription
referenceElementreference-element`string \HTMLArcgisMapElement`-Required. CSS selector or element reference to an arcgis-map. Provides map context to agents.
headingheadingstring-Title displayed at the top of the assistant panel
descriptiondescriptionstring-Subtitle text describing the assistant's capabilities
entryMessageentry-messagestring-Welcome message shown before the user starts chatting
suggestedPrompts-string[]-Array of suggested prompts displayed as clickable chips (set via JS only)
keepSuggestedPromptskeep-suggested-promptsbooleanfalseKeep suggested prompts visible after the user submits a message
feedbackEnabledfeedback-enabledbooleanfalseShow thumbs up/down feedback buttons on assistant messages
logEnabledlog-enabledbooleanfalseShow agent execution logs (tool calls, reasoning steps)
copyEnabledcopy-enabledbooleanfalseAllow users to copy assistant message content
messages-ChatMessage[][]The conversation history (read/write)

Methods

MethodReturnsDescription
clearChatHistory()voidClears the conversation and resets the assistant
submitMessage(message)voidProgrammatically submit a user message to the assistant
componentOnReady()Promise<this>Resolves when the component is fully loaded

Events

EventDetailDescription
arcgisSubmit{message: string}Fired when the user submits a message
arcgisReady-Fired when the assistant is initialized and ready
arcgisFeedbackAssistantMessageFired when the user provides feedback on a message
arcgisErrorErrorFired when an error occurs during agent execution
arcgisInterrupt-Fired when the user interrupts an in-progress response
arcgisInterruptCancel-Fired when an interrupt is cancelled
arcgisInterruptSubmit-Fired when a new message is submitted while interrupting
arcgisCancel-Fired when processing is cancelled

Built-in Agents

arcgis-assistant-navigation-agent

Handles map navigation requests: panning, zooming, going to specific locations or features.

<arcgis-assistant reference-element="#my-map">
  <arcgis-assistant-navigation-agent></arcgis-assistant-navigation-agent>
</arcgis-assistant>

User prompt examples: "Zoom to New York City", "Go to the largest feature", "Pan north"

Properties:

PropertyAttributeTypeDescription
referenceElementreference-element`string \HTMLArcgisMapElement`Override the map reference (inherits from parent assistant if not set)

arcgis-assistant-data-exploration-agent

Queries and analyzes layer data: statistics, filters, feature counts, and data summaries.

<arcgis-assistant reference-element="#my-map">
  <arcgis-assistant-data-exploration-agent></arcgis-assistant-data-exploration-agent>
</arcgis-assistant>

User prompt examples: "What is the total population?", "Show me the top 5 features by area", "How many features have value > 100?"

Properties:

PropertyAttributeTypeDescription
referenceElementreference-element`string \HTMLArcgisMapElement`Override the map reference

arcgis-assistant-help-agent

Answers questions about the map, its layers, metadata, and the capabilities of other registered agents.

<arcgis-assistant reference-element="#my-map">
  <arcgis-assistant-help-agent></arcgis-assistant-help-agent>
</arcgis-assistant>

User prompt examples: "What layers are on this map?", "What can you help me with?", "Describe the data"

Properties:

PropertyAttributeTypeDescription
referenceElementreference-element`string \HTMLArcgisMapElement`Override the map reference

Configuring the Assistant

Setting Suggested Prompts (JavaScript)

const assistant = document.querySelector("arcgis-assistant");
assistant.suggestedPrompts = [
  "What is the total change in wheat production from 2017 to 2022?",
  "Go to the county that produced the most wheat in 2022.",
  "How many counties produced less wheat in 2022 than in 2017?",
];

Enabling Developer Features

<arcgis-assistant
  reference-element="#my-map"
  log-enabled
  copy-enabled
  feedback-enabled
  heading="Data Explorer"
  description="Ask questions about the map data."
  entry-message="Welcome! Try asking about the data."
>
  <!-- agents -->
</arcgis-assistant>

Listening for Events

const assistant = document.querySelector("arcgis-assistant");

assistant.addEventListener("arcgisSubmit", (event) => {
  console.log("User submitted:", event.detail.message);
});

assistant.addEventListener("arcgisFeedback", (event) => {
  const { feedback } = event.detail;
  console.log("Feedback:", feedback); // { positive: true } or { positive: false }
});

assistant.addEventListener("arcgisError", (event) => {
  console.error("Assistant error:", event.detail);
});

Programmatic Message Submission

const assistant = document.querySelector("arcgis-assistant");
await assistant.componentOnReady();

// Submit a message as if the user typed it
assistant.submitMessage("Show me the top 10 features by population");

Custom Agents

Use arcgis-assistant-agent to register a custom agent with the assistant.

Defining a Custom Agent

import { invokeTextPrompt } from "@arcgis/ai-components/utils";

const assistant = document.querySelector("arcgis-assistant");
const customAgent = document.querySelector("arcgis-assistant-agent");

customAgent.agentRegistration = {
  name: "weather-agent",
  description:
    "Answers questions about current weather conditions at map locations.",
  systemPrompt:
    "You are a weather assistant. Use the provided tools to get weather data.",
  tools: [
    {
      name: "getWeather",
      description: "Get current weather for a location",
      parameters: {
        type: "object",
        properties: {
          latitude: { type: "number", description: "Latitude" },
          longitude: { type: "number", description: "Longitude" },
        },
        required: ["latitude", "longitude"],
      },
      execute: async ({ latitude, longitude }) => {
        const response = await fetch(
          `https://api.weather.gov/points/${latitude},${longitude}`,
        );
        const data = await response.json();
        return JSON.stringify(data.properties);
      },
    },
  ],
};
<arcgis-assistant reference-element="#my-map">
  <arcgis-assistant-agent></arcgis-assistant-agent>
  <arcgis-assistant-navigation-agent></arcgis-assistant-navigation-agent>
</arcgis-assistant>

Utility Functions for Custom Agents

FunctionDescription
invokeTextPrompt(options)Send a text prompt to the LLM and get a text response
invokeStructuredPrompt(options)Send a prompt and get a structured (JSON) response
invokeToolPrompt(options)Send a prompt with tool definitions for function calling
sendTraceMessage(data)Send trace/debug messages to the assistant log
getEmbeddings(texts)Generate text embeddings for semantic search
cosineSimilarity(a, b)Compute cosine similarity between two embedding vectors

Web Map Requirements for AI Agents

For agents to work effectively with a web map:

  1. Layer metadata - Layers must have good metadata (descriptions, field aliases, tags).
  2. Embeddings - The web map should have embeddings stored as an item resource. See the Web map setup guide for details.
  3. User requirements:

- Signed-in named user of an ArcGIS Online organization (no trial/public accounts) - User must have access to the web map and its layers - AI assistants must be enabled in the organization settings - Beta apps must not be blocked in the organization settings - The user must have the role privilege to use AI assistants

Layout Patterns

Side Panel Layout (Recommended)

<calcite-shell>
  <arcgis-map id="map" item-id="YOUR_WEBMAP_ID">
    <arcgis-zoom slot="top-left"></arcgis-zoom>
    <arcgis-expand slot="top-left">
      <arcgis-legend></arcgis-legend>
    </arcgis-expand>
  </arcgis-map>
  <calcite-shell-panel slot="panel-end" width="l">
    <calcite-panel>
      <arcgis-assistant
        reference-element="#map"
        heading="Map Assistant"
        entry-message="Ask me anything about this map."
      >
        <arcgis-assistant-navigation-agent></arcgis-assistant-navigation-agent>
        <arcgis-assistant-data-exploration-agent></arcgis-assistant-data-exploration-agent>
        <arcgis-assistant-help-agent></arcgis-assistant-help-agent>
      </arcgis-assistant>
    </calcite-panel>
  </calcite-shell-panel>
</calcite-shell>

Expand Widget Layout

<arcgis-map id="map" item-id="YOUR_WEBMAP_ID">
  <arcgis-zoom slot="top-left"></arcgis-zoom>
  <arcgis-expand slot="top-right">
    <arcgis-assistant
      reference-element="#map"
      heading="Assistant"
      entry-message="How can I help?"
    >
      <arcgis-assistant-navigation-agent></arcgis-assistant-navigation-agent>
      <arcgis-assistant-data-exploration-agent></arcgis-assistant-data-exploration-agent>
      <arcgis-assistant-help-agent></arcgis-assistant-help-agent>
    </arcgis-assistant>
  </arcgis-expand>
</arcgis-map>

Common Pitfalls

  1. Missing reference-element: The assistant requires a reference to an arcgis-map element to provide context to agents. <!-- Anti-pattern: no reference-element --> <arcgis-assistant heading="Assistant"> <arcgis-assistant-navigation-agent></arcgis-assistant-navigation-agent> </arcgis-assistant> <arcgis-map id="map" item-id="abc123"></arcgis-map> <!-- Correct: point to the map element --> <arcgis-assistant reference-element="#map" heading="Assistant"> <arcgis-assistant-navigation-agent></arcgis-assistant-navigation-agent> </arcgis-assistant> <arcgis-map id="map" item-id="abc123"></arcgis-map> Impact: Agents have no map context and cannot execute navigation or data queries. They will fail silently or return errors.
  2. No agents registered: The assistant itself has no built-in intelligence - you must slot at least one agent component. <!-- Anti-pattern: assistant with no agents --> <arcgis-assistant reference-element="#map" heading="Assistant"> </arcgis-assistant> <!-- Correct: register agents as children --> <arcgis-assistant reference-element="#map" heading="Assistant"> <arcgis-assistant-navigation-agent></arcgis-assistant-navigation-agent> <arcgis-assistant-data-exploration-agent></arcgis-assistant-data-exploration-agent> <arcgis-assistant-help-agent></arcgis-assistant-help-agent> </arcgis-assistant> Impact: The user can type messages but they are never processed. No responses are generated.
  3. Unauthenticated users: AI components require a signed-in ArcGIS Online named user with AI assistant privileges. Anonymous or public users cannot use the assistant. Impact: The assistant panel may render but agent calls fail with authentication errors. Always check authentication status before showing the assistant UI.
  4. Poor layer metadata: Agents rely on layer descriptions, field aliases, and embeddings to understand the map data. Layers with missing metadata produce poor or irrelevant responses. Impact: The data exploration agent may misidentify fields or give inaccurate summaries.
  5. suggestedPrompts set as HTML attribute: The suggestedPrompts property accepts an array and can only be set via JavaScript, not as an HTML attribute. <!-- Anti-pattern: HTML attribute (won't work) --> <arcgis-assistant suggested-prompts="What is the total?"></arcgis-assistant> // Correct: set via JavaScript const assistant = document.querySelector("arcgis-assistant"); assistant.suggestedPrompts = ["What is the total population?", "Go to the largest city",]; Impact: Suggested prompts are silently ignored when set as an HTML attribute string.

Reference Samples

  • ai-assistant - AI Assistant component with navigation, data exploration, and help agents

Related Skills

  • See arcgis-core-maps for setting up the map that the assistant references.
  • See arcgis-widgets-ui for Calcite layout components (calcite-shell, calcite-shell-panel).
  • See arcgis-interaction for non-AI approaches to map interaction (popups, hit tests).

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.37%
按下载量换算41

Claude

28.04%
按下载量换算32

Cursor

18.74%
按下载量换算21

Gemini CLI

10.11%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/saschabrunnerch/arcgis-maps-sdk-js-ai-context --skill arcgis-ai-components 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills