Skip to content

Convert sample 09 (declarative customer-support) to a code-based routing agent#791

Closed
Yimin-Jin wants to merge 1 commit into
microsoft-foundry:mainfrom
Yimin-Jin:convert-09-customer-support-to-code
Closed

Convert sample 09 (declarative customer-support) to a code-based routing agent#791
Yimin-Jin wants to merge 1 commit into
microsoft-foundry:mainfrom
Yimin-Jin:convert-09-customer-support-to-code

Conversation

@Yimin-Jin

Copy link
Copy Markdown

What & why

Sample 09's declarative workflow.yaml routes with Power Fx conditions (=Local.Triage.NeedsClarification, =Local.Triage.Category = "Technical", …). Evaluating those requires the powerfx package and the .NET runtime.

Neither is available in the code / zip hosted runtime:

  • agent-framework-declarative pins powerfx …; python_version < "3.14", so on the python_3_14 runtime the powerfx package isn't installed at all (pythonnet has no 3.14 support yet).
  • the managed code runtime has no .NET.

So when deployed as code the sample fails at runtime with:

RuntimeError: PowerFx is not available (dotnet runtime not installed).
Expression '=Local.Triage.NeedsClarification' cannot be evaluated.

(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 structured TriageResponse, same handoff messages and branching the ConditionGroup expressed. No Power Fx / .NET required, so the sample now runs under code deployment.

File Change
main.py Drop WorkflowFactory + workflow.yaml loading; add CustomerSupportAgent that runs triage and routes in Python. Instructions and TriageResponse unchanged.
workflow.yaml Deleted (logic moved into main.py).
requirements.txt Drop agent-framework-declarative.
Dockerfile python:3.12 + .NET install → python:3.14-slim (no .NET needed).
README.md Describe the code-based router; drop the "requires Docker deployment" note.
agent.manifest.yaml Reword description / tags (Declarative Workflow → Multi-agent Routing).

Verification

  • python -m py_compile main.py passes on Python 3.14.
  • Dependencies install cleanly in a fresh 3.14 venv (agent-framework-declarative / powerfx no longer pulled in).
  • ResponsesHostServer(CustomerSupportAgent(...)) constructs and the agent satisfies SupportsAgentRun.

Open questions for reviewers

  • The directory is still named 09-declarative-customer-support and the agent / manifest name still contains declarative. Left unchanged to avoid breaking the azd ai agent init -m …/agent.manifest.yaml URL and the deployed agent identity — happy to rename if preferred.
  • This converts the sample away from being a declarative sample. If the intent is to keep a declarative example, an alternative is to add this as a new code-based sample instead.

Draft: opening for review of the approach before finalizing.

…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.
@github-actions

Copy link
Copy Markdown
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.

@github-actions github-actions Bot closed this Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant