ag-ui-protocol / ag-ui-protocol/ag-ui

ag_ui_langgraph not passing front-end tools

オープン
#892 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug Integration
主要言語
Python
スター
15.9k
フォーク
1.4k
平均マージ
1日 17時間
マージ済み PR(30日)
163

説明

I'm using the AG UI Langgraph v0.0.22 library to interface with my Langgraph agent. In my code, I pass in a front-end tool from the front-end into the payload. I confirmed that the backend receives the payload correctly and the tool is in the payload. However, the tool isn't passed to the LLM call. I have two backend tools that are passed correctly.

My backend is a FastAPI Python application and I'm using LangChain / LangGraph v1. My agent is a simple agent implemented using LangChain v1's `create_agent()` feature.

In reviewing the code, I see that the `agent.py` library has a method named `prepare_regenerate_stream()` that has an unused reference to `tools`. I'm not sure if that's the issue or not as I haven't diagnosed it further yet.

Here is the frontend tool code (I took it directly from the the [AG-UI Tools documentation](https://docs.ag-ui.com/concepts/tools):

```javascript
[ {
name: "confirmAction",
description: "Ask the user to confirm a specific action before proceeding",
parameters: {
type: "object",
properties: {
action: {
type: "string",
description: "The action that needs user confirmation",
},
importance: {
type: "string",
enum: ["low", "medium", "high", "critical"],
description: "The importance level of the action",
},
},
required: ["action"],
},
} ]
```

Here is the log message in the backend showing the tool was received in the RunAgentInput:

```python
AG-UI Tools:
[Tool(
name='confirmAction',
description='Ask the user to confirm a specific action before proceeding',
parameters={'type': 'object', 'properties': {'action': {'type': 'string', 'description': 'The action that needs user confirmation'}, 'importance': {'type': 'string', 'enum': ['low', 'medium', 'high', 'critical'], 'description': 'The importance level of the action'}},
'required': ['action']})
]
```

Here's the log message from the LLM call:

```javascript
'request_data': {
'messages' : [ {
'content': '''You are a friendly assistant who can answer general questions.
Before answering, work through this ...''',
'role': 'system',
},
{
'content': 'Hello! How can I help you today?',
'role': 'assistant',
},
{
'content': 'hello',
'role': 'user',
},
],
'model': 'gpt-oss-20b',
'tools' : [ {
'type': 'function',
'function': {
'name': 'get_current_date_and_time',
'description': 'Tool to provide the current date and time in string format',
'parameters' : {
'properties' : { },
'type': 'object',
},
},
},
{
'type': 'function',
'function' : {
'name': 'get_weather_for_day',
'description': 'Tool to provide the current weather for a day',
'parameters' : {
'properties' : {
'date': {
'type': 'string',
},
},
'required' : ['date',],
'type': 'object',
},
},
},],
},
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。