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

ag_ui_langgraph not passing front-end tools

Open
#892 4 comments 0 reactions 0 assignees View on GitHub
bug Integration
Dominant language
Python
Stars
15.9k
Forks
1.4k
Avg merge
1d 17h
Merged PRs (30d)
163

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.