Python: [Bug]: UserMessage/AgentMessage return different shapes from WorkflowState and DeclarativeWorkflowState
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend-api-design
Direzione di ricerca
Compare the two evaluation paths in _powerfx_functions.py and _declarative_base.py, then trace how each MessageText implementation reads messages. The issue leaves the canonical shape to a maintainer, so get that direction before changing code. Done means both evaluation paths produce the agreed shape and both MessageText implementations read it consistently.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Language
Python
What happened?
The same declarative formula produces two different message shapes depending on which public state class evaluates it:
from agent_framework_declarative._workflows._state import WorkflowState
WorkflowState().eval('=UserMessage("hi")')
# {'role': 'user', 'content': 'hi'}
WorkflowState (standalone) routes to _powerfx_functions.user_message, which returns a flat content key (python/packages/declarative/agent_framework_declarative/_workflows/_powerfx_functions.py:107, same for assistant_message / agent_message / system_message).
DeclarativeWorkflowState (what factory-created workflows use) routes to _eval_custom_function, which returns a flat text key for UserMessage / AgentMessage:
return {"role": "user", "text": str(text) if text else ""} # _declarative_base.py:755
The two MessageText implementations each read only their own side's shape, so a message that crosses paths silently extracts nothing:
_declarative_base._eval_and_replace_message_textreadstextfirst, then acontentslist; it never readscontent(_declarative_base.py:858-885). Acontent-shaped message yields""._powerfx_functions.message_textreadscontent, so on atext-shaped message it returns"":
from agent_framework_declarative._workflows._powerfx_functions import message_text
message_text([{"role": "user", "text": "hi"}]) # ''
message_text([{"role": "user", "content": "hi"}]) # 'hi'
The agent-side consumer is more tolerant (_executors_agents.py:716 reads content then text), which papers over the split for agent invocations but not for MessageText.
For reference, the .NET canonical shape is a structured record (dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/Functions/MessageFunction.cs): {__type__, Role, Content: [{Type: "Text", Value: ...}]}, i.e. neither flat Python shape. Feeding that shape to the fallback message_text today stringifies the content table:
message_text([{"role": "user", "content": [{"type": "text", "value": "hi"}]}])
# "[{'type': 'text', 'value': 'hi'}]"
Verified on current main (e9857bd75a21843803431a2e7dfa41ee9b017ac7) with agent-framework-declarative installed from source; the .NET shape was read from the in-repo dotnet sources.
What should happen?
One canonical message shape for the Python package, with both eval paths producing it and both MessageText implementations reading it. Which key wins (flat text, flat content, or the structured .NET-style content list) looks like a maintainer call; happy to send the PR once there is a direction.
- Lingua principale
- Python
- Stelle
- 14k
- Fork
- 2.5k
- Merge medio
- 2g 2h
- PR unite (30g)
- 389
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/agent-framework
-
Python: [Bug]: Out-of-range Cosmos memory search parameters silently disable retrievalForse già presa @Lesereingrape l’ha presa 1 giorno fa. Apertapython triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/agent-framework#9317 ·
I maintainer di solito rispondono entro 1 giorno
-
Python: [Bug]: A non-positive MCP request timeout silently disables the timeoutForse già presa @Lesereingrape l’ha presa 1 giorno fa. Apertapython triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
microsoft/agent-framework#9313 ·
I maintainer di solito rispondono entro 1 giorno
-
Python: [Bug]: Content.from_dict leaves the nested content of image generation and MCP server tool results as plain dictsForse già presa @shanto462 l’ha presa 1 giorno fa. Apertapython triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
microsoft/agent-framework#9303 ·
I maintainer di solito rispondono entro 1 giorno
-
.NET: Python: [Bug]: Two switch-case branches cannot route to the same executor (EdgeDuplicationError)Forse già presa @shanto462 l’ha presa 1 giorno fa. Aperta.NET python triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/agent-framework#9297 ·
I maintainer di solito rispondono entro 1 giorno
-
.NET python triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
microsoft/agent-framework#9092 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/agent-framework
Issue simili
-
python triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
microsoft/semantic-kernel#14590 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
pinterest/pymemcache#662 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
gnocchixyz/gnocchi#1527 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
tenstorrent/tt-model-manager#181 ·
I maintainer di solito rispondono entro 1 giorno