Skip to content

Upgrade to agent_framework 1.0.0 — HandoffBuilder → WorkflowBuilder#1

Draft
JasonHaley wants to merge 1 commit into
mainfrom
jasonhaley/agent-framework-upgrade
Draft

Upgrade to agent_framework 1.0.0 — HandoffBuilder → WorkflowBuilder#1
JasonHaley wants to merge 1 commit into
mainfrom
jasonhaley/agent-framework-upgrade

Conversation

@JasonHaley
Copy link
Copy Markdown
Owner

Summary

Refactor the application from the HandoffBuilder orchestration pattern (event-streaming with pending requests) to the new WorkflowBuilder pattern (structured output with switch-case routing) to upgrade to agent_framework 1.0.0.

Key Changes Needed

Architecture Change

  • HandoffBuilder → WorkflowBuilder: Replace event-streaming handoff with stateless switch-case routing using structured output from a classifier agent
  • Each workflow.run(question) is independent and stateless — no more pending request/response loops

Classifier Agent Rewrite

  • Add Pydantic models (ClassifyResult, ClassifiedQuery) for structured output
  • Add @executor function (extract_category) to parse classifier JSON and route downstream
  • Add QueryBridge executor class to convert ClassifiedQuery → plain string for specialist agents
  • Use response_format to enforce structured JSON output

API Renames (all 9 specialist agents)

Old (current) New (1.0.0)
ChatAgent Agent
@ai_function @tool
agent_framework.azure.AzureOpenAIChatClient agent_framework.openai.OpenAIChatClient
OpenAIChatOptions (removed)

Auth Model Change

  • Switch from API key-based OpenAI auth to DefaultAzureCredential with token provider
  • Remove openai_api_key from config
  • Use azure_ad_token_provider in AzureOpenAI client

Workflow Handlers

  • Replace drain_events / handle_workflow_events (event-streaming) with simple handle_workflow_result(result: WorkflowRunResult)

main.py Rewrite

  • Build workflow with edges: classifier → extract_category → [switch_case] → bridges → specialist agents
  • Include all 9 agent categories (yes_no, semantic_search, count, difference, intersection, multi_hop, comparative, ordinal, superlative)
  • Simplify test loop — no more pending request handling

Agents Retained

  • ordinal_agent and superlative_agent are unique to this repo and will be upgraded to the new API patterns (not deleted)

Reference

Target codebase: https://github.com/AgentFrameworkDev/agent-framework-dev-day/tree/main/labs/python/lab3-agentic-rag/solution

Files to Modify

  • src/config/azure_config.py
  • src/services/search_service.py
  • src/agents/classifier_agent.py (major rewrite)
  • src/agents/semantic_search_agent.py
  • src/agents/yes_no_agent.py
  • src/agents/count_agent.py
  • src/agents/difference_agent.py
  • src/agents/intersection_agent.py
  • src/agents/multi_hop_agent.py
  • src/agents/comparative_agent.py
  • src/agents/ordinal_agent.py
  • src/agents/superlative_agent.py
  • src/agents/agent_factory.py
  • src/agents/__init__.py
  • src/workflows/workflow_handlers.py
  • src/workflows/__init__.py
  • src/main.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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