メインコンテンツへスキップ
generate-documenttool として公開されているため、AI エージェントはそれを呼び出すことができます。 ユーザーが *” Jeffery Griffinの提案を生成する”*と言えるように、エージェントとスキルを追加しましょう。

スキル

skill は 命令を再利用できます — エージェントに付与する知識です。 ツールの使い方をモデルに教えます。
import { defineSkill } from 'twenty-sdk/define';

export default defineSkill({
  universalIdentifier: DOCUMENT_SKILL_UNIVERSAL_IDENTIFIER,
  name: 'document-drafting',
  label: 'Document drafting',
  icon: 'IconFileText',
  content: [
    'To generate a document, call the `generate-document` tool with:',
    '- `templateId`: the id of the document template to use.',
    '- `recordId`: the id of the Person or Company the document is for.',
    '',
    'If the user names a template or person instead of an id, find the record first,',
    'then pass its id. Make sure the template target matches the record type.',
  ].join('\n'),
});

エージェント

agent はプロンプトを モデルとペアリングします。 ビルド警告を避けるため、明示的に responseFormat を設定してください。
import { defineAgent } from 'twenty-sdk/define';

export default defineAgent({
  universalIdentifier: DOCUMENT_AGENT_UNIVERSAL_IDENTIFIER,
  name: 'document-assistant',
  label: 'Document Assistant',
  description: 'Generates documents from your templates and CRM records.',
  icon: 'IconFileText',
  responseFormat: { type: 'text' },
  prompt: [
    'You are the Document Assistant for a CRM.',
    'You help users generate personalized documents from reusable templates',
    'and the data already in their CRM. Use the generate-document tool, and',
    'always confirm what you created.',
  ].join(' '),
});
エージェントは、そのロールが許可している場合にのみツールを呼び出すことができます。 すでにアプリのロールに対して canAccessAllTools: truecanBeAssignedToAgents: true を設定済みです。 詳しくは、第2章 を参照してください。

お試しください

ドキュメントアシスタント とのチャットを開き、CRM内の 人のためのドキュメントを下書きするように依頼します。 レコードを見つけて generate-document を呼び出し、作成したドキュメントを返します — そのドキュメントは、コマンドメニューやワークフロー経由の場合とまったく同様に、Documents ビューに表示されます。 これは、ロジックをツールとして公開するための報酬です: 1つの関数、多くのフロントドア — コマンドメニュー、HTTP、ワークフローステップ、そして現在の自然言語。 このステップの後: アプリは機能が完了し、本当に便利です。 に出荷しましょう。

次へ: 公開 →

マーケットプレイスのメタデータを追加して公開します。