Flex Gateway新着情報
Governance新着情報
Monitoring API ManagerHTTP リスナーは、A2A サーバー設定の値を使用してエージェントカードに情報を入力します。クライアント A2A エージェントはエージェントカードの情報を使用して、次の決定を行います。
エージェントを使用するタイミング (説明とスキルに基づく)
エージェントへの問い合わせ先 (URL プロパティに基づく)
これは A2A サーバーの設定例です。
<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="9fd53f88-b7c5-4175-9480-db313b27f9fd" >
<http:listener-connection host="0.0.0.0" port="${http.port}" />
</http:listener-config>
<a2a:server-config name="A2A_Server" doc:name="A2A Server" doc:id="3e1c7c42-133d-4853-87f0-90617c8ad700" >
<a2a:connection listenerConfig="HTTP_Listener_config" agentPath="/financial-summary-agent" /> #(1)
<a2a:card name="financial-summary-agent" url="http://localhost:8081/financial-summary-agent/" version="1.0.0" > #(2)
<a2a:description ><![CDATA[An agent that can return financial statements based on the stock ticker]]></a2a:description>
<a2a:skills >
<a2a:agent-skill id="1" name="financial-report" >
<a2a:description ><![CDATA[Returns company financial reports]]></a2a:description>
</a2a:agent-skill>
</a2a:skills>
</a2a:card>
</a2a:server-config>
| 1 | a2a:connection は、要求をリスンするために使用するパスを指定します。 |
| 2 | a2a:card には、エージェントカードに入力される情報が含まれています。A2A Connector は、クライアントが ./well-known/agent.json パスでこのデータを要求したときに、自動的にエージェントカード形式でデータを返します。 |
この例では、リスナーが作成される方法を示します。クライアントエージェントから送信されたユーザープロンプトは、変数 user_prompt に抽出されます。
<flow name="a2sfinancialagent" doc:id="fcd9c8be-94c2-4543-9eff-7f3e2b2f58fb" >
<a2a:task-listener doc:name="Task Listener" doc:id="c86ea98a-ae50-43be-a7ae-7bb60df17f8e" config-ref="A2A_Server">
</a2a:task-listener>
<set-variable value="#[payload.message.parts[0].text]" doc:name="Set task user prompt" doc:id="0f017d97-1761-4fc7-8b6b-13f3557a4b28" variableName="user_prompt"/>
</flow>
応答は A2A タスクとして書式設定され、クライアントに返されます。
<ee:transform doc:name="Transform Message" doc:id="32fd4cee-9380-4f0a-839d-880a7f25ea7f">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{
"id": vars.task_id,
"sessionId": vars.session_id,
"status": {
"state": "completed",
"message": {
"role": "agent",
"parts": [
{
"type": "text",
"text": payload.response
}
]
},
"timestamp": (now() >> 'UTC') as String {format: "yyyy-MM-dd'T'HH:mm:ss'Z'"}
},
"artifacts": [
{
"name": "Answer",
"index": 0,
"parts": [
{
"type": "text",
"text": payload.response
}
]
}
]
}]]></ee:set-payload>
</ee:message>
</ee:transform>
この例では、米国企業とその財務状況に関連する問い合わせに回答できる金融 A2A エージェント Mule アプリケーションが A2A 要求をリスンし、MuleSoft Inference Connector を使用してユーザープロンプトを LLM に渡す方法を示します。
この例のフローをすばやく Mule アプリケーションに読み込むには、次のコードを Studio XML エディターに貼り付けます。
<flow name="sranana2aconnectorFlow" doc:id="fcd9c8be-94c2-4543-9eff-7f3e2b2f58fb" >
<a2a:task-listener doc:name="Task Listener" doc:id="c86ea98a-ae50-43be-a7ae-7bb60df17f8e" config-ref="A2A_Server">
</a2a:task-listener> #(1)
<logger level="INFO" doc:name="Logger" doc:id="08d7c476-ed04-4775-be88-ed2c143851e6" message="Triggering MCP Tools"/> #(2)
<set-variable value="#[payload.id]" doc:name="Set Task Id" doc:id="3b1702ea-88c1-4c06-a4ef-971ef8138504" variableName="task_id"/> #(3)
<set-variable value='#[(payload.sessionId) default ""]' doc:name="Set Session Id" doc:id="d0790291-fb71-4a10-a953-1b68fa8bbb47" variableName="session_id"/> #(4)
<set-variable value="#[payload.message.parts[0].text]" doc:name="Set task user prompt" doc:id="0f017d97-1761-4fc7-8b6b-13f3557a4b28" variableName="user_prompt"/> #(5)
<ms-inference:mcp-tools-native-template doc:name="[MCP] Tooling" doc:id="55e0960a-5795-4223-adf4-dfb23365dc3e" config-ref="MuleSoft_Inference_Text_generation_config">
<ms-inference:template ><![CDATA[You are a specialized assistant that performs financial analysis based on stock market data using stock market symbols]]></ms-inference:template> #(6)
<ms-inference:instructions ><![CDATA[Your sole purpose is to use the tools “get_company_symbol” and “get_company_financials" to answer financial questions about US based companies. If the user asks about anything other than stock market or financial aspects of public US companies, politely state that you cannot help with that topic and can only assist with companies financial data. Do not attempt to answer unrelated questions or use tools for other purposes.
Response Format: should be a JSON with 3 properties message, status (consist of "input_required", "completed", “error”) and sentiment with values (“Buy”, “Sell” or “Hold”) and reasoning (indicating in 2-3 sentences as to how the sentiment was decided)
Example queries: “Should I buy CRM stock?”, “Should I sell MSFT?”, “How is AAPL doing?”]]></ms-inference:instructions>
<ms-inference:data ><![CDATA[#[payload.message.parts[0].text]]]></ms-inference:data>
</ms-inference:mcp-tools-native-template>
<set-variable value="#[payload.response]" doc:name="MCP Tooling Response" doc:id="60810200-5643-477c-8a45-76f1e0dcc9e0" variableName="mcp_tooling_results"/> #(7)
<ms-inference:agent-define-prompt-template doc:name="Finance Agent" doc:id="b25e375b-f3be-45c1-a545-4f93690f98ce" config-ref="MuleSoft_Inference_Text_generation_config"> #(8)
<ms-inference:template ><![CDATA[#["You are a specialized assistant for performing financial analysis based on stock market data using stock market symbols.
Use the following context to answer
Context: $(vars.mcp_tooling_results)"]]]></ms-inference:template>
<ms-inference:instructions ><![CDATA[Your sole purpose is to answer questions about the financial information of US based companies. If the user asks anything other than stock market or financial aspects of public companies, politely state that you cannot help with that topic and can only assist with companies financial data. Do not attempt to answer unrelated questions or use tools for other purposes.
Response Format: Should be JSON with 3 properties, including message, status ("input_required", "completed", “error”), and sentiment with values (“Buy”, “Sell” or “Hold”) and reasoning (tell in 2-3 sentences how the sentiment was decided)
Example queries: “Should I buy CRM stock?”, “Should I sell MSFT?”, “How is AAPL doing?”]]></ms-inference:instructions>
<ms-inference:data ><![CDATA[#[vars.user_prompt]]]></ms-inference:data>
</ms-inference:agent-define-prompt-template>
<ee:transform doc:name="Transform Message" doc:id="32fd4cee-9380-4f0a-839d-880a7f25ea7f"> #(9)
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{
"id": vars.task_id,
"sessionId": vars.session_id,
"status": {
"state": "completed",
"message": {
"role": "agent",
"parts": [
{
"type": "text",
"text": payload.response
}
]
},
"timestamp": (now() >> 'UTC') as String {format: "yyyy-MM-dd'T'HH:mm:ss'Z'"}
},
"artifacts": [
{
"name": "Answer",
"index": 0,
"parts": [
{
"type": "text",
"text": payload.response
}
]
}
]
}]]></ee:set-payload>
</ee:message>
</ee:transform>
</flow>
| 1 | a2a:task-listener コンポーネントはエントリポイントとして機能し、A2A サーバーからのタスクの受信を待機します。このタスクには、株式市場データに関するユーザーのクエリが含まれています。 |
| 2 | logger コンポーネントは、MuleSoft ログに「Triggering MCP Tools (MCP ツールのトリガー)」という情報メッセージを出力します。 |
| 3 | Set-variable コンポーネントは、受信ペイロード (ステップ 1 で受信したタスク) から ID を抽出し、task_id という名前のフロー変数に保存します。 |
| 4 | 別の set-variable コンポーネントは、ペイロードから sessionId を抽出します。sessionId が存在しない場合は、デフォルトで空の文字列になります。この値は、session_id という名前のフロー変数に保存されます。 |
| 5 | この set-variable は、ペイロードから実際のユーザークエリを抽出します。具体的には、ペイロード内のメッセージの最初の部分からテキストを取得し、user_prompt という名前のフロー変数に保存します。 |
| 6 | ms-inference:mcp-tools-native-template は、LLM を専門的な財務分析アシスタントとして機能するように設定します。 |
| 7 | この set-variable コンポーネントは、ms-inference:mcp-tools-native-template (ステップ 6 から) によって生成された応答を取得し、それを mcp_tooling_results という名前のフロー変数に保存します。 |
| 8 | ms-inference:agent-define-prompt-template コンポーネントは、以前の AI インタラクションの結果を処理して、わかりやすい応答を生成します。 |
| 9 | ee:transform (DataWeave 変換) コンポーネントは、以前の AI インタラクションからの payload.response を取得し、それを構造化された JSON 出力に変換します。 |
<flow name="sranana2aconnectorFlow1" doc:id="973b8e26-66e6-449e-809d-9ae42125c693" >
<a2a:task-listener doc:name="Task Listener" doc:id="974a49ae-98a7-4f1c-a216-1b66f0a77b71" config-ref="A2A_Server"/>
<a2a:send-task doc:name="Send Prompt to A2A Agent" doc:id="1814db20-45b7-43e2-81e0-68211f1ae9af" config-ref="A2A_Client">
<a2a:task ><![CDATA[#[payload.prompt]]]></a2a:task>
</a2a:send-task>
</flow>