Azure / Azure/azure-sdk-for-python
Getting openai.BadRequestError- Failed to decode AML connections- while running the sample code from new AI foundry Agent playground
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 3.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 193
Description
Packages:
**azure-ai-agents 1.1.0
azure-ai-projects 2.0.0b2
azure-core 1.36.0
azure-identity 1.20.0**
I was exploring the new AI foundry that was released few days back and came across this error while trying the sample agent code.
I am getting below error:
openai.BadRequestError: Error code: 400 - {'error': {'message': 'Failed to decode AML connections.', 'type': 'invalid_request_error', 'param': None, 'code': 'aml_connections_decode_error'}}
This remains same whether im running locally or on the web vs code option that is present there.
```
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
myEndpoint =
project_client = AIProjectClient(
endpoint=myEndpoint,
credential=DefaultAzureCredential(),
)
myAgent = "IcecreamSellerAgent"
# Get an existing agent
agent = project_client.agents.get(agent_name=myAgent)
print(f"Retrieved agent: {agent.name}")
openai_client = project_client.get_openai_client()
# Reference the agent to get a response
response = openai_client.responses.create(
input=[{"role": "user", "content": "Tell me what you can help with."}],
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)
print(f"Response output: {response.output_text}")
```
Contributor guide
Assessment
This issue has not been assessed yet.