Prerequisites
- An Azure subscription. Create one for free.
- A Microsoft Foundry project.
- The Foundry Agent Service SDK for your language, and corresponding identity package for authentication. Install the packages for your language and sign in with
az loginor useDefaultAzureCredential:
- Existing agents or assistants code that you want to migrate.
project for agent creation and versioning. Use openai (or the equivalent in your language) for conversations and responses.
Key benefits
The new agents provide the following benefits: Developer productivity- ⭐ More models. Generate responses by using any Foundry model either in your agent or directly as a response generation call.
- More features. Web Search, File Search, Code Interpreter, MCP tool calling, image generation, and reasoning summaries.
- Modern API primitive. Built on the Responses API instead of the older Assistants API.
- Background mode. Support for long-running tools (like image-generation), and durable streams (supports disconnect/reconnect scenarios)
- Future-proof. New features and model support are only added to the new agents.
- New agent types. Create prompt-based, workflow-based agents, workflow-based agents (preview), and hosted agents (preview).
- ⭐ Single-tenant storage. Use single-tenant storage, with the option to bring your own Azure Cosmos DB to store state and keep your data secure.
- Enhanced security. Control who can run or modify agent definitions.
- Separation of duties. Define agents once and execute them with various inputs.
- Deployable agents. Agents can be exposed as individual endpoints.
- Improved state management. Uses conversations instead of threads and messages.
- Stateful context. Automatically retains context across calls.
- Superset of Responses API. Builds on the Responses API and adds more capabilities.
- Single or multi-agent workflows. Easily chain agents for complex workflows.
Key changes
The following table summarizes the main API changes between the previous and current agent experience.| Before | After | Details |
|---|---|---|
| Threads | Conversations | Supports streams of items, not just messages. |
| Runs | Responses | Responses send input items or use a conversation object and receive output items. Tool call loops are explicitly managed. |
| Assistants / agents | Agents (new) | Support for enterprise-ready prompt, workflow, and hosted agents with stateful context by default for any Foundry model. |
Agent tool availability
The following table compares agent tools available in classic agents and the new Foundry Agent Service. Use it to identify which tools carry over directly, which have changed, and which are exclusive to the new experience.| Tool | Foundry (classic) | Foundry (new) |
|---|---|---|
| Agent to Agent (A2A) | No | Yes (Public Preview) |
| Azure AI Search | Yes (GA) | Yes (GA) |
| Azure Functions | Yes (GA) | No |
| Browser Automation | Yes (Public Preview) | Yes (Public Preview) |
| Code Interpreter | Yes (GA) | Yes (GA) |
| Computer Use | Yes (Public Preview) | Yes (Public Preview) |
| Connected Agents | Yes (Public Preview) | No (Recommendation: Workflow and A2A tool) |
| Deep Research | Yes (Public Preview) | No (Recommendation: Deep Research model with Web Search tool) |
| Fabric Data Agent | Yes (Public Preview) | Yes (Public Preview) |
| File Search | Yes (GA) | Yes (GA) |
| Function | Yes (GA) | Yes (GA) |
| Grounding with Bing Search | Yes (GA) | Yes (GA) |
| Grounding with Bing Custom Search | Yes (Public Preview) | Yes (Public Preview) |
| Image Generation | No | Yes (Public Preview) |
| MCP | Yes (Public Preview) | Yes (GA) |
| OpenAPI | Yes (GA) | Yes (GA) |
| SharePoint Grounding | Yes (Public Preview) | Yes (Public Preview) |
| Web Search | No | Yes (Public Preview) |
In the new API, the conversations and responses APIs use the OpenAI client (or its language equivalent). In Python, call
project.get_openai_client(). In C#, use projectClient.OpenAI.GetProjectResponsesClientForAgent(). In JavaScript, call projectClient.getOpenAIClient(). In Java, use AgentsClientBuilder to build a ResponsesClient. Agent creation and versioning remain on the project client. The examples in each section show which client to use.Migrate threads to conversations
Threads stored messages on the server side. A conversation can store items, including messages, tool calls, tool outputs, and other data.Requests
The following examples compare thread creation (previous) with conversation creation (current). The current approach uses the OpenAI client obtained fromproject.get_openai_client().
Previous - threads
Responses
The JSON responses show the structural differences between thread objects and conversation objects. Previous - threadsAdd items to an existing conversation
After you create a conversation, useconversations.items.create() to add subsequent messages. This pattern replaces adding messages to threads with client.agents.messages.create().
Previous - add a message to a thread
Migrate runs to responses
Runs were asynchronous processes that executed against threads. Responses are simpler: provide a set of input items to execute and get a list of output items back. Responses can be used alone, or with conversation objects for storing context. The responses API uses the OpenAI client.Requests
The following examples compare how you invoke agent logic. The previous approach used asynchronous runs with polling. The current approach callsresponses.create() on the OpenAI client.
Previous - runs
Responses
Previous - runsMigrate classic agents to new agents
If you use theclient.agents.create_agent() method from earlier SDK versions, migrate to client.agents.create_version(). The new method introduces structured agent definitions with explicit kind, model, and instructions fields.
Requests
PreviousResponses
The following JSON examples compare the response objects returned by the previous and current agent creation methods. PreviousMigrate assistants to new agents
If your code uses the OpenAI Assistants API (client.beta.assistants.create()), migrate to the Foundry Agent Service by using client.agents.create_version(). The following examples show the structural differences.
Previous - assistants
Run the migration tool
A migration tool is available on GitHub to help automate the migration of your agents and assistants. The tool migrates code constructs such as agent definitions, thread creation, message creation, and run creation. It doesn’t migrate state data like past runs, threads, or messages. After migration, you can run the new code, and any new state data is created in the updated format. The following example shows a complete before-and-after comparison. Notice that the current code uses bothproject for agent creation and openai for conversations and responses.
Previous
Verify your migration
After you migrate your code, confirm that everything works correctly:- Run the updated code and verify that it executes without errors.
- Check agent creation by confirming that
create_version()returns an object with anidandversionfield. - Test a conversation by creating a conversation, sending a response, and verifying that output items are returned.
- Confirm context retention by sending multiple responses to the same conversation and checking that the agent remembers earlier messages.
Troubleshoot common issues
| Symptom | Cause | Resolution |
|---|---|---|
Python: AttributeError: 'AIProjectClient' has no attribute 'conversations' | You called conversations.create() on the project client instead of the OpenAI client. | Use project.get_openai_client() to obtain the OpenAI client, then call openai.conversations.create(). |
C#: Azure.AI.Projects.OpenAI namespace not found | The Azure.AI.Projects.OpenAI NuGet package is missing. | Install Azure.AI.Projects.OpenAI alongside Azure.AI.Projects. Both packages are required. |
JavaScript: getOpenAIClient is not a function | You’re using an older version of @azure/ai-projects. | Update to @azure/ai-projects@2.0.0-beta.5 or later: npm install @azure/ai-projects@2.0.0-beta.5. |
Java: AgentsClientBuilder can’t resolve | The azure-ai-agents Maven dependency is missing or outdated. | Add com.azure:azure-ai-agents:2.0.0-beta.2 to your pom.xml dependencies. |
create_agent() is removed | Earlier SDK versions used create_agent(), which was removed in v2.0.0. | Replace with create_version() (Python/JS) or CreateAgentVersionAsync() (C#) or createAgentVersion() (Java) and pass a PromptAgentDefinition object. |
| Old thread data isn’t available | The migration tool doesn’t migrate state data (past runs, threads, or messages). | Start new conversations after migration. Historical data remains accessible through the previous API until it’s deprecated. |
responses.create() raises a model error | The model name might be incorrect or unavailable in your region. | Verify the model name in your Foundry project and check model region availability. |