Skip to content

Custom Skills and Tools

zhouning edited this page Mar 22, 2026 · 1 revision

自定义技能与工具指南

GIS Data Agent v14.5 — 基于 Google ADK 的 AI 地理空间平台 仓库:https://github.com/zhouning/gisdataagent

自定义技能 (Custom Skills)

自定义技能让您无需编写代码即可为 AI 代理添加新的行为和专业知识。每个自定义技能在运行时会动态构建一个 ADK LlmAgent 实例。

创建方式

  1. 打开右侧数据面板 → Capabilities(能力) 标签页
  2. 点击 "+Skill" 按钮
  3. 填写技能定义:
字段 说明 示例
名称 技能唯一标识 wetland-assessment
指令 (Instruction) 技能的提示词/行为定义 你是一个湿地评估专家,擅长...
工具集选择 技能可用的工具集 ExplorationToolset, AnalysisToolset
触发关键词 自动触发技能的关键词 湿地, wetland, 生态
模型层级 使用的 LLM 层级 flash(快速)或 pro(高质量)

运行时机制

当用户消息包含触发关键词时,系统从数据库加载技能定义,动态构建 LlmAgent,并使用指定的工具集和指令执行任务。

高级功能

  • 版本控制:每次修改自动保存版本,可回滚到历史版本
  • 评分系统:用户可对技能评分,高分技能获得更高推荐优先级
  • 克隆:一键复制现有技能作为新技能的起点
  • 审批流程:共享技能需通过管理员审批
  • 用户隔离:每个用户的技能独立,可选择共享给团队

用户自定义工具 (User-Defined Tools)

用户自定义工具允许通过声明式 JSON 定义创建新工具,无需编写 Python 代码。工具在运行时被包装为 ADK FunctionTool

4 种模板类型

1. HTTP 调用 (http_call)

调用外部 REST API:

{
  "type": "http_call",
  "method": "GET",
  "url": "https://api.example.com/data/{city}",
  "headers": {"Authorization": "Bearer {{API_KEY}}"},
  "params": {"format": "geojson"}
}

2. SQL 查询 (sql_query)

执行预定义的数据库查询:

{
  "type": "sql_query",
  "query": "SELECT * FROM land_parcels WHERE area_ha > {min_area}",
  "connection": "default"
}

3. 文件变换 (file_transform)

对上传文件执行预定义的转换操作:

{
  "type": "file_transform",
  "operation": "reproject",
  "target_crs": "EPSG:4326"
}

4. 链式调用 (chain)

将多个工具串联执行:

{
  "type": "chain",
  "steps": [
    {"tool": "my_http_tool", "params": {"city": "{input}"}},
    {"tool": "my_transform_tool", "params": {"data": "{prev_result}"}}
  ]
}

创建方式

  1. 数据面板 → Capabilities 标签页 → 点击 "+Tool"
  2. 选择模板类型,填写 JSON 定义
  3. 保存后,工具立即可用于所有代理

工作流编辑器 (Workflow Builder)

可视化 DAG(有向无环图)编辑器,基于 ReactFlow 构建,支持将多个管道和自定义技能组合为复杂工作流。

4 种节点类型

节点类型 说明
DataInput 数据输入节点——指定输入文件或数据源
Pipeline 管道节点——内置的三大管道 (Optimization/Governance/General)
Skill Agent 技能代理节点——引用自定义技能
Output 输出节点——保存或展示结果

执行模式

  • 顺序执行:节点按连接顺序依次运行
  • 并行分支:DAG 拓扑排序支持同层级节点并行执行
  • Cron 调度:设置定时触发(如每天凌晨2点执行数据治理)
  • Webhook 触发:通过 HTTP Webhook 外部触发工作流
  • 节点重试:每个节点可单独配置重试次数和间隔

使用方式

  1. 数据面板 → Workflows(工作流) 标签页
  2. 拖拽添加节点,拉线连接
  3. 配置每个节点参数
  4. 保存 → 手动运行或设置触发器

技能包 (Skill Bundles)

预配置的工具集+技能组合,提供开箱即用的专业能力:

  • 一键安装完整的领域解决方案
  • 包含配套的工具集选择和技能指令
  • 通过 Capabilities 标签页的 Bundles 区域管理

Custom Skills and Tools Guide

GIS Data Agent v14.5 — AI geospatial platform on Google ADK Repository: https://github.com/zhouning/gisdataagent

Custom Skills

Custom Skills let you add new behaviors and domain expertise to AI agents without writing code. Each custom skill dynamically builds an ADK LlmAgent instance at runtime.

How to Create

  1. Open the right-side Data Panel → Capabilities tab
  2. Click the "+Skill" button
  3. Fill in the skill definition:
Field Description Example
Name Unique skill identifier wetland-assessment
Instruction Prompt / behavior definition You are a wetland assessment expert who...
Toolset selection Available toolsets for the skill ExplorationToolset, AnalysisToolset
Trigger keywords Keywords that auto-trigger the skill wetland, ecology, habitat
Model tier LLM tier to use flash (fast) or pro (high quality)

Runtime Mechanism

When a user message contains trigger keywords, the system loads the skill definition from the database, dynamically builds an LlmAgent, and executes the task using the specified toolsets and instructions.

Advanced Features

  • Versioning: Every edit auto-saves a version; rollback to any historical version
  • Rating system: Users can rate skills; higher-rated skills get higher recommendation priority
  • Cloning: One-click copy of existing skills as a starting point for new ones
  • Approval workflow: Shared skills require admin approval
  • User isolation: Each user's skills are independent, with optional team sharing

User-Defined Tools

User-Defined Tools allow you to create new tools via declarative JSON definitions without writing Python code. Tools are wrapped as ADK FunctionTool instances at runtime.

4 Template Types

1. HTTP Call (http_call)

Call an external REST API:

{
  "type": "http_call",
  "method": "GET",
  "url": "https://api.example.com/data/{city}",
  "headers": {"Authorization": "Bearer {{API_KEY}}"},
  "params": {"format": "geojson"}
}

2. SQL Query (sql_query)

Execute a predefined database query:

{
  "type": "sql_query",
  "query": "SELECT * FROM land_parcels WHERE area_ha > {min_area}",
  "connection": "default"
}

3. File Transform (file_transform)

Perform predefined transformations on uploaded files:

{
  "type": "file_transform",
  "operation": "reproject",
  "target_crs": "EPSG:4326"
}

4. Chain (chain)

Chain multiple tools together:

{
  "type": "chain",
  "steps": [
    {"tool": "my_http_tool", "params": {"city": "{input}"}},
    {"tool": "my_transform_tool", "params": {"data": "{prev_result}"}}
  ]
}

How to Create

  1. Data Panel → Capabilities tab → click "+Tool"
  2. Choose template type, fill in the JSON definition
  3. Once saved, the tool is immediately available to all agents

Workflow Builder

A visual DAG (Directed Acyclic Graph) editor built on ReactFlow. Compose multiple pipelines and custom skills into complex workflows.

4 Node Types

Node Type Description
DataInput Data input node — specify input files or data sources
Pipeline Pipeline node — the three built-in pipelines (Optimization/Governance/General)
Skill Agent Skill agent node — reference a custom skill
Output Output node — save or display results

Execution Modes

  • Sequential: Nodes run in connection order
  • Parallel branches: DAG topological sort enables same-level nodes to run in parallel
  • Cron scheduling: Set timed triggers (e.g., run governance audit daily at 2 AM)
  • Webhook triggers: Trigger workflows externally via HTTP webhook
  • Node retry: Each node can individually configure retry count and interval

How to Use

  1. Data Panel → Workflows tab
  2. Drag to add nodes, draw connections
  3. Configure each node's parameters
  4. Save → run manually or set up triggers

Skill Bundles

Pre-configured toolset + skill combinations providing ready-to-use domain capabilities:

  • One-click install of complete domain solutions
  • Includes paired toolset selections and skill instructions
  • Managed through the Bundles section in the Capabilities tab

Clone this wiki locally