mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET Workflows - Integrate Element Aliasing (#835)
* Checkpoint * Update test workflows * Update workflows/MathChat.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update folder * Cleanup * Signed package version * Rollback nuget.config * Cleanup * Set `ProductContext` * Move product initialization. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -89,9 +89,9 @@
|
||||
<!-- Identity -->
|
||||
<PackageVersion Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.77.0" />
|
||||
<!-- Workflows -->
|
||||
<PackageVersion Include="Microsoft.Bot.ObjectModel" Version="1.2025.915-1" />
|
||||
<PackageVersion Include="Microsoft.Bot.ObjectModel.Json" Version="1.2025.915-1" />
|
||||
<PackageVersion Include="Microsoft.Bot.ObjectModel.PowerFx" Version="1.2025.915-1" />
|
||||
<PackageVersion Include="Microsoft.Bot.ObjectModel" Version="1.2025.922-1" />
|
||||
<PackageVersion Include="Microsoft.Bot.ObjectModel.Json" Version="1.2025.922-1" />
|
||||
<PackageVersion Include="Microsoft.Bot.ObjectModel.PowerFx" Version="1.2025.922-1" />
|
||||
<PackageVersion Include="Microsoft.PowerFx.Interpreter" Version="1.4.0-build.20250821-1001" />
|
||||
<!-- Test -->
|
||||
<PackageVersion Include="FluentAssertions" Version="8.6.0" />
|
||||
|
||||
@@ -291,7 +291,7 @@ internal sealed class Program
|
||||
string? repoFolder = GetRepoFolder();
|
||||
if (repoFolder is not null)
|
||||
{
|
||||
workflowFile = Path.Combine(repoFolder, "Workflows", workflowFile);
|
||||
workflowFile = Path.Combine(repoFolder, "workflow-samples", workflowFile);
|
||||
workflowFile = Path.ChangeExtension(workflowFile, ".yaml");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,10 +50,9 @@ public static class DeclarativeWorkflowBuilder
|
||||
{
|
||||
BotElement rootElement = YamlSerializer.Deserialize<BotElement>(yamlReader) ?? throw new DeclarativeModelException("Workflow undefined.");
|
||||
|
||||
// ISSUE #486 - Use "Workflow" element for Foundry.
|
||||
if (rootElement is not AdaptiveDialog workflowElement)
|
||||
{
|
||||
throw new DeclarativeModelException($"Unsupported root element: {rootElement.GetType().Name}. Expected an {nameof(AdaptiveDialog)}.");
|
||||
throw new DeclarativeModelException($"Unsupported root element: {rootElement.GetType().Name}. Expected an {nameof(Workflow)}.");
|
||||
}
|
||||
|
||||
string rootId = WorkflowActionVisitor.Steps.Root(workflowElement.BeginDialog?.Id.Value);
|
||||
|
||||
@@ -14,6 +14,7 @@ internal static class BotElementExtensions
|
||||
DialogAction action => action.Id.Value,
|
||||
ConditionItem conditionItem => conditionItem.Id ?? throw new DeclarativeModelException($"Undefined identifier for {nameof(ConditionItem)} that is member of {conditionItem.GetParentId() ?? "(root)"}."),
|
||||
OnActivity activity => activity.Id.Value,
|
||||
SystemTrigger trigger => trigger.Id.Value,
|
||||
_ => throw new DeclarativeModelException($"Unknown identify for element type: {element.GetType().Name}"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ namespace Microsoft.Agents.Workflows.Declarative.Interpreter;
|
||||
|
||||
internal sealed class WorkflowElementWalker : BotElementWalker
|
||||
{
|
||||
static WorkflowElementWalker()
|
||||
{
|
||||
ProductContext.SetContext(Product.Foundry);
|
||||
}
|
||||
|
||||
private readonly DialogActionVisitor _visitor;
|
||||
|
||||
public WorkflowElementWalker(DialogActionVisitor visitor)
|
||||
|
||||
+1
-13
@@ -20,7 +20,7 @@ internal sealed class AddConversationMessageExecutor(AddConversationMessage mode
|
||||
StringExpression conversationExpression = Throw.IfNull(this.Model.ConversationId, $"{nameof(this.Model)}.{nameof(this.Model.ConversationId)}");
|
||||
string conversationId = this.State.Evaluator.GetValue(conversationExpression).Value;
|
||||
|
||||
ChatMessage newMessage = new(this.GetRole(), [.. this.GetContent()]) { AdditionalProperties = this.GetMetadata() };
|
||||
ChatMessage newMessage = new(this.Model.Role.Value.ToChatRole(), [.. this.GetContent()]) { AdditionalProperties = this.GetMetadata() };
|
||||
|
||||
await agentProvider.CreateMessageAsync(conversationId, newMessage, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -41,18 +41,6 @@ internal sealed class AddConversationMessageExecutor(AddConversationMessage mode
|
||||
}
|
||||
}
|
||||
|
||||
private ChatRole GetRole()
|
||||
{
|
||||
if (this.Model.Role is null)
|
||||
{
|
||||
return ChatRole.User;
|
||||
}
|
||||
|
||||
AgentMessageRoleWrapper roleWrapper = this.State.Evaluator.GetValue(this.Model.Role).Value;
|
||||
|
||||
return roleWrapper.Value.ToChatRole();
|
||||
}
|
||||
|
||||
private AdditionalPropertiesDictionary? GetMetadata()
|
||||
{
|
||||
if (this.Model.Metadata is null)
|
||||
|
||||
+3
-9
@@ -1,13 +1,7 @@
|
||||
#
|
||||
# This workflow demonstrates a conversation and message manipulation.
|
||||
#
|
||||
# Any Foundry Agent may be used to provide the response.
|
||||
# See: ./setup/QuestionAgent.yaml
|
||||
#
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnActivity
|
||||
kind: OnConversationStart
|
||||
id: workflow_test
|
||||
actions:
|
||||
|
||||
|
||||
+3
-9
@@ -1,13 +1,7 @@
|
||||
#
|
||||
# This workflow demonstrates a conversation and message manipulation.
|
||||
#
|
||||
# Any Foundry Agent may be used to provide the response.
|
||||
# See: ./setup/QuestionAgent.yaml
|
||||
#
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnActivity
|
||||
kind: OnConversationStart
|
||||
id: workflow_test
|
||||
actions:
|
||||
|
||||
|
||||
+3
-9
@@ -1,13 +1,7 @@
|
||||
#
|
||||
# This workflow demonstrates a conversation and message manipulation.
|
||||
#
|
||||
# Any Foundry Agent may be used to provide the response.
|
||||
# See: ./setup/QuestionAgent.yaml
|
||||
#
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnActivity
|
||||
kind: OnConversationStart
|
||||
id: workflow_test
|
||||
actions:
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnActivity
|
||||
kind: OnConversationStart
|
||||
id: workflow_test
|
||||
actions:
|
||||
|
||||
|
||||
+3
-8
@@ -1,12 +1,7 @@
|
||||
#
|
||||
# This workflow provides the most basic example of providing a response that includes the user and environment input.
|
||||
#
|
||||
# No agent setup is required to run this workflow.
|
||||
#
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnActivity
|
||||
kind: OnConversationStart
|
||||
id: workflow_test
|
||||
actions:
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
type: Message
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
actions:
|
||||
|
||||
- kind: EndConversation
|
||||
id: end_all
|
||||
|
||||
+5
-4
@@ -1,9 +1,10 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: ClearAllVariables
|
||||
id: clear_all
|
||||
variables: [ConversationScopedVariables]
|
||||
|
||||
+4
-5
@@ -1,9 +1,8 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: SetVariable
|
||||
|
||||
+4
-5
@@ -1,9 +1,8 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: SetVariable
|
||||
|
||||
+6
-4
@@ -1,13 +1,15 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: SetVariable
|
||||
id: set_var
|
||||
variable: Topic.MyTable
|
||||
value: =[{id: 3}]
|
||||
|
||||
- kind: EditTable
|
||||
id: edit_var
|
||||
itemsVariable: Topic.MyTable
|
||||
|
||||
+6
-4
@@ -1,13 +1,15 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: SetVariable
|
||||
id: set_var
|
||||
variable: Topic.MyTable
|
||||
value: =[{id: 3}]
|
||||
|
||||
- kind: EditTableV2
|
||||
id: edit_var
|
||||
itemsVariable: Topic.MyTable
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: EndConversation
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: GotoAction
|
||||
|
||||
+5
-4
@@ -1,9 +1,10 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: SetVariable
|
||||
id: setVariable_count
|
||||
variable: Topic.Count
|
||||
|
||||
+5
-4
@@ -1,8 +1,9 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
|
||||
actions:
|
||||
- kind: SetVariable
|
||||
id: setVariable_count
|
||||
|
||||
+5
-4
@@ -1,8 +1,9 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
|
||||
actions:
|
||||
- kind: SetVariable
|
||||
id: setVariable_count
|
||||
|
||||
+5
-4
@@ -1,8 +1,9 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
|
||||
actions:
|
||||
- kind: ParseValue
|
||||
id: parse_var
|
||||
|
||||
+5
-4
@@ -1,9 +1,10 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: SetVariable
|
||||
id: set_var
|
||||
variable: Topic.MyVar
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: SetVariable
|
||||
|
||||
+5
-4
@@ -1,9 +1,10 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: SetTextVariable
|
||||
id: set_text
|
||||
variable: Topic.TestVar
|
||||
|
||||
+5
-4
@@ -1,9 +1,10 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: SetVariable
|
||||
id: set_var
|
||||
variable: Topic.TestVar
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: OnActivity
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: my_workflow
|
||||
type: Message
|
||||
actions:
|
||||
|
||||
- kind: EndConversation
|
||||
id: end_all
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
# Enable "Open API" in the agent settings using the wttr.json schema.
|
||||
# See: ./setup/WeatherAgent.yaml
|
||||
#
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnActivity
|
||||
id: activity_xyz123
|
||||
type: Message
|
||||
kind: OnConversationStart
|
||||
id: workflow_demo
|
||||
actions:
|
||||
|
||||
- kind: SetVariable
|
||||
id: setVariable_aASlmF
|
||||
displayName: List all available agents for this orchestrator
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
# Any Foundry Agent may be used to provide the response.
|
||||
# See: ./setup/QuestionAgent.yaml
|
||||
#
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnActivity
|
||||
kind: OnConversationStart
|
||||
id: workflow_demo
|
||||
actions:
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
# Any Foundry Agent may be used to provide the response.
|
||||
# See: ./setup/QuestionAgent.yaml
|
||||
#
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnActivity
|
||||
kind: OnConversationStart
|
||||
id: workflow_demo
|
||||
actions:
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
# Review and coach the student's approach to solving the given math problem.
|
||||
# Don't repeat the solution or try and solve it.
|
||||
# If the student has demonstrated comprehension and responded to all of your feedback,
|
||||
# give the student your congraluations by using the word "congratulations".
|
||||
# give the student your congratulations by using the word "congratulations".
|
||||
#
|
||||
kind: AdaptiveDialog
|
||||
beginDialog:
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnActivity
|
||||
kind: OnConversationStart
|
||||
id: workflow_demo
|
||||
actions:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user