Convert sample 09 (declarative customer-support) to a code-based routing agent#791
Closed
Yimin-Jin wants to merge 1 commit into
Closed
Conversation
…g agent The declarative workflow.yaml routes with Power Fx (=...) conditions, which require the powerfx package plus the .NET runtime. Neither is available in the code/zip hosted runtime (powerfx is not installed for Python >= 3.14, and the managed runtime has no .NET), so the sample fails at runtime with 'PowerFx is not available' unless deployed as a container. Replace the declarative workflow with an equivalent CustomerSupportAgent(BaseAgent) that performs the same triage routing in plain Python, drop the agent-framework-declarative dependency, and simplify the Dockerfile (no .NET). The sample now runs under code deployment with no PowerFx/.NET dependency.
Contributor
|
👋 Thanks for your interest in contributing, @Yimin-Jin! This repository does not accept pull requests directly. If you'd like to report a bug, suggest an improvement, or propose a new sample, please open an issue instead. If you are a Microsoft-internal contributor, please submit your PR through foundry-samples-pr instead. See CONTRIBUTING.md for more details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Sample 09's declarative
workflow.yamlroutes with Power Fx conditions (=Local.Triage.NeedsClarification,=Local.Triage.Category = "Technical", …). Evaluating those requires thepowerfxpackage and the .NET runtime.Neither is available in the code / zip hosted runtime:
agent-framework-declarativepinspowerfx …; python_version < "3.14", so on thepython_3_14runtime thepowerfxpackage isn't installed at all (pythonnet has no 3.14 support yet).So when deployed as code the sample fails at runtime with:
(It only worked via container deployment — which is why the README said it "requires a Docker based deployment".)
Change
Replace the declarative workflow with an equivalent
CustomerSupportAgent(BaseAgent)that performs the same triage routing in plain Python — same three agents (TriageAgent/TechSupportAgent/BillingAgent), same structuredTriageResponse, same handoff messages and branching theConditionGroupexpressed. No Power Fx / .NET required, so the sample now runs under code deployment.main.pyWorkflowFactory+workflow.yamlloading; addCustomerSupportAgentthat runs triage and routes in Python. Instructions andTriageResponseunchanged.workflow.yamlmain.py).requirements.txtagent-framework-declarative.Dockerfilepython:3.12+ .NET install →python:3.14-slim(no .NET needed).README.mdagent.manifest.yamlVerification
python -m py_compile main.pypasses on Python 3.14.agent-framework-declarative/powerfxno longer pulled in).ResponsesHostServer(CustomerSupportAgent(...))constructs and the agent satisfiesSupportsAgentRun.Open questions for reviewers
09-declarative-customer-supportand the agent / manifestnamestill containsdeclarative. Left unchanged to avoid breaking theazd ai agent init -m …/agent.manifest.yamlURL and the deployed agent identity — happy to rename if preferred.