Wednesday, 16 September 2026

Create a model agnostic Agent using Microsoft Foundry and Microsoft Agent Framework

Microsoft Agent Framework is the evolution of Microsoft's earlier AI orchestration work, bringing together ideas from projects such as Semantic Kernel and AutoGen into a unified framework for building agentic applications. It gives us a common AIAgent abstraction while letting us choose and switch which AI model powers the agent.

In this post, we are going to build a model-agnostic agent in .NET using Microsoft Agent Framework and Microsoft Foundry. We’ll run the same agent definition against two different model providers, OpenAI and DeepSeek, without introducing provider-specific code into our agent.

At a high level, we’ll:

  • Create a .NET console application.
  • Connect Microsoft Agent Framework to a Microsoft Foundry project.
  • Deploy models from two different providers: OpenAI and DeepSeek.
  • Run the same agent definition against both models.
  • Use Foundry and Agent Framework to keep provider-specific plumbing away from the application.

Prerequisites

You will need:

  • .NET 10 SDK. Agent Framework supports .NET 8 or later; I am using .NET 10 for this example.
  • An Azure subscription.
  • A Microsoft Foundry project.
  • An OpenAI model deployment. We’ll use gpt-5.6-terra as the example.
  • A DeepSeek model deployment. We’ll use DeepSeek-V3.2 as the example.
  • An identity with permission to use the Foundry project and its model deployments.

1) Create the .NET project

Create a new console application:

dotnet new console -n ModelAgnosticAgent --framework net10.0
cd ModelAgnosticAgent

2) Install Microsoft Agent Framework packages

Install the Foundry integration and Azure authentication packages:

dotnet add package Microsoft.Agents.AI.Foundry --prerelease
dotnet add package Azure.AI.Projects --prerelease
dotnet add package Azure.Identity

3) Deploy two models from different providers

This is the key part of the example.

We are deliberately not building our application around an OpenAI-specific SDK or model client.

Instead, we’ll deploy two models in Microsoft Foundry:

  • OpenAI: gpt-5.6-terra
  • DeepSeek: DeepSeek-V3.2

These come from completely different model providers, but our application will access both through the same Foundry project and use the same Agent Framework programming model.

Our application knows how to work with an AIAgent. Foundry handles access to the underlying model deployments.

If we later decide that another model gives us better quality, latency, cost, or capabilities, we don't want that decision to require redesigning the application.

Deploy the OpenAI model

Use:

Microsoft Foundry > Discover > Models > gpt-5.6-terra > Deploy > Default settings

Give the deployment a recognizable name, for example:

gpt-5-6-terra

Deploy the DeepSeek model

Now deploy the second model:

Microsoft Foundry > Discover > Models > DeepSeek-V3.2 > Deploy > Default settings

For example:

deepseek-v3-2

We now have models from two different providers available through the same Foundry project.

4) Configure the Foundry connection

Open your Foundry project and copy its project endpoint.

Microsoft Foundry > <your project> > Overview

It should look similar to:

https://<resource>.services.ai.azure.com/api/projects/<project>

One Foundry project endpoint gives our application access to both model deployments. We are not configuring a different endpoint for each model.

Switching the model therefore becomes a configuration decision rather than an architecture decision.

5) Authenticate to Microsoft Foundry

The sample uses DefaultAzureCredential, so it does not need an API key in the source code. For local development, the easiest option is to sign in with the Azure CLI:

az login

Make sure the signed-in identity has access to the Foundry project and its model deployments. The Azure AI User role is typically enough to run this sample. Depending on your organization, an administrator may need to assign this role for you.

The sample excludes managed identity because it is designed to run locally. For an application hosted in Azure, you can enable managed identity and assign the same required access to that identity.

6) Minimal working example

Here is the minimal console application that consumes our models and provides us with a common abstraction:

Change these values:

  • YOUR_FOUNDRY_PROJECT_ENDPOINT: the project endpoint copied in the previous step.
  • YOUR_OPENAI_MODEL_DEPLOYMENT_NAME: the name of your OpenAI deployment.
  • YOUR_DEEPSEEK_MODEL_DEPLOYMENT_NAME: the name of your DeepSeek deployment.

These must be the deployment names from your Foundry project, not necessarily the underlying model names shown in the model catalog.

7) How the model abstraction works

The important part is the CreateAgent function:

AIAgent CreateAgent(string modelDeployment) =>
    projectClient.AsAIAgent(
        model: modelDeployment,
        instructions: instructions,
        name: "M365Assistant");

It receives a deployment name but returns the same AIAgent abstraction in both cases. The instructions, prompt, and code used to run the agent remain unchanged. We only select a different model deployment.

Both agents are then invoked through the same RunAsync method:

Console.WriteLine(await openAiAgent.RunAsync(prompt));
Console.WriteLine(await deepSeekAgent.RunAsync(prompt));

There is no OpenAI-specific client for one call and a DeepSeek-specific client for the other. That is the value of keeping the application centered on the Agent Framework abstraction.

8) Run the application

Run the console application:

dotnet run

The application sends the same prompt to both agents and prints each response separately. The exact wording will vary because the responses are generated independently by the two models.

We now have the same agent instructions and prompt running against models from two different providers, without changing the application’s programming model.

What “model agnostic” means here

Model agnostic does not mean that every model behaves identically. It means that the application depends on a common agent abstraction instead of a provider-specific client.

The following parts remain the same:

  • The Foundry project endpoint.
  • The AIAgent abstraction.
  • The agent instructions and user prompt.
  • The code used to invoke the agent.

Some model characteristics can still differ:

  • Response quality and style.
  • Latency and cost.
  • Context window and token limits.
  • Tool calling, structured output, and other model capabilities.

This abstraction makes it much easier to compare models or switch providers, but the selected model should still be tested against the capabilities your application requires.

Wrapping up

In this post, we created one agent definition and ran it against OpenAI and DeepSeek model deployments through the same Microsoft Foundry project. The application works with AIAgent, while the deployment name determines which model powers it.

This gives us a clean boundary for experimenting with different models. We can compare quality, latency, cost, and capabilities without redesigning the application each time we change providers.

Hope this helps!

Sunday, 1 March 2026

Build a Custom UI for a Copilot Studio Agent using the Microsoft 365 Agents SDK

Copilot Studio gives you a great “out-of-the-box” chat experience in Teams and Microsoft 365 Copilot. But sometimes you need your own UI: your branding, your layout, your telemetry, and your app’s context. So in this post, let’s wire a Copilot Studio agent into a .NET console “custom UI” using the Microsoft 365 Agents SDK client library. This will help you get started when you want to surface Copilot Studio Agents in your own custom UIs.

Scope note: This is for calling a Copilot Studio agent from your own app UI (not the iframe embed).


On a high level, we’ll:

  • Publish a Copilot Studio agent and copy its Microsoft 365 Agents SDK connection string.

  • Create an Entra app registration with the CopilotStudio.Copilots.Invoke delegated permission.

  • Use MSAL to sign in a user and get a token for the Power Platform API audience.

  • Call the agent from a lightweight console “chat UI” using Microsoft.Agents.CopilotStudio.Client.


Prereqs

  • A published Copilot Studio agent (and access to its settings).

  • .NET SDK installed (any modern LTS is fine).

  • Entra ID permission to create an app registration


1) Publish Your Agent And Copy The Agents SDK Connection String


In Copilot Studio:

  • Open your agent

  • Go to ChannelsWeb app (or Native app)

  • Under Microsoft 365 Agents SDK, copy the connection string.


Note: If your agent uses “Authenticate with Microsoft” or “Authenticate manually”, you’ll see the connection string option (and not the iframe embed code). 

2) Create An Entra App Registration For User Interactive Sign-In

In Azure portal:

  • Microsoft Entra IDApp registrationsNew registration

  • Platform: Public client/native (mobile & desktop)

  • Redirect URI: http://localhost (HTTP, not HTTPS)

Then add the delegated permission:

  • API permissionsAdd a permission

  • APIs my organization uses → search Power Platform API

  • Delegated permissionsCopilotStudioCopilotStudio.Copilots.Invoke


3) Create The “Custom UI” (A Console Chat)

This is the bare minimum idea:

  • sign in the user (MSAL)

  • get a token scoped to the Power Platform API audience (the SDK computes this for you)

  • start a conversation

  • send messages and stream responses back as activities 

Change these values:

  • directConnectUrl = copied from Copilot Studio channel page (Microsoft 365 Agents SDK section).

  • tenantId, clientId = from your Entra app registration.

Minimal Working Example

Create and run:


Troubleshooting

  • 401/403: confirm delegated permission CopilotStudio.Copilots.Invoke is granted (and admin consent if your tenant requires it). 

  • Redirect URI mismatch: make sure the app registration has http://localhost for public client. (The sample uses localhost.) 

  • No response text: Copilot Studio responses arrive as a stream of activities—log the full activity payload if you suspect you’re filtering out the wrong activity types.

  • Power Platform API missing in permissions picker: follow the sample guidance and tenant configuration notes in the repo.

Notes

  • The console app is a clean “backend harness” you can keep as-is, then wrap with an HTTP API for your React front-end to call.

  • If you need quick embed-only experiences, the iframe approach is simpler, but it’s not the same as a true custom UI.

Wrapping up

This pattern keeps your agent authored in Copilot Studio, while your product team owns the end-user experience in a custom UI. The key pieces are: connection info from Copilot Studio, Entra delegated permission, MSAL sign-in, then stream activities through the SDK client.

Hope this helps!

Sunday, 18 January 2026

Get reasoning summaries from Azure OpenAI Reasoning Models using the Responses API (.NET)

Reasoning models are awesome for multi-step problems, but in real apps you also want some visibility into how the model got there—without exposing full chain-of-thought. In Azure OpenAI, the right pattern is to request a reasoning summary via the Responses API and log/print it next to the final answer.


On a high level, we’ll:

  • Deploy or reuse an Azure OpenAI reasoning model deployment

  • Call Azure OpenAI using the v1 base URL (/openai/v1/)

  • Request a reasoning summary with a chosen reasoning effort

  • Print reasoning summary + final answer in a minimal .NET console app

Prereqs

  • Azure OpenAI resource + a deployed reasoning-capable model (e.g. GPT-5 reasoning variants)

  • .NET 8+

  • Latest OpenAI .NET SDK (OpenAI) that includes ResponsesClient and CreateResponseOptions

1) Create (Or Confirm) Your Reasoning Model Deployment

In Azure AI Foundry:

  • Click path: Azure AI Foundry portal → OpenAI → Deployments → + Create deployment

  • Pick a reasoning model and give it a deployment name (example: gpt-5-mini)

  • Keep that deployment name handy (you’ll pass it to the client)


2) Create a Console App + Install the SDK


3) Call the Responses API and Print the Reasoning Summary

This sample is wired to Azure OpenAI’s v1 endpoint and Responses API.

Change these values:

  • AZURE_OPENAI_ENDPOINT (your Azure OpenAI resource endpoint)

  • AZURE_OPENAI_API_KEY

  • AZURE_OPENAI_DEPLOYMENT (your deployment name, not the base model name)

Why “summary” (not full reasoning): Azure OpenAI’s model behavior is centered on reasoning summaries rather than returning raw reasoning_content.

4) Minimal working example

Expected output (example):

 

Troubleshooting

  • 404 Not Found: your deployment name is wrong, or the deployment/region doesn’t support Responses API. Start by verifying deployment name in the portal.

  • 400 Bad Request: most often you’re not using the v1 base URL (.../openai/v1/).

  • No reasoning summary returned: your deployment might not be a reasoning model, or the model chose not to emit a summary. Confirm model capability and try ReasoningSummaryVerbosity = Concise/Detailed if available in your SDK/version.

  • Compile errors for Responses types: upgrade the OpenAI .NET SDK class names have changed (e.g., CreateResponseOptions).

  • 401 Unauthorized: API key doesn’t match the resource or is missing.

Notes

  • Reasoning summaries are the “sweet spot”: better debugging/telemetry without leaking full internal chain-of-thought. Azure’s docs explicitly separate Azure OpenAI from providers that emit reasoning_content.

  • If you’re building Copilot/agent experiences, this summary is exactly what you’d stash in app logs or a trace store for support cases. Keep the final answer user-facing.

Wrapping up

If you want a clean, production-friendly way to understand what a reasoning model did without capturing the full chain-of-thought, use the Responses API and print/log the reasoning summary next to the final answer. 

Hope this helps!

Thursday, 18 December 2025

Custom AI Agents: Use the Copilot Retrieval API for grounding on SharePoint Content

If you’re building a custom AI agent (Copilot Studio, Agents SDK, or your own app) and you want permission-trimmed content from SharePoint without managing your own vector store, then the Microsoft 365 Copilot Retrieval API is a great solution. 

It’s part of the broader Copilot APIs surface in Microsoft Graph, designed to reuse the same “in-tenant” grounding behavior that Microsoft 365 Copilot uses. To know more about the Copilot APIs have a look at the Microsoft docs: Microsoft Learn

So in this post, lets deep dive into the Copilot Retrieval API:


On a high level, we’ll:

  • Decide when to use Retrieval API vs “normal” Graph CRUD/search

  • Configure the minimum delegated permissions for SharePoint grounding

  • Call the Retrieval endpoint with dataSource=sharePoint

  • Scope results to specific sites using KQL filterExpression

  • Use the returned extracts + URLs as grounding context for your LLM

Prereqs

  • A Microsoft 365 Copilot license for each user calling Copilot APIs (this is separate from standard Graph CRUD usage).

  • Your app uses delegated auth (application permissions aren’t supported for this API).

  • Microsoft Entra app registration with delegated Graph permissions: Files.Read.All + Sites.Read.All (required together for SharePoint/OneDrive retrieval).

  • Familiarity with the Copilot APIs model (Copilot APIs are REST under Microsoft Graph and use standard Graph auth).

1) Pick The Right Tool: Retrieval vs Graph

Use Microsoft Graph CRUD when you need to read/update SharePoint data (lists, drives, items, etc.). 

Use the Copilot Retrieval API when you need ranked text content (snippets) to ground an LLM response, while keeping content in place and respecting permissions/sensitivity labels.

A good heuristic:

  • “Give me the document metadata / file bytes” → Graph sites/drives/items

  • “Answer using the most relevant parts of our HR policies” → Retrieval API

2) Set Delegated Permissions

The Retrieval API is delegated-only. That’s intentional: the service retrieves snippets from content the calling user can access, permission-trimmed at query time.

Minimum permissions for SharePoint grounding:

  • Files.Read.All

  • Sites.Read.All 


3) Test Quickly In Graph Explorer

Fastest way to validate your tenant + permissions is Graph Explorer.

Click path: Graph Explorer → Sign in → Modify permissions → Consent → Run query



4) Call Retrieval For SharePoint (With Site Scoping)

Here’s the core call. You provide:

  • queryString (single sentence, up to 1,500 chars)

  • dataSource = sharePoint

  • optional filterExpression (KQL) to scope sites

  • optional resourceMetadata

  • maximumNumberOfResults (1–25) 

Change these values:
  • queryString: the user’s natural-language question

  • filterExpression: one site, or multiple sites using OR

  • resourceMetadata: only the metadata fields you want returned

  • maximumNumberOfResults: keep within 1–25

Minimal working example

Run the PowerShell call above and expect a response with retrievalHits[], each containing:

  • webUrl

  • extracts[] with text + relevanceScore

  • optional resourceMetadata and sensitivityLabel

Troubleshooting

  • 403 / access denied: confirm the signed-in user has a Copilot license (Copilot APIs require it).

  • No results: remove filterExpression first, then add it back (KQL path scoping is easy to over-constrain).

  • 400 bad request: maximumNumberOfResults must be 1–25, and queryString has constraints (single sentence, 1,500 chars).

  • Trying application permissions: not supported—switch to delegated auth.

  • Using /beta in production: move to v1.0 (beta can change and isn’t supported for production).

Notes

  • The Retrieval API is built to avoid “DIY RAG plumbing” (export/crawl/index/vector DB) while still honoring Microsoft 365 security and compliance boundaries.

  • Use filterExpression with path:"<site url>" to keep grounding tight (single site or multiple sites with OR).

  • You typically pass the returned extracts.text + webUrl into your model prompt, and keep the URLs as citations in your UI.

Wrapping up

The Copilot Retrieval API is the most pragmatic way to pull permission-trimmed SharePoint grounding content into your own agents without building or hosting a parallel index. Once you can reliably retrieve relevant extracts, everything else becomes “just orchestration” around your model and UX.

Hope this helps!

Sunday, 2 November 2025

Bring third party data into Declarative Agents for M365 Copilot (using TypeSpec)

In my previous post, Getting Started: Declarative Agents With TypeSpec for Microsoft 365 Copilot we saw the basics of Declarative Agents and how they are the sweet spot between no-code and pro-code agents. 

In this post, we will see how we can integrate third-party APIs in Declarative Agents. Declarative Agents can call third-party APIs through “actions” you describe in TypeSpec. The agent decides when to invoke your action, passes parameters, and you choose how the results render in chat (e.g Adaptive Cards). We’ll be plugging in a public weather API to show the end-to-end pattern.



On a high level, we’ll:

  • Scaffold a Declarative Agent in VS Code.

  • Add two actions: city → coords, then coords → weather.

  • Bind results to Adaptive Cards for clean output.

  • Test with natural prompts like “Weather in Paris, France”.

Prereqs

  • Microsoft 365 tenant + VS Code with the Microsoft 365 Agents Toolkit extension.

  • TypeSpec packages from the scaffold.

  • Public APIs (no auth):

    • Geocoding: https://geocoding-api.open-meteo.com/v1/search?name={city}&count=1

    • Weather: https://api.open-meteo.com/v1/forecast?latitude={lat}&longitude={lon}&current=temperature_2m,wind_speed_10m

1) Scaffold a TypeSpec Declarative Agent

Click path: VS Code → Microsoft 365 Agents Toolkit (sidebar) → Create a New Agent/AppDeclarative Agent (TypeSpec) → Finish. 


2) Add the TypeSpec files (agent + actions)

Update the main.tsp file:

And the actions.tsp file containing the action details

3) Add Adaptive Cards

Create adaptiveCards/ and add:

adaptiveCards/location-card.json

adaptiveCards/weather-card.json


4) Build & test

  • In Agents Toolkit: Provision.

  • Open the web test for your agent and try:

Prompts

  • “What’s the weather in Seattle right now?”

  • “Show me the weather in Paris, France.”

  • “Get weather for latitude 40.7128 and longitude -74.0060.”

Expected

  • The agent calls searchCity (shows Location card) → then getWeather (shows Weather card with °C, wind, time, timezone)



Minimal working example

Prompt: “Weather for Pune.”

Flow: searchCity(name="Pune") → top match → getWeather(latitude, longitude, current="temperature_2m,wind_speed_10m", location="Pune, IN")


Output: Two cards; final card shows temperature (°C), wind (km/h), time, and timezone.

Wrapping up

Declarative Agents make third-party API calls feel native: describe the action, let the agent orchestrate, and render the result with Adaptive Cards. 

Hope this helps!

Saturday, 11 October 2025

Getting started: Declarative Agents with TypeSpec for Microsoft 365 Copilot

Declarative agents let you add focused skills to Microsoft 365 Copilot without spinning up servers or long-running code. Compared to Copilot Studio agents (full or Lite), which are great for UI-first orchestration and built-in connectors, declarative agents are repo-friendly, schema-driven artifacts you version, review, and ship like code. 

You describe instructions and capabilities in TypeSpec and the M365 Agents toolkit compiles that into a manifest and handles provisioning.

So in this post, we’ll use the TypeSpec starter in the Microsoft 365 Agents Toolkit and light up a couple of built-in capabilities.


On a high level, we’ll:

  • Install the Microsoft 365 Agents Toolkit and TypeSpec bits. 

  • Scaffold a Declarative Agent (TypeSpec) project in VS Code. 

  • Add capabilities (OneDrive/SharePoint search + People + Code Interpreter). 

  • Provision and test the agent from the toolkit.

Prereqs

  • Microsoft 365 tenant (Developer or test tenant recommended) and permission to create app registrations.

  • Visual Studio Code with Microsoft 365 Agents Toolkit extension. 

  • TypeSpec for Microsoft 365 Copilot (installed automatically by the toolkit starter). 


1) Create a TypeSpec Declarative Agent

  1. Open VS Code.

  2. From the sidebar, open Microsoft 365 Agents ToolkitCreate a New Agent/AppDeclarative AgentStart with TypeSpec for Microsoft 365 Copilot.

  3. Name it (e.g., ContosoFinder) and choose the default folder.

  4. In the Lifecycle pane, select Provision to create the Azure AD app and resources in your tenant.


2) Understand the project

The starter includes:

  • main.tsp (your agent definition)

  • Build scripts that compile TypeSpec → agent manifest JSON

  • Toolkit tasks for Provision, Deploy, Publish 



3) Add core capabilities in TypeSpec

Open main.tsp and define instructions plus capabilities. Here’s a compact example that enables OneDrive/SharePoint, People, and CodeInterpreter for simple Python math/CSV ops:

Change these values: title, instructions text, conversation starters, search resultLimit, and Code Interpreter timeout as needed. Capability names/params align with the built-in catalog.

4) Build & validate

  • In the Agents Toolkit Lifecycle pane: select Provision which will start the build, validate and deploy process.

5) Test in Microsoft 365 Copilot (tenant)

  • Once the Provisioning succeeds

  • Try prompts like:

    • “Find my last 5 QBR files” → You should see a list of SharePoint/OneDrive files with links.

    • “Who are my peers?” → The agent returns people details from the Graph.

    • “Summarize this CSV and plot top 3 values” → Code Interpreter runs Python and returns a brief summary + chart image. 



Notes

  • Prefer built-in capabilities (Search, People, OneDrive/SharePoint, Teams Messages, WebSearch, Code Interpreter) before adding custom APIs. They’re simpler and tenant-aware.

  • When you need external systems, add an API plugin to your declarative agent via TypeSpec; plugins are actions inside declarative agents (not standalone in Copilot).

  • Great learning paths: the “Build your first declarative agent using TypeSpec” module and recent open labs/samples. 

Wrapping up

With TypeSpec, declarative agents become a clean, versionable artifact you can build, validate, and ship from VS Code. Start with built-in capabilities, keep instructions focused, and only plug external APIs when the scenario demands it. 

Hope this helps!

Sunday, 5 October 2025

Enable Code Interpreter in Copilot Studio (Full Version)

Code interpreter in Copilot Studio is a built in runtime that lets Copilot write and run short Python code in a secure sandbox. It can read files that you upload, perform calculations, build charts, transform data, and return the outputs inline or as downloadable files. Typical uses include quick analysis of CSV or Excel data, data cleaning, format conversions, and simple visualizations, all driven by natural language prompts. More information here.

In the full Copilot Studio experience you enable it at the environment level and then turn it on for specific prompts so your agent can choose when to use code for better answers.

So in this post, let’s enable the new Code interpreter capability in the full version of Copilot Studio and use it from a prompt. We’ll keep it small: flip the right admin switch, add a prompt as a tool in an agent, and verify with a quick run. 

This is not about Copilot Studio Lite/Agent Builder (that already exposes a simple toggle), this walkthrough is for the full Copilot Studio experience.


On a high level, we’ll:

  1. Turn on Code interpreter for your environment in the Power Platform admin center (PPAC).

  2. In Copilot Studio (full), add a Prompt tool to an agent and enable Code interpreter in the prompt’s settings.

  3. Test with a couple of natural‑language requests that execute Python under the hood.

Prereqs: You’ll need access to PPAC (or an admin), a Copilot Studio environment, and a Microsoft 365 Copilot or Copilot Studio license in the right tenant. If you see a message like “Code interpreter is disabled for your environment or tenant”, it usually means step 1 wasn’t completed.

1) Enable at the environment level (admin step)

In Power Platform admin center:

  1. Go to Copilot → Settings.

  2. Under Copilot Studio, open Code generation and execution in Copilot Studio.

  3. Select your environment, choose On, and Save.



That switch unlocks Python‑based execution for prompts and agents in that environment. If you manage multiple environments (Dev/Test/Prod), repeat per environment.

2) Add a prompt to an agent and enable Code interpreter

In Copilot Studio (full):

  1. Open your agentTools tab → New toolPrompt.

  2. In the prompt editor, select … → Settings.

  3. Toggle Enable code interpreterSave/Close.

Tip: This is easy to miss the toggle lives in the prompt’s Settings, not in the agent’s capabilities. If the toggle is missing or disabled, double‑check step 1 or your permissions.


 

3) A minimal prompt

Create a new prompt with the following Instructions:

You are a helpful assistant that can use Code interpreter when it’s the best tool for the task.
If the user asks to analyze data, perform calculations, transform files, 
or generate charts,
write and run Python code with safe defaults.
Explain what you ran and summarize the output clearly for a non‑technical audience.

Add Inputs:

  • question (Text)

Test ideas:

  • “Simulate compound growth at 8% for 10 years and plot the curve.”

When you select Test, you should see the system take two passes: first it plans, then it generates and executes Python, returning results (and charts) inline.



Now you can start using this prompt tool just like any other tool in your agent!

Troubleshooting

  • Toggle isn’t visible: The prompt’s settings show Code interpreter only when the environment is enabled in PPAC.

  • Blocked by policy: Some tenants restrict code execution. Check with your admin if the PPAC toggle is greyed out.

  • Host differences: In‑context agents that run inside other hosts may have limitations when Code interpreter is on. Test in your target host early.

  • Quotas: Code execution may be subject to usage limits. If runs are throttled, try again later or reduce dataset size.

Notes

  • In Copilot Studio Lite / Agent Builder, you’ll find Code interpreter under Configure → Capabilities as a simple toggle. This post focuses on the full Copilot Studio flow, where the setting lives inside each Prompt.

  • If you build agents with the Agents Toolkit/VS Code, you can also declare CodeInterpreter in the agent manifest (schema v1.2+). That’s a different path but useful for source‑controlled agents.

Wrapping up

That’s the minimal path: enable at PPAC → toggle in the Prompt settings → test with a simple data task. From here, stitch the prompt into your agent’s flow, pass inputs from variables, and add guardrails (size limits, safe defaults).

Hope this helps!