Python: [Bug]: UserMessage/AgentMessage return different shapes from WorkflowState and DeclarativeWorkflowState
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- backend-api-design
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 13.9k
- Forks
- 2.4k
- Merge medio
- 1 d 18 h
- PR fusionados (30 d)
- 443
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/agent-framework
-
.NET: Proposal: add an llms.txtAbierto.NET python triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
microsoft/agent-framework#9092 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Python: raw-data content mappings lose annotations and attachment metadataPosiblemente ocupada @moonbox3 la tomó hace 8 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/agent-framework#8632 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Python: Clarify when to use platformPosiblemente ocupada @eavanvalkenburg la tomó hace 7 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/agent-framework#8599 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
.NET Compaction - Update docs to refer to `AIContextProvider` deep divePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto.NET compaction documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
microsoft/agent-framework#4629 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Python: [Bug]: Media type detection documentation examples contain invalid base64Posiblemente ocupada @eavanvalkenburg la tomó hoy. Abiertoagents python reproduced
microsoft/agent-framework#9187 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/agent-framework
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
epam/ai-dial-quickapps-backend#628 ·
Los mantenedores suelen responder en 2 días
-
0xlau.dev 已失效,切换成 timlau.meAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 69/100
timqian/chinese-independent-blogs#2235 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
eclipse-score/coverage_tool#27 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
bojieli/ai-agent-book#1174 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
RedHatQE/mtv-api-tests#721 ·
Los mantenedores suelen responder en 1 día