Azure / Azure/azure-sdk-for-python

agent_framework_input_converters rejects nested message format from official documentation

Offen
#44,994 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

customer-reported Hosted Agents needs-team-attention question Service Attention
Vorherrschende Sprache
Python
Sterne
5.6k
Forks
3.4k
Ø Merge
2 T. 2 Std.
Gemergte PRs (30 T.)
213

Beschreibung

  • Package Name: azure-ai-agentserver-agentframework
  • Package Version: 1.0.0b10
  • Operating System: Windows
  • Python Version: 3.12.10

Describe the bug
The agent_framework_input_converters.py module rejects the nested message format ({"messages": [...]}) shown in the official Microsoft documentation, causing a TypeError when using the documented payload structure for local testing.

Error:

TypeError: Unsupported input type: <class 'dict'>

Traceback:

Traceback (most recent call last):
File "C:\Users<username>\OneDrive\Documents\VSCode Hosted Agent Test2\hostedagenttest.venv\Lib\site-packages\azure\ai\agentserver\agentframework\models\agent_framework_input_converters.py", line 137, in _transform_input_internal
raise TypeError(f"Unsupported input type: {type(input)}")
TypeError: Unsupported input type: <class 'dict'>

To Reproduce
Steps to reproduce the behavior:

  1. Create a hosted agent using Agent Framework following the official documentation:

  2. Run the agent locally:

from azure.ai.agentserver.agentframework import from_agent_framework

if __name__ == "__main__":
    from_agent_framework(agent).run()  # localhost:8088
  1. Send a POST request using the documented payload format:
curl -X POST http://localhost:8088/responses \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
        "messages": [
            {
                "role": "user",
                "content": "Where is Seattle?"
            }
        ]
    }
}'
  1. Result:

{"code":"server_error","message":"Error processing messages: Unsupported input type: <class 'dict'>"}

Expected behavior
The converter should accept the nested format shown in the official documentation:

POST {{baseUrl}}/responses
Content-Type: application/json
 
{
    "input": {
        "messages": [
            {
                "role": "user",
                "content": "Where is Seattle?"
            }
        ]
    }
}

Screenshots
N/A

Additional context

Current workaround:
The only working format is flattened (removing the messages wrapper):

{
    "input": [
        {
            "role": "user",
            "content": "Where is Seattle?"
        }
    ]
}

Root cause:
In agent_framework_input_converters.py (line 63-66), the type hint only accepts str | List[Dict] | None:

   def _transform_input_internal(
        self,
        input: str | List[Dict] | None,
    ) -> str | ChatMessage | list[str] | list[ChatMessage] | None:

Line 137 explicitly rejects dict type:

            raise TypeError(f"Unsupported input type: {type(input)}")

Impact:

  • Documentation/implementation mismatch causes confusion for developers
  • Local testing requires a different payload format than what is documented
  • Unclear whether production deployment behavior differs from local testing

Questions:

  • Is this intentional behavior? If so, why does the official documentation show a different format?
  • Should the documentation be updated to reflect the flattened format, or should the implementation support the nested format?
  • Does the production Foundry Responses API (when deployed to Azure) accept the nested format, or does it also require the flattened format?

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit agent_framework_input_converters.py, insbesondere mit dem Type-Hint von _transform_input_internal um die Zeilen 63–66 und der Zurückweisung in Zeile 137. Vergleiche die dokumentierte verschachtelte Payload mit der funktionierenden abgeflachten Payload und ermittle den vorgesehenen Eingabevertrag; die Arbeit ist abgeschlossen, wenn Implementierung und Dokumentation übereinstimmen und die dokumentierte lokale Anfrage nicht mehr den gemeldeten TypeError erzeugt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.