Skip to content

Commit a8bf3f4

Browse files
Adds multi-turn input support for an Agent node in an Amazon Bedrock Flow
1 parent 408b393 commit a8bf3f4

16 files changed

+593
-7
lines changed

generator/ServiceModels/bedrock-agent-runtime/bedrock-agent-runtime-2023-07-26.api.json

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,16 @@
945945
},
946946
"FlowCompletionReason":{
947947
"type":"string",
948-
"enum":["SUCCESS"]
948+
"enum":[
949+
"SUCCESS",
950+
"INPUT_REQUIRED"
951+
]
952+
},
953+
"FlowExecutionId":{
954+
"type":"string",
955+
"max":100,
956+
"min":2,
957+
"pattern":"^[0-9a-zA-Z._:-]+$"
949958
},
950959
"FlowIdentifier":{
951960
"type":"string",
@@ -957,11 +966,11 @@
957966
"type":"structure",
958967
"required":[
959968
"content",
960-
"nodeName",
961-
"nodeOutputName"
969+
"nodeName"
962970
],
963971
"members":{
964972
"content":{"shape":"FlowInputContent"},
973+
"nodeInputName":{"shape":"NodeInputName"},
965974
"nodeName":{"shape":"NodeName"},
966975
"nodeOutputName":{"shape":"NodeOutputName"}
967976
}
@@ -980,6 +989,28 @@
980989
"max":1,
981990
"min":1
982991
},
992+
"FlowMultiTurnInputContent":{
993+
"type":"structure",
994+
"members":{
995+
"document":{"shape":"Document"}
996+
},
997+
"union":true
998+
},
999+
"FlowMultiTurnInputRequestEvent":{
1000+
"type":"structure",
1001+
"required":[
1002+
"content",
1003+
"nodeName",
1004+
"nodeType"
1005+
],
1006+
"members":{
1007+
"content":{"shape":"FlowMultiTurnInputContent"},
1008+
"nodeName":{"shape":"NodeName"},
1009+
"nodeType":{"shape":"NodeType"}
1010+
},
1011+
"event":true,
1012+
"sensitive":true
1013+
},
9831014
"FlowOutputContent":{
9841015
"type":"structure",
9851016
"members":{
@@ -1010,6 +1041,7 @@
10101041
"conflictException":{"shape":"ConflictException"},
10111042
"dependencyFailedException":{"shape":"DependencyFailedException"},
10121043
"flowCompletionEvent":{"shape":"FlowCompletionEvent"},
1044+
"flowMultiTurnInputRequestEvent":{"shape":"FlowMultiTurnInputRequestEvent"},
10131045
"flowOutputEvent":{"shape":"FlowOutputEvent"},
10141046
"flowTraceEvent":{"shape":"FlowTraceEvent"},
10151047
"internalServerException":{"shape":"InternalServerException"},
@@ -1868,6 +1900,7 @@
18681900
],
18691901
"members":{
18701902
"enableTrace":{"shape":"Boolean"},
1903+
"executionId":{"shape":"FlowExecutionId"},
18711904
"flowAliasIdentifier":{
18721905
"shape":"FlowAliasIdentifier",
18731906
"location":"uri",
@@ -1886,6 +1919,11 @@
18861919
"type":"structure",
18871920
"required":["responseStream"],
18881921
"members":{
1922+
"executionId":{
1923+
"shape":"FlowExecutionId",
1924+
"location":"header",
1925+
"locationName":"x-amz-bedrock-flow-execution-id"
1926+
},
18891927
"responseStream":{"shape":"FlowResponseStream"}
18901928
},
18911929
"payload":"responseStream"

generator/ServiceModels/bedrock-agent-runtime/bedrock-agent-runtime-2023-07-26.docs.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@
491491
"base": null,
492492
"refs": {
493493
"FlowInputContent$document": "<p>The input to send to the prompt flow input node.</p>",
494+
"FlowMultiTurnInputContent$document": "<p>The requested additional input to send back to the multi-turn flow node.</p>",
494495
"FlowOutputContent$document": "<p>The content in the output.</p>",
495496
"FlowTraceNodeInputContent$document": "<p>The content of the node input.</p>",
496497
"FlowTraceNodeOutputContent$document": "<p>The content of the node output.</p>",
@@ -671,6 +672,13 @@
671672
"FlowCompletionEvent$completionReason": "<p>The reason that the flow completed.</p>"
672673
}
673674
},
675+
"FlowExecutionId": {
676+
"base": null,
677+
"refs": {
678+
"InvokeFlowRequest$executionId": "<p>The unique identifier for the current flow execution. If you don't provide a value, Amazon Bedrock creates the identifier for you. </p>",
679+
"InvokeFlowResponse$executionId": "<p>The unique identifier for the current flow execution.</p>"
680+
}
681+
},
674682
"FlowIdentifier": {
675683
"base": null,
676684
"refs": {
@@ -695,6 +703,18 @@
695703
"InvokeFlowRequest$inputs": "<p>A list of objects, each containing information about an input into the flow.</p>"
696704
}
697705
},
706+
"FlowMultiTurnInputContent": {
707+
"base": "<p>The content structure containing input information for multi-turn flow interactions.</p>",
708+
"refs": {
709+
"FlowMultiTurnInputRequestEvent$content": "<p>The content payload containing the input request details for the multi-turn interaction.</p>"
710+
}
711+
},
712+
"FlowMultiTurnInputRequestEvent": {
713+
"base": "<p>Response object from the flow multi-turn node requesting additional information.</p>",
714+
"refs": {
715+
"FlowResponseStream$flowMultiTurnInputRequestEvent": "<p>The event stream containing the multi-turn input request information from the flow.</p>"
716+
}
717+
},
698718
"FlowOutputContent": {
699719
"base": "<p>Contains information about the content in an output from prompt flow invocation.</p>",
700720
"refs": {
@@ -1601,13 +1621,15 @@
16011621
"NodeInputName": {
16021622
"base": null,
16031623
"refs": {
1624+
"FlowInput$nodeInputName": "<p>The name of the input from the flow input node.</p>",
16041625
"FlowTraceNodeInputField$nodeInputName": "<p>The name of the node input.</p>"
16051626
}
16061627
},
16071628
"NodeName": {
16081629
"base": null,
16091630
"refs": {
16101631
"FlowInput$nodeName": "<p>The name of the flow input node that begins the prompt flow.</p>",
1632+
"FlowMultiTurnInputRequestEvent$nodeName": "<p>The name of the node in the flow that is requesting the input.</p>",
16111633
"FlowOutputEvent$nodeName": "<p>The name of the flow output node that the output is from.</p>",
16121634
"FlowTraceConditionNodeResultEvent$nodeName": "<p>The name of the condition node.</p>",
16131635
"FlowTraceNodeInputEvent$nodeName": "<p>The name of the node that received the input.</p>",
@@ -1624,6 +1646,7 @@
16241646
"NodeType": {
16251647
"base": null,
16261648
"refs": {
1649+
"FlowMultiTurnInputRequestEvent$nodeType": "<p>The type of the node in the flow that is requesting the input.</p>",
16271650
"FlowOutputEvent$nodeType": "<p>The type of the node that the output is from.</p>"
16281651
}
16291652
},

generator/ServiceModels/bedrock-agent-runtime/bedrock-agent-runtime-2023-07-26.normal.json

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,16 @@
13141314
},
13151315
"FlowCompletionReason":{
13161316
"type":"string",
1317-
"enum":["SUCCESS"]
1317+
"enum":[
1318+
"SUCCESS",
1319+
"INPUT_REQUIRED"
1320+
]
1321+
},
1322+
"FlowExecutionId":{
1323+
"type":"string",
1324+
"max":100,
1325+
"min":2,
1326+
"pattern":"^[0-9a-zA-Z._:-]+$"
13181327
},
13191328
"FlowIdentifier":{
13201329
"type":"string",
@@ -1326,14 +1335,17 @@
13261335
"type":"structure",
13271336
"required":[
13281337
"content",
1329-
"nodeName",
1330-
"nodeOutputName"
1338+
"nodeName"
13311339
],
13321340
"members":{
13331341
"content":{
13341342
"shape":"FlowInputContent",
13351343
"documentation":"<p>Contains information about an input into the prompt flow.</p>"
13361344
},
1345+
"nodeInputName":{
1346+
"shape":"NodeInputName",
1347+
"documentation":"<p>The name of the input from the flow input node.</p>"
1348+
},
13371349
"nodeName":{
13381350
"shape":"NodeName",
13391351
"documentation":"<p>The name of the flow input node that begins the prompt flow.</p>"
@@ -1363,6 +1375,42 @@
13631375
"max":1,
13641376
"min":1
13651377
},
1378+
"FlowMultiTurnInputContent":{
1379+
"type":"structure",
1380+
"members":{
1381+
"document":{
1382+
"shape":"Document",
1383+
"documentation":"<p>The requested additional input to send back to the multi-turn flow node.</p>"
1384+
}
1385+
},
1386+
"documentation":"<p>The content structure containing input information for multi-turn flow interactions.</p>",
1387+
"union":true
1388+
},
1389+
"FlowMultiTurnInputRequestEvent":{
1390+
"type":"structure",
1391+
"required":[
1392+
"content",
1393+
"nodeName",
1394+
"nodeType"
1395+
],
1396+
"members":{
1397+
"content":{
1398+
"shape":"FlowMultiTurnInputContent",
1399+
"documentation":"<p>The content payload containing the input request details for the multi-turn interaction.</p>"
1400+
},
1401+
"nodeName":{
1402+
"shape":"NodeName",
1403+
"documentation":"<p>The name of the node in the flow that is requesting the input.</p>"
1404+
},
1405+
"nodeType":{
1406+
"shape":"NodeType",
1407+
"documentation":"<p>The type of the node in the flow that is requesting the input.</p>"
1408+
}
1409+
},
1410+
"documentation":"<p>Response object from the flow multi-turn node requesting additional information.</p>",
1411+
"event":true,
1412+
"sensitive":true
1413+
},
13661414
"FlowOutputContent":{
13671415
"type":"structure",
13681416
"members":{
@@ -1422,6 +1470,10 @@
14221470
"shape":"FlowCompletionEvent",
14231471
"documentation":"<p>Contains information about why the flow completed.</p>"
14241472
},
1473+
"flowMultiTurnInputRequestEvent":{
1474+
"shape":"FlowMultiTurnInputRequestEvent",
1475+
"documentation":"<p>The event stream containing the multi-turn input request information from the flow.</p>"
1476+
},
14251477
"flowOutputEvent":{
14261478
"shape":"FlowOutputEvent",
14271479
"documentation":"<p>Contains information about an output from flow invocation.</p>"
@@ -2805,6 +2857,10 @@
28052857
"shape":"Boolean",
28062858
"documentation":"<p>Specifies whether to return the trace for the flow or not. Traces track inputs and outputs for nodes in the flow. For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/flows-trace.html\">Track each step in your prompt flow by viewing its trace in Amazon Bedrock</a>.</p>"
28072859
},
2860+
"executionId":{
2861+
"shape":"FlowExecutionId",
2862+
"documentation":"<p>The unique identifier for the current flow execution. If you don't provide a value, Amazon Bedrock creates the identifier for you. </p>"
2863+
},
28082864
"flowAliasIdentifier":{
28092865
"shape":"FlowAliasIdentifier",
28102866
"documentation":"<p>The unique identifier of the flow alias.</p>",
@@ -2831,6 +2887,12 @@
28312887
"type":"structure",
28322888
"required":["responseStream"],
28332889
"members":{
2890+
"executionId":{
2891+
"shape":"FlowExecutionId",
2892+
"documentation":"<p>The unique identifier for the current flow execution.</p>",
2893+
"location":"header",
2894+
"locationName":"x-amz-bedrock-flow-execution-id"
2895+
},
28342896
"responseStream":{
28352897
"shape":"FlowResponseStream",
28362898
"documentation":"<p>The output of the flow, returned as a stream. If there's an error, the error is returned.</p>"

sdk/code-analysis/ServiceAnalysis/BedrockAgentRuntime/Generated/PropertyValueRules.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@
106106
<max>100</max>
107107
<pattern>^[0-9a-zA-Z._:-]+$</pattern>
108108
</property-value-rule>
109+
<property-value-rule>
110+
<property>Amazon.BedrockAgentRuntime.Model.InvokeFlowRequest.ExecutionId</property>
111+
<min>2</min>
112+
<max>100</max>
113+
<pattern>^[0-9a-zA-Z._:-]+$</pattern>
114+
</property-value-rule>
109115
<property-value-rule>
110116
<property>Amazon.BedrockAgentRuntime.Model.InvokeFlowRequest.FlowAliasIdentifier</property>
111117
<min>0</min>
@@ -118,6 +124,12 @@
118124
<max>2048</max>
119125
<pattern>^(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10})|([0-9a-zA-Z]{10})$</pattern>
120126
</property-value-rule>
127+
<property-value-rule>
128+
<property>Amazon.BedrockAgentRuntime.Model.InvokeFlowResponse.ExecutionId</property>
129+
<min>2</min>
130+
<max>100</max>
131+
<pattern>^[0-9a-zA-Z._:-]+$</pattern>
132+
</property-value-rule>
121133
<property-value-rule>
122134
<property>Amazon.BedrockAgentRuntime.Model.InvokeInlineAgentRequest.CustomerEncryptionKeyArn</property>
123135
<min>1</min>
@@ -317,6 +329,10 @@
317329
<min>1</min>
318330
<max>100</max>
319331
</property-value-rule>
332+
<property-value-rule>
333+
<property>Amazon.BedrockAgentRuntime.Model.FlowInput.NodeInputName</property>
334+
<pattern>^[a-zA-Z]([_]?[0-9a-zA-Z]){0,99}$</pattern>
335+
</property-value-rule>
320336
<property-value-rule>
321337
<property>Amazon.BedrockAgentRuntime.Model.FlowInput.NodeName</property>
322338
<pattern>^[a-zA-Z]([_]?[0-9a-zA-Z]){0,99}$</pattern>
@@ -325,6 +341,10 @@
325341
<property>Amazon.BedrockAgentRuntime.Model.FlowInput.NodeOutputName</property>
326342
<pattern>^[a-zA-Z]([_]?[0-9a-zA-Z]){0,99}$</pattern>
327343
</property-value-rule>
344+
<property-value-rule>
345+
<property>Amazon.BedrockAgentRuntime.Model.FlowMultiTurnInputRequestEvent.NodeName</property>
346+
<pattern>^[a-zA-Z]([_]?[0-9a-zA-Z]){0,99}$</pattern>
347+
</property-value-rule>
328348
<property-value-rule>
329349
<property>Amazon.BedrockAgentRuntime.Model.FlowOutputEvent.NodeName</property>
330350
<pattern>^[a-zA-Z]([_]?[0-9a-zA-Z]){0,99}$</pattern>

sdk/src/Services/BedrockAgentRuntime/Generated/Model/FlowInput.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ namespace Amazon.BedrockAgentRuntime.Model
3535
public partial class FlowInput
3636
{
3737
private FlowInputContent _content;
38+
private string _nodeInputName;
3839
private string _nodeName;
3940
private string _nodeOutputName;
4041

@@ -57,6 +58,24 @@ internal bool IsSetContent()
5758
return this._content != null;
5859
}
5960

61+
/// <summary>
62+
/// Gets and sets the property NodeInputName.
63+
/// <para>
64+
/// The name of the input from the flow input node.
65+
/// </para>
66+
/// </summary>
67+
public string NodeInputName
68+
{
69+
get { return this._nodeInputName; }
70+
set { this._nodeInputName = value; }
71+
}
72+
73+
// Check to see if NodeInputName property is set
74+
internal bool IsSetNodeInputName()
75+
{
76+
return this._nodeInputName != null;
77+
}
78+
6079
/// <summary>
6180
/// Gets and sets the property NodeName.
6281
/// <para>
@@ -82,7 +101,6 @@ internal bool IsSetNodeName()
82101
/// The name of the output from the flow input node that begins the prompt flow.
83102
/// </para>
84103
/// </summary>
85-
[AWSProperty(Required=true)]
86104
public string NodeOutputName
87105
{
88106
get { return this._nodeOutputName; }

0 commit comments

Comments
 (0)