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

ag_ui_langgraph not passing front-end tools

Đang mở
#892 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug Integration
Ngôn ngữ chính
Python
Star
15.9k
Fork
1.4k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
163

Mô tả

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',
},
},
},],
},
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.