Files
agent-framework/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative
T
alliscode 1baf4af4d8 Hosted-agent HITL: persist session across previous_response_id chains; run approved local AIFunctions
Two regressions hit declarative workflows that use require_approval=true when
the client chains turns via previous_response_id (no conversation_id):

1. AgentFrameworkResponseHandler keyed the AgentSession store solely on
   conversation_id, so when only previous_response_id was present the
   StateBag (which holds ToolApprovalIdMap) was discarded after each turn.
   The next turn then threw 'No approval mapping recorded for wire id ...'
   in InputConverter.ConvertMcpApprovalResponse.

   Fix: fall back to previous_response_id on load and to context.ResponseId
   on save so the response-id chain becomes a valid session key. Conversation
   id remains preferred when present.

2. InvokeFunctionToolExecutor.CaptureResponseAsync only acted on
   FunctionResultContent. In the hosted Foundry path the approval response
   arrives as a ToolApprovalResponseContent with no FunctionResultContent,
   so the local AIFunction never ran and downstream PropertyPath/SendActivity
   consumers (e.g. {Local.RefundResult}) saw empty values.

   Fix: when no FunctionResultContent matches but an approved
   ToolApprovalResponseContent does, look up the registered AIFunction by
   name on agentProvider.Functions and invoke it with the evaluated
   arguments, surfacing the result through the existing assignment path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1baf4af4d8 · 2026-05-15 17:19:50 -07:00
History
..

Declarative Workflows

Declarative Workflows is a no-code platform for orchestrating AI agents to accomplish complex, multi-step tasks with ease. It allows users to design, execute, and monitor workflows using simple declarative configurations—no coding required. By connecting multiple AI agents and services, it enables automation of sophisticated processes that traditionally require custom engineering.

We've provided a set of Sample Workflows within the agent-framework repository.

Please refer to the README for setup instructions to run the sample workflows in your environment.

As part of our Getting Started with Declarative Workflows, we've provided a console application that is able to execute any declarative workflow.

Actions

⚙️ Foundry Actions

Action Description
AddConversationMessage Adds a message to the current conversation thread. Useful for dynamically appending information or system responses.
CopyConversationMessages Duplicates messages from one conversation or context to another. Helps maintain continuity across related interactions.
CreateConversation Starts a new conversation instance. Used when initiating separate dialogues or workflows.
DeleteConversation Permanently removes an existing conversation. Helps manage storage and ensure privacy compliance.
InvokeAzureAgent Triggers an Azure-based AI agent to perform a task or return a response. Useful for leveraging external cognitive services.
RetrieveConversationMessage Fetches a single message from a conversation history. Enables referencing or reusing specific past exchanges.
RetrieveConversationMessages Retrieves multiple messages from the conversation history. Useful for context reconstruction or auditing.

🧑‍💼 Human Input

Action Description
Question Presents a query or prompt requiring human input. Integrates human decision-making into automated processes.

🧩 State Management

Action Description
ClearAllVariables Resets all variables in the current context. Ensures a clean state before starting new logic or sessions.
EditTableV2 Modifies data in a structured table format. Useful for updating variable sets or configuration data dynamically.
ParseValue Extracts or converts data into a usable format. Often used for transforming input before assignment or evaluation.
ResetVariable Restores a specific variable to its default or initial value. Helps maintain predictable state transitions.
SendActivity Sends an activity or message to another system or user. Facilitates communication between components or external services.
SetMultipleVariables Assigns values to multiple variables simultaneously. Useful for batch initialization or updates.
SetTextVariable Assigns text-based data to a variable. Commonly used for string operations or message composition.
SetVariable Sets or updates the value of a single variable. Fundamental for maintaining and controlling state within workflows.

🧭 Control Flow

Action Description
BreakLoop Exits the current loop prematurely when a specified condition is met. Useful for preventing unnecessary iterations once a goal is achieved.
ConditionGroup Defines a set of conditional statements that can be evaluated together. It allows complex decision logic to be grouped for readability and maintainability.
ConditionItem Represents a single conditional statement within a group. It evaluates a specific logical condition and determines the next step in the flow.
ContinueLoop Skips the remaining steps in the current iteration and continues with the next loop cycle. Commonly used to bypass specific cases without exiting the loop entirely.
EndConversation Terminates the current conversation session. It ensures any necessary cleanup or final actions are performed before closing.
EndWorkflow Ends the current workflow or sub-workflow within a broader conversation flow. This helps modularize complex interactions.
Foreach Iterates through a collection of items, executing a set of actions for each. Ideal for processing lists or batch operations.
GotoAction Jumps directly to a specified action within the workflow. Enables non-linear navigation in the logic flow.