Skip to content

Commit e8f0c76

Browse files
authored
feat(consumption): Add Invoke Nested Agent operation for Consumption Logic Apps (#8660)
* Adding Invoke Nested Agent operation * Reset package files to main * Adding Unit Tests * Making task message mandatory * Filtering for nested agent operation
1 parent 4f8e291 commit e8f0c76

18 files changed

Lines changed: 536 additions & 2 deletions

File tree

Localize/lang/strings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,7 @@
12181218
"QHdKnm": "Drag and connect nodes to transform",
12191219
"QIzNzB": "Toggle the agent log panel.",
12201220
"QKC8fv": "Enter variable name",
1221+
"QMuDPI": "Select workflow with an Agent loop",
12211222
"QMyMOI": "Description",
12221223
"QNfUf/": "Full screen",
12231224
"QT4IaP": "Filtered!",
@@ -2870,6 +2871,7 @@
28702871
"_QHdKnm.comment": "default placeholder text",
28712872
"_QIzNzB.comment": "Toggle the agent log panel aria label text",
28722873
"_QKC8fv.comment": "Placeholder for variable name",
2874+
"_QMuDPI.comment": "Select workflow with an Agent loop",
28732875
"_QMyMOI.comment": "Description label",
28742876
"_QNfUf/.comment": "Full Screen token picker",
28752877
"_QT4IaP.comment": "Filtered text",

apps/Standalone/src/designer/app/AzureLogicAppsDesigner/laDesignerConsumption.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ const getDesignerServices = (
427427
...defaultServiceParams,
428428
clientSupportedOperations: [
429429
['/connectionProviders/workflow', 'invokeWorkflow'],
430+
['/connectionProviders/workflow', 'invokenestedagent'],
430431
['connectionProviders/xmlOperations', 'xmlValidation'],
431432
['connectionProviders/xmlOperations', 'xmlTransform'],
432433
['connectionProviders/liquidOperations', 'liquidJsonToJson'],

apps/Standalone/src/designer/app/AzureLogicAppsDesigner/laDesignerConsumptionV2.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ const getDesignerServices = (
582582
...defaultServiceParams,
583583
clientSupportedOperations: [
584584
['/connectionProviders/workflow', 'invokeWorkflow'],
585+
['/connectionProviders/workflow', 'invokenestedagent'],
585586
['connectionProviders/xmlOperations', 'xmlValidation'],
586587
['connectionProviders/xmlOperations', 'xmlTransform'],
587588
['connectionProviders/liquidOperations', 'liquidJsonToJson'],

apps/Standalone/src/templates/app/TemplatesConsumption.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ const getResourceBasedServices = (
366366
...defaultServiceParams,
367367
clientSupportedOperations: [
368368
['/connectionProviders/workflow', 'invokeWorkflow'],
369+
['/connectionProviders/workflow', 'invokenestedagent'],
369370
['connectionProviders/xmlOperations', 'xmlValidation'],
370371
['connectionProviders/xmlOperations', 'xmlTransform'],
371372
['connectionProviders/liquidOperations', 'liquidJsonToJson'],

libs/designer-v2/src/lib/common/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,7 @@ export default {
979979
SELECT_BATCH_WORKFLOW_ACTION: 'sendtobatch',
980980
SELECT_BATCH_WORKFLOW_TRIGGER: 'sendtobatchtrigger',
981981
SELECT_MANUAL_WORKFLOW_ACTION: 'invokeworkflow',
982+
SELECT_NESTED_AGENT_WORKFLOW_ACTION: 'invokenestedagent',
982983
},
983984
CHANNELS: {
984985
INPUT: '-inputchannel-',

libs/designer-v2/src/lib/ui/panel/recommendation/azureResourceSelection.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ export const AzureResourceSelection = (props: AzureResourceSelectionProps) => {
6464
id: 'DXwS7e',
6565
description: "Select workflow with 'An HTTP Request' trigger",
6666
});
67+
const nestedAgentWorkflowTitleText = intl.formatMessage({
68+
defaultMessage: 'Select workflow with an Agent loop',
69+
id: 'QMuDPI',
70+
description: 'Select workflow with an Agent loop',
71+
});
6772
const batchWorkflowTitleText = intl.formatMessage({
6873
defaultMessage: 'Select a Batch Workflow resource',
6974
id: 'gvDMuq',
@@ -213,6 +218,21 @@ export const AzureResourceSelection = (props: AzureResourceSelectionProps) => {
213218
break;
214219
}
215220

221+
case Constants.AZURE_RESOURCE_ACTION_TYPES.SELECT_NESTED_AGENT_WORKFLOW_ACTION: {
222+
setTitleText(nestedAgentWorkflowTitleText);
223+
setResourceTypes(['agentWorkflow']);
224+
setGetResourcesCallbacks(() => [() => SearchService().getAgentWorkflows?.()]);
225+
setSubmitCallback(() => () => {
226+
addResourceOperation({
227+
name: getResourceName(selectedResources[0]),
228+
presetParameterValues: {
229+
'host.workflow.id': selectedResources[0].id,
230+
},
231+
});
232+
});
233+
break;
234+
}
235+
216236
case Constants.AZURE_RESOURCE_ACTION_TYPES.SELECT_BATCH_WORKFLOW_ACTION: {
217237
setTitleText(batchWorkflowTitleText);
218238
setResourceTypes(['batchWorkflow', 'trigger']);
@@ -244,6 +264,7 @@ export const AzureResourceSelection = (props: AzureResourceSelectionProps) => {
244264
swaggerFunctionAppTitleText,
245265
getOptionsFromPaths,
246266
manualWorkflowTitleText,
267+
nestedAgentWorkflowTitleText,
247268
operation.id,
248269
selectedResources,
249270
]);

libs/designer/src/lib/common/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,7 @@ export default {
984984
SELECT_BATCH_WORKFLOW_ACTION: 'sendtobatch',
985985
SELECT_BATCH_WORKFLOW_TRIGGER: 'sendtobatchtrigger',
986986
SELECT_MANUAL_WORKFLOW_ACTION: 'invokeworkflow',
987+
SELECT_NESTED_AGENT_WORKFLOW_ACTION: 'invokenestedagent',
987988
},
988989
CHANNELS: {
989990
INPUT: '-inputchannel-',

libs/designer/src/lib/ui/panel/recommendation/azureResourceSelection.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ export const AzureResourceSelection = (props: AzureResourceSelectionProps) => {
6262
id: 'DXwS7e',
6363
description: "Select workflow with 'An HTTP Request' trigger",
6464
});
65+
const nestedAgentWorkflowTitleText = intl.formatMessage({
66+
defaultMessage: 'Select workflow with an Agent loop',
67+
id: 'QMuDPI',
68+
description: 'Select workflow with an Agent loop',
69+
});
6570
const batchWorkflowTitleText = intl.formatMessage({
6671
defaultMessage: 'Select a Batch Workflow resource',
6772
id: 'gvDMuq',
@@ -210,6 +215,21 @@ export const AzureResourceSelection = (props: AzureResourceSelectionProps) => {
210215
break;
211216
}
212217

218+
case Constants.AZURE_RESOURCE_ACTION_TYPES.SELECT_NESTED_AGENT_WORKFLOW_ACTION: {
219+
setTitleText(nestedAgentWorkflowTitleText);
220+
setResourceTypes(['agentWorkflow']);
221+
setGetResourcesCallbacks(() => [() => SearchService().getAgentWorkflows?.()]);
222+
setSubmitCallback(() => () => {
223+
addResourceOperation({
224+
name: getResourceName(selectedResources[0]),
225+
presetParameterValues: {
226+
'host.workflow.id': selectedResources[0].id,
227+
},
228+
});
229+
});
230+
break;
231+
}
232+
213233
case Constants.AZURE_RESOURCE_ACTION_TYPES.SELECT_BATCH_WORKFLOW_ACTION: {
214234
setTitleText(batchWorkflowTitleText);
215235
setResourceTypes(['batchWorkflow', 'trigger']);
@@ -241,6 +261,7 @@ export const AzureResourceSelection = (props: AzureResourceSelectionProps) => {
241261
swaggerFunctionAppTitleText,
242262
getOptionsFromPaths,
243263
manualWorkflowTitleText,
264+
nestedAgentWorkflowTitleText,
244265
operation.id,
245266
selectedResources,
246267
]);

libs/designer/src/lib/ui/panel/recommendation/searchView.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ export const SearchView: FC<SearchViewProps> = ({
125125
return false;
126126
}
127127

128-
if (equals(type, constants.NODE.TYPE.NESTED_AGENT) && id === 'invokeNestedAgent') {
128+
if (equals(type, constants.NODE.TYPE.NESTED_AGENT) && equals(id, 'invokenestedagent')) {
129+
if (!isA2AWorkflow) {
130+
return false;
131+
}
129132
if (!(isWithinAgenticLoop || isAgentTool)) {
130133
return false;
131134
}

libs/logic-apps-shared/src/designer-client-services/lib/__test__/__mocks__/builtInOperationResponse.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,6 +1815,27 @@ export const almostAllBuiltInOperations: DiscoveryOperation<DiscoveryResultTypes
18151815
iconUri: 'https://logicappsv2resources.blob.core.windows.net/icons/workflow.svg',
18161816
},
18171817
},
1818+
{
1819+
name: 'invokeNestedAgent',
1820+
id: 'invokenestedagent',
1821+
type: 'nestedagent',
1822+
properties: {
1823+
api: {
1824+
id: 'connectionProviders/workflow',
1825+
name: 'connectionProviders/workflow',
1826+
displayName: 'Azure Logic Apps',
1827+
iconUri: 'https://logicappsv2resources.blob.core.windows.net/icons/workflow.svg',
1828+
brandColor: '#59b2d9',
1829+
description: 'Azure Logic Apps',
1830+
},
1831+
summary: 'Choose a Logic Apps workflow',
1832+
description: 'Send a task to a nested agent workflow in the same region',
1833+
visibility: 'Important',
1834+
operationType: 'NestedAgent',
1835+
brandColor: '#59b2d9',
1836+
iconUri: 'https://logicappsv2resources.blob.core.windows.net/icons/workflow.svg',
1837+
},
1838+
},
18181839
{
18191840
name: 'xmlTransform',
18201841
id: 'xmlTransform',

0 commit comments

Comments
 (0)