At minimum, complete these four steps:
- Compare your current tools with agent tool availability, and choose replacements for tools that don’t carry over.
- Migrate the agent definition by following the classic agents or Assistants API path.
- Replace threads with conversations and runs with responses.
- Verify your migration, including state, tool calls, outputs, and error handling.
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:
- Python
- C#
- JavaScript
- Java
- 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 agents and Hosted agents.
- ⭐ 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.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.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.ProjectOpenAIClient.GetProjectResponsesClientForAgent(). In JavaScript, call project.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.