スキルプラグイン開発
概要
SERVICEMEにおいて、スキルプラグインとはAgentが選択可能な能力を指し、システム標準のプラグインに加えて、開発によってスキルプラグインを拡張し、Agentにより多くの能力を付与することができます。

システム内蔵スキルプラグイン
| 番号 | プラグイン | プラグインタイプ | 用途 |
|---|---|---|---|
| SearchKnowledgebase | ナレッジベース検索 | APIプラグイン | プライベートドメイン知識の検索機能を提供 |
| ImageGeneration | 画像生成 | APIプラグイン | テキスト記述に基づいて画像を生成 |
| Browsing | ウェブ閲覧 | APIプラグイン | リアルタイム情報検索のためのウェブ閲覧を提供 |
| Charts | チャート | APIプラグイン | 提供されたデータに基づき対応するチャートを生成、棒グラフ、折れ線グラフ、円グラフをサポート |
| DocumentReader | ドキュメントリーダー | APIプラグイン | 単一ドキュメントまたは選択されたドキュメントの要約情報を提供 |
| QuestionContact | 質問担当者 | APIプラグイン | 質問の所属分野に応じて対応分野の担当者を返す |
タイプ説明
| タイプ | 説明 |
|---|---|
| APIプラグイン | スキルプラグインはバックエンドAPIとして表現され、Agentはコンテキストに基づいてAPIの入力パラメータを埋め、APIの戻り値を解析する責任を持つ |
APIスキルプラグイン
認証方式のサポート
現在は固定Header認証または認証不要のインターフェース呼び出しのみサポートしています。
| タイプ | 説明 |
|---|---|
| 固定Header | リクエストヘッダーで固定のキーを指定してインターフェース認証を行う、OpenAIのapi_key形式に類似 |
プラグイン開発
このプロセスを理解しやすくするために、タイムゾーンコードからタイムゾーン情報を取得するAPIプラグインを例として説明します。
ステップ1:タイムゾーンコードに基づいてタイムゾーン情報を返すAPIを提供する。
API例
- .NET (Web API)
- Java (Spring Boot)
- Python (Fast API)
- Javascript (Next.js)
using Microsoft.AspNetCore.Mvc;
using System;
namespace WorldTimeApi.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class TimeController : ControllerBase
{
[HttpGet("current/zone")]
public IActionResult GetTimeByZone([FromQuery] string timeZone)
{
if (string.IsNullOrEmpty(timeZone))
{
return BadRequest("Missing required parameter: timeZone");
}
try
{
// タイムゾーン情報を検索
var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timeZone);
// 指定されたタイムゾーンの現在時刻を取得
var currentTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, timeZoneInfo);
// 結果を返す
return Ok(new
{
TimeZone = timeZone,
CurrentTime = currentTime.ToString("yyyy-MM-ddTHH:mm:ss")
});
}
catch (TimeZoneNotFoundException)
{
return NotFound("Time zone not found");
}
catch (InvalidTimeZoneException)
{
return BadRequest("Invalid time zone");
}
catch (Exception ex)
{
return StatusCode(500, $"Internal server error: {ex.Message}");
}
}
}
}
package com.example.worldtime;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
@RestController
public class TimeController {
@GetMapping("/api/Time/current/zone")
public Object getTimeByZone(@RequestParam String timeZone) {
try {
ZoneId zoneId = ZoneId.of(timeZone);
ZonedDateTime currentTime = ZonedDateTime.ofInstant(Instant.now(), zoneId);
return new TimeResponse(timeZone, currentTime.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
} catch (Exception e) {
return "Invalid time zone: " + e.getMessage();
}
}
static class TimeResponse {
public String timeZone;
public String currentTime;
public TimeResponse(String timeZone, String currentTime) {
this.timeZone = timeZone;
this.currentTime = currentTime;
}
}
}
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from datetime import datetime
import pytz
app = FastAPI()
class TimeResponse(BaseModel):
timeZone: str
currentTime: str
@app.get("/api/Time/current/zone", response_model=TimeResponse)
async def get_time_by_zone(timeZone: str):
if not timeZone:
raise HTTPException(status_code=400, detail="Missing required parameter: timeZone")
try:
tz = pytz.timezone(timeZone)
current_time = datetime.now(tz)
return TimeResponse(
timeZone=timeZone,
currentTime=current_time.strftime('%Y-%m-%dT%H:%M:%S')
)
except pytz.UnknownTimeZoneError:
raise HTTPException(status_code=404, detail="Time zone not found")
except Exception as e:
raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
import moment from 'moment-timezone';
export default function handler(req, res) {
const { timeZone } = req.query;
if (!timeZone) {
return res.status(400).json({ error: 'Missing required parameter: timeZone' });
}
try {
const currentTime = moment().tz(timeZone).format('YYYY-MM-DDTHH:mm:ss');
res.status(200).json({
timeZone: timeZone,
currentTime: currentTime,
});
} catch (e) {
res.status(404).json({ error: 'Time zone not found' });
}
}
ステップ2:このプラグインをシステムに登録する
スキルプラグインを追加し、以下の情報を入力します

フィールド説明
- Code:プラグインのコード、システム内でのプラグインの唯一識別子であり、意味のある記述を推奨。
- Name:プラグインの表示名、Agentが思考や実行過程で使用するプラグイン名、多言語対応の完全性に注意。
- Description:プラグインの説明、プラグインの役割を説明し、Agentのスキルプラグイン追加画面に表示される。
- Request Header:プラグイン呼び出しに必要なHeaderパラメータを入力(例:API_KEY)
- 【重要】OpenAPI / Swagger Schema ( JSON ):API本体の記述、ここでの情報がAgentにこのスキルがどのような状況で呼び出されるべきか、各パラメータがどのように埋められるべきかを理解させる。
OpenAPI Schema (JSON) 例
Get time zone
{
"Openapi": "3.0.0",
"Info": {
"Title": "World Time",
"Description": "Getting world time",
"Version": "v1.0.0"
},
"Servers": [
{
"Url": "https://www.timeapi.io"
}
],
"Paths": {
"/api/Time/current/zone": {
"Get": {
"OperationId": "zone",
"Description": "Get world time by timezone name",
"Deprecated": false,
"Parameters": [
{
"Name": "timeZone",
"In": "query",
"Required": true,
"Description": "Full IANA time zone names.",
"Schema": {
"Type": "string"
}
}
]
}
}
}
}
注意点
- Info/Title:ここに記入するプラグインタイトルはAgentがプラグインの役割を理解するのに役立つ。
- Paths/[api path]/Get/OperationId:Agentのプロンプト内でバッククォート`%OperationId%`を使い、特定のシナリオで呼び出すAPIを明示できる。詳細は下記のステップ4の例を参照。
- Paths/[api path]/Get/Description:Agentの理解を助け、どのような状況で特定APIを呼び出すかに影響する。
- Paths/[api path]/Get/Parameters:実際のAPIと一致させること。ここがqueryならAPIもqueryからパラメータを取得する必要がある。json bodyなど他のタイプの場合も同様。パラメータ名の説明は埋め込み成功率向上に寄与。
- Servers/Url:APIのBaseURLであり、正確に記入しないと呼び出しに失敗する。
- 【任意】プラグイン設定完了後、DEBUG機能でデバッグ可能。
ステップ3:Agentにスキルプラグインを追加する
Agent設定画面の[スキルプラグイン]タブからプラグインを追加します。

設定を保存後、エキスパートとの対話でテストします。

ステップ4:【任意】Agentのプロンプトに必要な説明を追加し、このスキルの実行をより良く誘導する。
例
特定サイトでブラウザプラグインを使って検索を誘導する
### Skill 3: Web Searching
- You can access web site by `Browsering` toolkit and looking for HR infomation from following sites: (site:*.linkedin.com; site:*.zhipin.com)
- Using result to fulfill users request and list up reference link at end of your response.
注:ほとんどの場合、AgentはOpenAPI Schemaの情報に基づいて実行タイミングやパラメータ埋め込みを自動判断します。