feat(designer): Add Foundry Agent v2 inline details and save integration#8874
feat(designer): Add Foundry Agent v2 inline details and save integration#8874ccastrotrejo merged 22 commits intomainfrom
Conversation
- Add foundryAgentId, foundryAgentName, foundryAgentVersion to agent manifest with visibility conditions for FoundryAgentService model type - Hide AI model (deploymentId) when Foundry is selected - Create Foundry Agent API client (foundryAgentService.ts) for v2 agents - Add buildProjectEndpointFromResourceId to resolve Foundry endpoints - Add getFoundryAccessToken to ICognitiveServiceService interface - Create useFoundryAgentsForNode hook for dynamic agent fetching - Wire Foundry agent combobox in getEditorAndOptions (designer + v2) - Auto-populate foundryAgentName/foundryAgentVersion on agent selection - Fix agent connection serialization for Stateful workflows - Generate Foundry data-plane token in generateArmToken script - Add FoundryAgentPicker component in designer-ui Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…/foundry-agent-v2-picker
Add FoundryAgentDetails component showing model dropdown, editable instructions, tools summary, and Edit in Foundry Portal link inline after the agent picker. Hide system instructions when Foundry connection is active. Fix existing connection detection by mapping display names to manifest values and adding cognitiveServiceAccountId regex fallback. Add data-plane API for listing models and updating agents. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…y agents Add FoundryAgentService to deploymentId visibility dependencies in the manifest so the parameter is serialized. Sync deploymentId value when a Foundry agent is selected or the model dropdown changes. Hide the raw AI model field in the UI since FoundryAgentDetails already provides the model dropdown. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…hange Dispatch setIsWorkflowDirty(true) in handleFoundryModelChange and handleFoundryInstructionsChange so the save button activates when users modify Foundry agent settings inline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…x textarea resize - Add flushPendingFoundryUpdates() call to all 4 host save flows (Standalone v1/v2, VS Code v1/v2) so Foundry agent model/instructions changes are pushed to the Foundry API on workflow save - Fix textarea resize handle positioning in FoundryAgentDetails by removing conflicting CSS resize property and targeting inner textarea Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…te API The Foundry v2 agent update API requires model and instructions to be nested inside a 'definition' property with kind: 'agent'. Top-level name/description remain at the root level. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…odel Pass pendingFoundryModel as selectedModel prop to FoundryAgentDetails so the dropdown reflects the user's selection immediately instead of always showing the original agent.model value. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add unit tests for foundryAgentService (11 tests: endpoint builder, update payload envelope, model listing, error handling) - Add unit tests for foundryUpdates (8 tests: set/clear/has/flush) - Add unit tests for FoundryAgentDetails component (6 tests: render, portal link, tools summary) - Fix stale pending state when switching Foundry agents by resetting pendingFoundryModel and pendingFoundryInstructions on agent change - Extract normalizeEndpoint() helper to DRY up endpoint construction - Apply to both designer and designer-v2 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reverts the change from Object.keys(newAgentConnections).length > 0 back to isAgentWorkflow(workflow?.kind ?? '') in both laDesigner.tsx and laDesignerV2.tsx. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…th agent actions Stateful workflows can have Agent actions with agent connections (e.g. Foundry agents). The isAgentWorkflow check alone is too restrictive since it only matches 'agentic' or 'agent' kind workflows. Add fallback check for newAgentConnections to ensure they are always merged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use URL parser for hostname swap instead of substring includes/replace to ensure only the hostname portion is matched (not arbitrary path) - Use non-greedy regex quantifiers in buildProjectEndpointFromResourceId to avoid polynomial backtracking on crafted input - Replace trailing-slash strip with endsWith check + single replace Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ture - Remove foundryAgentId from unconditional required array in manifest - Fix flushPendingFoundryUpdates to only clear successful entries, surface failures - Gracefully skip flush when token getter unavailable (VS Code host) - Clear pending update from global map on agent switch to prevent stale flushes - Replace label string matching with stable parameterKey identifiers - Store agent.id (not name) as combobox value for foundryAgentId parameter - Switch instructions textarea from onBlur to onChange to prevent data loss - Add normalizeEndpoint to listFoundryModels for consistency - URL-encode segments in buildFoundryPortalUrl - Localize all hard-coded strings in FoundryAgentDetails and FoundryAgentPicker - Fix React.FocusEvent import for automatic JSX runtime compatibility - Update tests for IntlProvider and new flush behavior Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Not needed for this feature scope. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🤖 AI PR Validation ReportPR Review ResultsThank you for your submission! Here's detailed feedback on your PR title and body compliance:✅ PR Title
✅ Commit Type
|
| Section | Status | Recommendation |
|---|---|---|
| Title | ✅ | Keep current title (optionally append short note for changelog) |
| Commit Type | ✅ | No change |
| Risk Level | Change to High in PR body and add risk:high label; justify elevated risk |
|
| What & Why | ✅ | Add short rollback/mitigation paragraph |
| Impact of Change | ✅ | Add explicit note about save-time network calls, latency, and monitoring |
| Test Plan | ✅ | Add E2E/integration test or explanation why omitted; ensure a save-invocation test exists |
| Contributors | Add additional contributors if applicable | |
| Screenshots/Videos | ✅ | OK |
Summary and next steps
- PASS: The PR body follows the required template and the title is good. Unit tests claimed in the PR are present in the diff. Labels include
risk:mediumwhich matches the PR body — however, due to the breadth and nature of changes I advise increasing the PR Risk Level to High.
Actionable recommendations to update the PR before merge:
- Change Risk Level in the PR body to "High" and add the
risk:highlabel on the PR. In the PR body include a short justification (example):- "Risk: High — this change touches designer save flows, workflow serialization (deploymentId), network calls to Foundry data-plane on save, and introduces cross-cutting state for pending foundry updates. Potential user impact includes unexpected remote agent updates on save, and save latency increases."
- Add an explicit paragraph on rollback/mitigation and monitoring (where to look for failures, how the queued updates behave on failure). Example text to paste under What & Why:
- "Rollback & mitigation: pending Foundry updates are queued in the module-level store and only cleared on successful flush. flushPendingFoundryUpdates() will leave failed updates in the queue for retry; errors are currently logged and bubbled as an aggregated error in tests. Recommend adding telemetry, a visible retry path in the UI, and a short runbook for operational recovery."
- Add or document an E2E/integration test for the save flow that exercises the flush behavior (mock the Foundry data-plane). If not possible in this PR, document why (e.g., infra constraints) and create a backlog ticket to add it.
- Security & token handling: confirm the token fallback is intentional and safe — specifically the new code sets getFoundryAccessToken to
environment.foundryToken ?? environment.armToken ?? ''. Please confirm that using armToken as fallback is correct for Foundry data-plane calls (audience/scope differences). If not, explicitly restrict usage to foundryToken only and fail gracefully otherwise. - Feature gating / rollout: consider a feature flag (or remote config) to gate the new Foundry inline details and save integration for staged rollout, allowing immediate rollback if issues are observed in production.
- Add a brief note in the PR Test Plan about performance considerations and any manual performance checks you ran (e.g., save latency with 0/1/10 pending updates) so reviewers understand runtime impact.
- Add a short changelog entry or release-note mention describing the new Foundry Agent v2 support and the save-time batching behavior.
Please update the PR description to reflect the risk change + mitigation/monitoring steps and add/adjust labels. Once you update risk and add the short clarifications above (especially the token fallback confirmation and E2E / mitigation note), this looks ready from a PR-title/body and tests perspective.
Thank you for the thorough PR and for adding unit tests. If you'd like, I can open a suggested PR body diff with the exact text to add for the Risk Level justification, rollback plan, and Test Plan note.
Last updated: Wed, 04 Mar 2026 15:59:54 GMT
There was a problem hiding this comment.
Pull request overview
Adds Azure AI Foundry “Agents (v2)” support to the Logic Apps designer experience, enabling users to pick a Foundry agent and edit agent-managed settings (model + instructions) while keeping workflow serialization and Foundry-side configuration in sync.
Changes:
- Introduces a Foundry data-plane client (
foundryAgentService) plus token plumbing for Standalone to list/update Foundry v2 agents and list project model deployments. - Updates agent-loop manifest + parameters UI to support a Foundry agent picker and an inline details editor that syncs model/instructions back into workflow parameters.
- Adds “pending Foundry updates” buffering and flush-on-save behavior (Designer + Designer v2), plus unit tests and new designer-ui components.
Reviewed changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/generateArmToken.js | Generates an additional Foundry-scoped token file for Standalone local dev. |
| .gitignore | Ignores foundryToken.json alongside armToken.json. |
| apps/Standalone/src/environments/environment.ts | Loads foundryToken into the Standalone environment. |
| apps/Standalone/src/designer/app/AzureLogicAppsDesigner/laDesigner.tsx | Wires getFoundryAccessToken into BaseCognitiveServiceService; adjusts agent connection persistence. |
| apps/Standalone/src/designer/app/AzureLogicAppsDesigner/laDesignerV2.tsx | Same as above for the v2 designer host. |
| apps/Standalone/src/designer/app/AzureLogicAppsDesigner/DesignerCommandBar.tsx | Flushes pending Foundry updates before saving workflows. |
| apps/Standalone/src/designer/app/AzureLogicAppsDesigner/DesignerCommandBarV2.tsx | Flushes pending Foundry updates before saving (incl. autosave). |
| libs/logic-apps-shared/src/designer-client-services/lib/standard/foundryAgentService.ts | New Foundry data-plane API client (list agents/models, get/update agent). |
| libs/logic-apps-shared/src/designer-client-services/lib/standard/index.ts | Re-exports Foundry service APIs/types. |
| libs/logic-apps-shared/src/designer-client-services/lib/standard/manifest/agentloop.ts | Adds Foundry agent parameters (foundryAgentId/name/version) and adjusts visibility dependencies. |
| libs/logic-apps-shared/src/designer-client-services/lib/standard/connection.ts | Carries agent model type through local connection conversion. |
| libs/logic-apps-shared/src/designer-client-services/lib/cognitiveService.ts | Extends cognitive service interface with optional Foundry token getter. |
| libs/logic-apps-shared/src/designer-client-services/lib/base/cognitiveService.ts | Adds optional getFoundryAccessToken on the base implementation. |
| libs/designer/src/lib/ui/panel/connectionsPanel/createConnection/custom/useCognitiveService.ts | Adds hooks to derive Foundry project endpoint/resourceId and query agents/models. |
| libs/designer-v2/src/lib/ui/panel/connectionsPanel/createConnection/custom/useCognitiveService.ts | Same as above for designer-v2. |
| libs/designer/src/lib/ui/panel/nodeDetailsPanel/tabs/parametersTab/helpers.ts | Adds helper to detect foundryAgentId parameter. |
| libs/designer-v2/src/lib/ui/panel/nodeDetailsPanel/tabs/parametersTab/helpers.ts | Same helper for designer-v2. |
| libs/designer/src/lib/ui/panel/nodeDetailsPanel/tabs/parametersTab/index.tsx | Adds Foundry agent selection handling, inline details panel, and workflow-parameter syncing. |
| libs/designer-v2/src/lib/ui/panel/nodeDetailsPanel/tabs/parametersTab/index.tsx | Same Foundry UI logic for designer-v2. |
| libs/designer/src/lib/common/utilities/Utils.ts | Adds AgentUtils.isFoundryAgentIdParameter. |
| libs/designer-v2/src/lib/common/utilities/Utils.ts | Same utility addition for designer-v2. |
| libs/designer/src/lib/core/actions/bjsworkflow/foundryUpdates.ts | New pending-update buffer + flush mechanism for Foundry agent updates. |
| libs/designer-v2/src/lib/core/actions/bjsworkflow/foundryUpdates.ts | Same pending-update logic for designer-v2. |
| libs/designer/src/lib/core/index.ts | Exports Foundry pending-update APIs. |
| libs/designer-v2/src/lib/core/index.ts | Same exports for designer-v2. |
| libs/designer/src/lib/core/actions/bjsworkflow/connections.ts | Improves mapping of displayed agent model type → manifest value; adds Foundry fallback detection. |
| libs/designer-v2/src/lib/core/actions/bjsworkflow/connections.ts | Same mapping updates for designer-v2. |
| libs/designer-ui/src/lib/agentinstruction/index.tsx | Adds hideSystemInstructions support to the agent instruction editor. |
| libs/designer-ui/src/lib/settings/settingsection/settingTokenField.tsx | Allows hiding the label for agent-instruction editor and forwards hideSystemInstructions. |
| libs/designer-ui/src/lib/foundryagentdetails/index.tsx | New inline UI for viewing/editing Foundry agent details (model/instructions/tools + portal link). |
| libs/designer-ui/src/lib/foundryagentdetails/styles.ts | Styles for Foundry agent details panel. |
| libs/designer-ui/src/lib/foundryagentdetails/test/foundryAgentDetails.spec.tsx | Snapshot-ish rendering tests for Foundry agent details. |
| libs/designer-ui/src/lib/foundryagentpicker/index.tsx | New (exported) Foundry agent picker component. |
| libs/designer-ui/src/lib/foundryagentpicker/styles.ts | Styles for the Foundry agent picker. |
| libs/designer-ui/src/lib/index.ts | Exports the new Foundry UI components. |
| libs/logic-apps-shared/src/designer-client-services/lib/standard/tests/foundryAgentService.spec.ts | Unit tests for Foundry API client helper functions. |
| libs/designer/src/lib/core/actions/bjsworkflow/test/foundryUpdates.spec.ts | Unit tests for the pending-update flush mechanism. |
| Localize/lang/strings.json | Adds localized strings for Foundry picker/details UI. |
apps/Standalone/src/designer/app/AzureLogicAppsDesigner/laDesignerV2.tsx
Show resolved
Hide resolved
📊 Coverage CheckThe following changed files need attention:
Please add tests for the uncovered files before merging. |
…cross panel close - Apply filterFoundryManagedSettings to all settings (not just after agent picker) so AI model and Instructions for agent are hidden when Foundry manages them - Move Agent picker to render first, with Foundry details immediately below - Add getPendingFoundryUpdate getter to restore pending model/instructions from the module-level Map when the panel remounts - Add selectedInstructions prop to FoundryAgentDetails so restored pending instructions display in the textarea on reopen Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…odel match, and fallback picker display - Add useEffect to clear localInstructions when agent.id changes so switching agents never shows the previous agent's edited instructions - Guard models.find startsWith check behind non-empty effectiveModel to prevent false matches when agent.model is empty string - Use selectedAgent.name ?? selectedAgent.id as Combobox display value so agents with null/empty names still render their selection Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The fallback path (Foundry connection active, no agent selected yet) was filtering out AI model and instructions but not reordering the Agent picker to the top. Now both paths consistently show the Agent picker first. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add coverage for listFoundryAgents, listAllFoundryAgents, getFoundryAgent, endpoint normalization, auto-pagination, agent field normalization with missing versions, URL encoding, partial update payloads, error fallbacks, and deployment name filtering. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cover setPendingFoundryUpdate, clearPendingFoundryUpdate, getPendingFoundryUpdate, hasPendingFoundryUpdates, and flushPendingFoundryUpdates including multi-node tracking, overwrite behavior, partial failure retention, aggregated error messages, non-Error rejections, and token unavailability. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…fect Replace suppressed exhaustive-deps with a useRef to track previous agent ID. The dependency array is now complete and the dispatch only fires when selectedFoundryAgent.id actually changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Commit Type
Risk Level
What & Why
Adds Foundry Agent v2 support with an inline details panel in the designer parameters tab. When a Foundry connection is selected and an agent is picked, users now see:
Changes to model and instructions are batched and saved back to Foundry when the workflow is saved via
flushPendingFoundryUpdates(). Pending edits persist across panel close/reopen via a module-level store.Key changes:
FoundryAgentPickerandFoundryAgentDetailsindesigner-uifoundryAgentService.ts—listFoundryAgents(),updateFoundryAgent(),listFoundryModels()(data-plane API)flushPendingFoundryUpdates()wired into Standalone v1/v2 save flowsdeploymentIdincluded in serialized workflow for FoundryAgentService connectionsURLparser; regex uses non-greedy quantifierslibs/designerandlibs/designer-v2Impact of Change
FoundryAgentDetailscomponent,foundryUpdatesmodule, and hooks (useFoundryAgentsForNode,useFoundryModelsForNode) available for reuseTest Plan
New tests (25 total):
foundryAgentService.spec.ts(11 tests) — endpoint builder, update API payload envelope, model listing, error handlingfoundryUpdates.spec.ts(8 tests) — set/clear/has/flush pending updates storefoundryAgentDetails.spec.tsx(6 tests) — component rendering, portal link, tools summaryManual test scenarios:
Contributors
@ccastrotrejo
Screenshots/Videos