Description
Feature request to support conversation branching when using Foundry Hosting. When having a conversation using the conversation parameter, users should be able to branch from an earlier response in the conversation by supplying previous_response_id from a previous response. This isn't currently possible, because state is stored by response ID or conversation ID, but not both.
Code Sample
from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
endpoint = "https://<RESOURCE>.services.ai.azure.com/api/projects/<PROJECT>"
agent_name = "<AGENT>"
with (
DefaultAzureCredential() as credential,
AIProjectClient(
endpoint=endpoint,
credential=credential,
) as project_client,
):
openai_client = project_client.get_openai_client(agent_name=agent_name)
conversation = openai_client.conversations.create()
response = openai_client.responses.create(
input="What is 2+2?",
conversation=conversation.id,
)
print(f"Response 1: {response.output_text}")
response2 = openai_client.responses.create(
input="Double it.",
previous_response_id=response.id,
)
print(f"Response 2: {response2.output_text}")
print(f"Error: {response2.error}")
Response 1: 2 + 2 = 4.
Response 2:
Error: ResponseError(code='server_error', message="No Agent Framework session snapshot was found for previous_response_id 'caresp_49cf634c7a29213f00laVRPRLnkHxzs5UuiPG2M6DciiMPovX0'. Reuse the response's agent_session_id so the request is routed to the same persistent Foundry sandbox.")
Language/SDK
Python
Description
Feature request to support conversation branching when using Foundry Hosting. When having a conversation using the
conversationparameter, users should be able to branch from an earlier response in the conversation by supplyingprevious_response_idfrom a previous response. This isn't currently possible, because state is stored by response ID or conversation ID, but not both.Code Sample
Language/SDK
Python