Skip to content

Migrate Agent Framework demos to Azure AI Foundry SDK#85

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/migrate-codebase-to-foundry
Draft

Migrate Agent Framework demos to Azure AI Foundry SDK#85
Copilot wants to merge 4 commits intomasterfrom
copilot/migrate-codebase-to-foundry

Conversation

Copy link
Contributor

Copilot AI commented Nov 24, 2025

Migrates demos/03-agent-framework/02-basics/agentfw_basics-py to direct Azure AI Foundry SDK usage, eliminating the agent-framework abstraction layer for production-ready patterns.

Core Changes

Dependencies

  • Removed: agent-framework, agent-framework-azure-ai
  • Added: azure-ai-projects, azure-ai-agents, azure-ai-inference

12 Demo Files Migrated

  • Agent lifecycle: create_agent.py, use_existing_agent.py, agents-delete-all.py
  • Communication: openai_chat.py, streaming.py, function_calling.py
  • State management: threading.py, chat_history.py, long_term_memory.py
  • Advanced: structured_output.py, multimodal.py, observability.py

Key Pattern Changes

Before (Agent Framework):

from agent_framework import ChatAgent
from agent_framework.azure import AzureAIAgentClient

agent = ChatAgent(chat_client=AzureAIAgentClient(...))
async for chunk in agent.run_stream(user_input):
    print(chunk.text, end="")

After (Azure AI Foundry SDK):

from azure.ai.agents.aio import AgentsClient

async with AgentsClient(endpoint=endpoint, credential=credential) as client:
    agent = await client.create_agent(model=model, instructions="...")
    thread = await client.create_thread()
    await client.create_message(thread_id=thread.id, role="user", content=user_input)
    
    async with await client.create_run_stream(thread_id=thread.id, assistant_id=agent.id) as stream:
        async for event in stream:
            if event.event == "thread.message.delta":
                print(event.data.delta.content[0].text.value, end="")

Security Hardening

Replaced unsafe eval() usage in function calling demo:

  • Expression evaluation: AST-based safe parser with operator whitelist
  • JSON parsing: json.loads() instead of eval()

Documentation

  • readme.md: Setup, API differences, migration guide, architecture diagram
  • MIGRATION.md: Detailed technical changes, trade-off analysis, side-by-side comparisons

Output: demos/03-agent-framework/02-basics/agentfw_basics-py-foundry/

Original prompt

This section details on the original issue you should resolve

<issue_title>Migration to Microsoft Foundry</issue_title>
<issue_description>I want you to create and execute a new migration plan to migrate the existing codebase to Microsoft Foundry for the demos in this folder: demos\03-agent-framework\02-basics\agentfw_basics-py

The migration plan should include the following steps:

  • Analyze the existing codebase to identify dependencies and components that need to be migrated.
  • Set up a new Microsoft Foundry environment.
  • Migrate the codebase to the new environment, ensuring compatibility with Microsoft Foundry.
  • Test the migrated codebase to ensure all functionalities work as expected.

The output should be placed in a new folder named demos\03-agent-framework\02-basics\agentfw_basics-py-foundry</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits November 24, 2025 12:37
Co-authored-by: alexander-kastil <16348023+alexander-kastil@users.noreply.github.com>
Co-authored-by: alexander-kastil <16348023+alexander-kastil@users.noreply.github.com>
Co-authored-by: alexander-kastil <16348023+alexander-kastil@users.noreply.github.com>
Copilot AI changed the title [WIP] Create migration plan for Microsoft Foundry Migrate Agent Framework demos to Azure AI Foundry SDK Nov 24, 2025
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.

Migration to Microsoft Foundry

2 participants