Foundry: Create Python Agents Quickly
Microsoft Copilot Studio
22. Dez 2025 21:42

Foundry: Create Python Agents Quickly

von HubSite 365 über Andrew Hess - MySPQuestions

Currently I am sharing my knowledge with the Power Platform, with PowerApps and Power Automate. With over 8 years of experience, I have been learning SharePoint and SharePoint Online

Expert guide to build an AI agent with Microsoft Foundry, link MCP KBs to Azure AI Search and develop in Python

Key insights

  • Microsoft Foundry overview
    Foundry is a unified platform for building, testing, hosting, and governing AI agents.
    The Foundry Agent Service provides a managed runtime, built-in memory, tools, and deployment channels so teams move from prototype to production without managing containers.
  • Key advantages
    Use Hosted agents to remove infrastructure overhead and speed production.
    Foundry supports Model Router and BYO gateways for model interoperability and enterprise governance, plus built-in features like persistent memory and multi-agent workflows.
  • Connecting knowledge
    The demo shows connecting MCP knowledge bases to Foundry so agents can retrieve enterprise content.
    You can control approval and retrieval settings when you link knowledge sources for safe, auditable answers.
  • Python setup and flow
    Prerequisites include an Azure Foundry project, credentials (for example DefaultAzureCredential), and the Foundry SDK or REST endpoint.
    Create a project client, define instructions and tools, then call create_agent (or the REST POST) to register the agent.
  • Tools and code execution
    Foundry supports built-in tools like the code_interpreter and lets you register custom Python functions as callable tools.
    Annotate parameters and pass the functions in the agent’s tools list so the runtime can invoke them during conversations.
  • Deploy, update, and monitor
    Test agents locally, then publish to get a hosted endpoint and observability metrics.
    Update prompts and push a new version with create_agent_version; use the runtime’s observability to monitor behavior and approvals when you scale to Microsoft 365 or other channels.

Introduction to the Video

In a recent YouTube tutorial, Andrew Hess - MySPQuestions walks viewers through creating an AI agent with the new Microsoft Foundry using Python. The video frames the process as practical and production-ready, and it includes a step-by-step demonstration of creating a project, connecting a knowledge base, defining prompts, and updating agent versions. Moreover, Andrew organizes the content with clear chapters so viewers can jump to topics like Foundry IQ, recipes, and deployment. Consequently, the piece serves both developers who want a quick hands-on walkthrough and decision makers who need to understand the platform's capabilities.


What the Video Demonstrates

First, the author shows how to create a new Foundry project and connect it to a knowledge store using MCP (Microsoft Connector Platform) and Azure AI Search. Then he defines a prompt-based agent and demonstrates how to switch to Python code to implement tools and update agent versions. The video highlights managing instructions, registering tools like code interpreters and connectors, and testing the agent locally before publishing. Overall, the demonstration emphasizes the platform’s managed runtime and built-in observability as ways to simplify moving from prototype to production.


Step-by-Step: Building an Agent with Python

Andrew starts by showing prerequisites: an Azure AI Foundry project, identity credentials, and either the Foundry SDK or REST endpoints. Next, he instantiates the project client and defines agent instructions, tools, and the model selection, then calls the API to create an agent or agent version. In addition, the video explains how to annotate Python functions as tools so the runtime can call them during conversations, which improves modularity and testability. Finally, he deploys a hosted agent and inspects logs and telemetry to validate behavior and performance.


Tradeoffs: Managed Hosting Versus Control

The video makes a clear case for Hosted Agents because they reduce infrastructure overhead and speed productionization, while also providing first-class tools for persistence and multi-agent workflows. However, using managed hosting implies tradeoffs: teams gain convenience but cede some control over runtime internals and fine-grained infrastructure tuning. Moreover, integrating many third-party models or custom backends can introduce complexity in orchestration and governance, which requires careful configuration of model routers and the BYO Model Gateway. Therefore, organizations must weigh faster delivery against operational visibility and vendor dependency.


Challenges Around Governance and Approvals

Andrew calls out features like approval flows and mentions the option labeled "MCP Require Approval Never" during the demonstration, which illustrates the tension between rapid iteration and enterprise governance. Consequently, teams must design approval and audit workflows that meet compliance without slowing development to a crawl. Furthermore, connecting knowledge bases and production data increases the need for permission models, data lineage, and monitoring to avoid exposing sensitive information. In short, the platform supports governance features, but implementing them correctly takes policy work and cross-team coordination.


Practical Considerations for Teams

For practitioners, Andrew’s demo suggests a practical workflow: prototype locally with simple instructions and tools, move to a staged hosted agent, and then update agent versions as you mature the solution. Moreover, the video recommends documenting tools and instructions and using controlled deployments to test model and tool behavior under real loads. Teams should also measure cost, latency, and model selection tradeoffs since different models and tool invocations change performance and price. Consequently, a small pilot with clear rollback plans helps mitigate risks before broad rollout.


Conclusion and Next Steps

In conclusion, Andrew Hess - MySPQuestions presents a concise and actionable walkthrough of building an agent with the refreshed Foundry platform using Python. He balances practical code examples with platform-level considerations like hosted runtimes, persistent memory, and connectors, while also calling attention to governance and approval tradeoffs. Therefore, developers can use the video as a hands-on reference, and leaders can use it to evaluate whether Foundry aligns with their operational and compliance needs. Ultimately, the video offers a useful starting point for teams planning to prototype agents and then scale them into production.


Microsoft Copilot Studio - Foundry: Create Python Agents Quickly

Keywords

new foundry agent, foundry ai agent, create agent with python, build agent in foundry, foundry python tutorial, simple foundry agent guide, ai agent python tutorial, foundry agent development