How to access (and resurrect) Azure AI Agent Service stored threads?

Russell Myers 20 Reputation points
2025-04-30T07:17:27.2833333+00:00

In the Azure AI Agent Service FAQ, it states that Threads are stored indefinitely (see extract below)

My question is: in order to resurrect a chat conversation at a later date, how can specific stored Threads be retrieved from storage? (eg by Thread id).

Regards,

Russell


Yes. Unlike Chat Completions API, Azure AI Agent Service is a stateful API, meaning it retains data. There are two types of data stored in the AI Agent Service API:

  • Stateful entities: Threads, messages, and runs created during AI Agent Service use.
  • Files: Uploaded during AI Agent Service setup or as part of a message.
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,449 questions
{count} votes

Accepted answer
  1. SriLakshmi C 5,125 Reputation points Microsoft External Staff Moderator
    2025-04-30T16:25:44.1466667+00:00

    Hello @Russell Myers,

    I understand that you're looking to retrieve specific stored threads from the Azure AI Agent Service to resurrect previous chat conversations. Here's how you can do that:

    Each conversation is identified by a unique ChatThreadId. You can find this ID by using the Azure Resources extension in Visual Studio Code under the "Threads" section, which displays a list of all threads along with their IDs.

    The API provided by the Azure AI Agent Service allows you to interact with the stored threads. You can typically use commands like Get Thread or List Threads to retrieve information about the threads stored in the service.

    Once you have the ChatThreadId,You can retrieve messages linked to a specific thread using the REST API. Below is an example of a curl command to perform this action:

    curl $AZURE_AI_AGENTS_ENDPOINT/threads/{thread_id}/messages?api-version=2024-12-01-preview\   -H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
    

    The API provided by the Azure AI Agent Service allows you to interact with the stored threads. You can typically use commands like Get Thread or List Threads to retrieve information about the threads stored in the service.

    When using the API to retrieve a specific thread, make sure to provide the required parameters such as the ChatThreadId to accurately identify the thread you want to access.

    If you want to resurrect the conversation or perform further actions, you can run the thread using its ID. Here’s how you can do that:

    curl $AZURE_AI_AGENTS_ENDPOINT/threads/{thread_id}/runs?api-version=2024-12-01-preview \
      -H "Authorization: Bearer $AZURE_AI_AGENTS_TOKEN" \
      -d '{
        "assistant_id": "your_assistant_id"
      }'
    

    After triggering a run, check the run status and fetch responses using the appropriate endpoint. This allows you to continue or revisit the agent's interaction history.

    I hope this helps. Do let me know if you have further queries.

    Thank you!

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.