Integrate a Pro-Code CAP A2A Agent with Joule
Share

[[{“value”:”

Overview

 

In my previous blog Build a Pro-Code A2A Agent for SAP S/4HANA Cloud with the CAP Agent Plugin (Node.js), we deployed a pro-code CAP agent to SAP Cloud Foundry. This article shows how to surface that agent inside Joule — SAP’s AI copilot — which is integrated with SAP Work Zone.

 

Prerequisites

 

Procedure

 

Step 1 — Create a BTP Destination for the CAP A2A Agent

 

In your BTP sub-account, create a destination that points to the deployed pro-code CAP A2A Agent service URL.

Jacky_Liu1_0-1787537617976.png

 

Step 2 — Build the Joule Pro-Code Capability

 

Create a joule-capability/ folder in your project with the following files.

Jacky_Liu1_1-1787537641748.png

 

joule-capability/functions/call_agent.yaml

parameters:
– name: contextId
optional: true
– name: taskId
optional: true

action_groups:
– actions:
– type: status-update
message: <? “Processing your delivery request…” ?>

– type: agent-request
agent_type: remote
system_alias: OutboundDeliveryAgent
body: >
<? (contextId == null || contextId.isEmpty()) && (taskId == null || taskId.isEmpty())
? null
: ‘{ “contextId”: “‘ + contextId + ‘”, “taskId”: “‘ + taskId + ‘” }’ ?>
result_variable: result

– type: set-variables
variables:
– name: contextId
value: <? result.body.contextId ?>
– name: taskId
value: <? result.body.id ?>

– type: message
message:
type: text
content: “<? result.body.status.message.parts[0].text ?>”
markdown: true

result:
contextId: “<? contextId ?>”
taskId: “<? taskId ?>”

 

joule-capability/scenarios/invoke_agent.yaml

description: >
Invoke this agent for anything related to SAP S/4HANA outbound deliveries.
Call this when the user asks to look up delivery documents, check delivery
items, create a new outbound delivery, or query the status of a shipment.
Examples: “Show me the outbound deliveries for shipping point 1000”,
“What items are in delivery 80000012?”,
“Create a delivery from sales order 5000001”,
“List all deliveries for this week”.

target:
type: function
name: call_agent
parameters:
– name: contextId
value: $capability_context.contextId
– name: taskId
value: $capability_context.taskId

capability_context:
– name: contextId
value: $target_result.contextId
– name: taskId
value: $target_result.taskId

 

joule-capability/capability_context.yaml

variables:
– name: contextId
– name: taskId

 

joule-capability/capability.sapdas.yaml

schema_version: 3.28.0

metadata:
namespace: joule.ext
name: capagents4_a2a
version: 1.0.0
display_name: “Outbound Delivery Agent”
description: An A2A agent for managing SAP S/4HANA outbound deliveries. Handles querying delivery documents, delivery items, and creating new outbound deliveries.

system_aliases:
OutboundDeliveryAgent:
destination: capa2as4

 

joule-capability/da.sapdas.yaml

schema_version: 1.4.0
name: capagents4_a2a
capabilities:
– type: local
folder: ./

 

Step 3 — Deploy the Joule Capability

 

Log in with the Joule CLI and deploy the capability:

joule login –apiurl “<joule url>” -a “<ias url>” -c “<client id>” -s “<client secret>” –username “<user name>” –store-password –no-app-tid

joule deploy -c joule-capability/da.sapdas.yaml

Jacky_Liu1_2-1787537670641.png

 

 
Jacky_Liu1_3-1787537682434.png

 

Step 4 — Test the Deployed Capability

 

List deployed capabilities and launch a local test session:

joule list

joule launch

 

Jacky_Liu1_4-1787537706681.png

 

Jacky_Liu1_5-1787537716013.png

 

 

Step 5 — Integrate the Capability with Unified Joule in SAP Work Zone

 

Update the SAP Digital Assistant with the new capability:

joule update “sap_digital_assistant” –capability-file joule-capability/capability.sapdas.yaml

Jacky_Liu1_6-1787537736756.png

 

Step 6 — Test the Agent in SAP Work Zone

 

Open Joule in SAP Work Zone and interact with the outbound delivery agent.

Jacky_Liu1_7-1787537759293.png

 

Jacky_Liu1_9-1787537795355.pngJacky_Liu1_10-1787537805572.png

 

 

The End! Thanks for your time! Jacky Liu

“}]] 

 [[{“value”:”Overview In my previous blog Build a Pro-Code A2A Agent for SAP S/4HANA Cloud with the CAP Agent Plugin (Node.js), we deployed a pro-code CAP agent to SAP Cloud Foundry. This article shows how to surface that agent inside Joule — SAP’s AI copilot — which is integrated with SAP Work Zone. PrerequisitesUnified Joule is set up and integrated with SAP Work Zone.Joule Studio CLI is installed and authenticated.SAP Cloud Foundry CLI is installed. Procedure Step 1 — Create a BTP Destination for the CAP A2A Agent In your BTP sub-account, create a destination that points to the deployed pro-code CAP A2A Agent service URL. Step 2 — Build the Joule Pro-Code Capability Create a joule-capability/ folder in your project with the following files. joule-capability/functions/call_agent.yamlparameters:
– name: contextId
optional: true
– name: taskId
optional: true

action_groups:
– actions:
– type: status-update
message: <? “Processing your delivery request…” ?>

– type: agent-request
agent_type: remote
system_alias: OutboundDeliveryAgent
body: >
<? (contextId == null || contextId.isEmpty()) && (taskId == null || taskId.isEmpty())
? null
: ‘{ “contextId”: “‘ + contextId + ‘”, “taskId”: “‘ + taskId + ‘” }’ ?>
result_variable: result

– type: set-variables
variables:
– name: contextId
value: <? result.body.contextId ?>
– name: taskId
value: <? result.body.id ?>

– type: message
message:
type: text
content: “<? result.body.status.message.parts[0].text ?>”
markdown: true

result:
contextId: “<? contextId ?>”
taskId: “<? taskId ?>” joule-capability/scenarios/invoke_agent.yamldescription: >
Invoke this agent for anything related to SAP S/4HANA outbound deliveries.
Call this when the user asks to look up delivery documents, check delivery
items, create a new outbound delivery, or query the status of a shipment.
Examples: “Show me the outbound deliveries for shipping point 1000”,
“What items are in delivery 80000012?”,
“Create a delivery from sales order 5000001”,
“List all deliveries for this week”.

target:
type: function
name: call_agent
parameters:
– name: contextId
value: $capability_context.contextId
– name: taskId
value: $capability_context.taskId

capability_context:
– name: contextId
value: $target_result.contextId
– name: taskId
value: $target_result.taskId joule-capability/capability_context.yamlvariables:
– name: contextId
– name: taskId joule-capability/capability.sapdas.yamlschema_version: 3.28.0

metadata:
namespace: joule.ext
name: capagents4_a2a
version: 1.0.0
display_name: “Outbound Delivery Agent”
description: An A2A agent for managing SAP S/4HANA outbound deliveries. Handles querying delivery documents, delivery items, and creating new outbound deliveries.

system_aliases:
OutboundDeliveryAgent:
destination: capa2as4 joule-capability/da.sapdas.yamlschema_version: 1.4.0
name: capagents4_a2a
capabilities:
– type: local
folder: ./ Step 3 — Deploy the Joule Capability Log in with the Joule CLI and deploy the capability:joule login –apiurl “<joule url>” -a “<ias url>” -c “<client id>” -s “<client secret>” –username “<user name>” –store-password –no-app-tid

joule deploy -c joule-capability/da.sapdas.yaml   Step 4 — Test the Deployed Capability List deployed capabilities and launch a local test session:joule list

joule launch    Step 5 — Integrate the Capability with Unified Joule in SAP Work Zone Update the SAP Digital Assistant with the new capability:joule update “sap_digital_assistant” –capability-file joule-capability/capability.sapdas.yaml Step 6 — Test the Agent in SAP Work Zone Open Joule in SAP Work Zone and interact with the outbound delivery agent.   The End! Thanks for your time! Jacky Liu”}]] Read More Technology Blog Posts by SAP articles 

#SAPCHANNEL

By ali

Leave a Reply