a2aproject / a2aproject/a2a-samples
Mismatch between AI Response and Structured Output in LangGraph Example
- 主要言語
- Jupyter Notebook
- スター
- 1.8k
- フォーク
- 751
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
In the LangGraph example, you are using create_react_agent with a structured output (which is required for A2A). However, under the hood, what create_react_agent does is run the model twice: once with bind_tools and once with with_structured_output. With bind_tools, the model knows about the tool, and its response is correct, but it's not formatted, so the status can't be extracted. On the other hand, with with_structured_output, the model doesn't know about the tools (because none are bound), so the response doesn't include any information about them, and it's completely different from the bind_tools response. In fact, sometimes this response doesn't even make sense. If you look at the state, you'll see that the first option is correct, while the second one is not, as the first will appear in the message list, and the second will be in the structured output field.
```json
{
"messages": [
{
"role": "HumanMessage",
"content": "Hello, I want to build a minisite"
},
{
"role": "AIMessage",
"content": "Hello! I can help you with that. To build the minisite, I'll need you to provide information about the tool you'd like to add. I'll need the name, description, key benefits, key features, FAQs, real use cases, and how to get started with the tool.\n\nIs it okay if we start with that?"
}
],
"structured_response": {
"status": "input_required",
"message": "Hello! To help you build your minisite, I need more information. What topic would you like the minisite to be about? Do you have any content ready, such as text or images? Do you have any design or layout preferences?"
}
}
```
コントリビューションガイド
評価
この issue はまだ評価されていません。