Python: [Bug]: UserMessage/AgentMessage return different shapes from WorkflowState and DeclarativeWorkflowState
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 13.9k
- フォーク
- 2.4k
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 443
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/agent-framework のほかの issue
-
.NET python triage
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
microsoft/agent-framework#9092 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Python: raw-data content mappings lose annotations and attachment metadata対応中かも @moonbox3 が 9 日前に担当しました。 オープンpython triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/agent-framework#8632 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Python: Clarify when to use platform対応中かも @eavanvalkenburg が 8 日前に担当しました。 オープンpython triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/agent-framework#8599 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
.NET Compaction - Update docs to refer to `AIContextProvider` deep dive対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン.NET compaction documentation
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
microsoft/agent-framework#4629 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Python: [Bug]: Media type detection documentation examples contain invalid base64対応中かも @eavanvalkenburg が 1 日前に担当しました。 オープンagents python reproduced
microsoft/agent-framework#9187 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
microsoft/agent-framework の issue をすべて見る
似ている issue
-
bug ready for review
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
odysseus-dev/odysseus#6641 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
happypawspillaro/happypaws#78 ·
メンテナーはふだん 4 日以内に返信
-
pydanty:is-working
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
pydantic/pydantic-ai#10020 ·
メンテナーはふだん 1 日以内に返信
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ansible-collections/ibm_zos_core#2650 ·
-
hw: pvc tests: vllm vllm
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
intel/intel-xpu-backend-for-triton#8362 ·
メンテナーはふだん 1 日以内に返信