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

Zod Validation error when streaming MCP tool calls from Langgraph Agent

Aperta
#994 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug Integration
Lingua principale
Python
Stelle
15.9k
Fork
1.4k
Merge medio
1g 17h
PR unite (30g)
163

Descrizione

Hi Team,

I'm getting these Zod Validation errors when streaming tool calls via the @ag-ui/client & @ag-ui/core npm packages.

This specifically happens when the Langgraph Agent is leveraging tools of an MCP Server,

Attaching my npm packages - I believe they're all the latest

```
"@ag-ui/client": "^0.0.43",
"@ag-ui/langgraph": "^0.0.22",
"@copilotkit/react-core": "^1.50.1",
"@copilotkit/react-ui": "^1.50.1",
"@copilotkit/runtime": "^1.50.1",
"@copilotkit/runtime-client-gql": "^1.50.1",
"@copilotkit/shared": "^1.50.1",
"@copilotkitnext/agent": "^0.0.33",
"@copilotkitnext/core": "^0.0.33",
"@copilotkitnext/react": "^0.0.33",
"@copilotkitnext/runtime": "^0.0.33",
```

And my error that I see in the NextJS Frontend

```
Console ZodError

[
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"toolCallId"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"content"
],
"message": "Required"
}
]

Call Stack
26

Hide 26 ignore-listed frame(s)
get error
node_modules/@ag-ui/core/node_modules/zod/v3/types.js (39:1)
ZodDiscriminatedUnion.parse
node_modules/@ag-ui/core/node_modules/zod/v3/types.js (114:1)
Object.next
node_modules/@ag-ui/client/dist/index.mjs (6:1180)
ConsumerObserver.next
../src/internal/Subscriber.ts (161:25)
Subscriber._next
../src/internal/Subscriber.ts (119:22)
Subscriber.next
../src/internal/Subscriber.ts (75:12)
eval
../src/internal/Subject.ts (68:20)
errorContext
../src/internal/util/errorContext.ts (29:5)
Subject.next
../src/internal/Subject.ts (61:17)
t
node_modules/@ag-ui/client/dist/index.mjs (6:20)
Object.next
node_modules/@ag-ui/client/dist/index.mjs (4:9158)
ConsumerObserver.next
../src/internal/Subscriber.ts (161:25)
Subscriber._next
../src/internal/Subscriber.ts (119:22)
Subscriber.next
../src/internal/Subscriber.ts (75:12)
eval
../src/internal/Subject.ts (68:20)
errorContext
../src/internal/util/errorContext.ts (29:5)
Subject.next
../src/internal/Subject.ts (61:17)
ReplaySubject.next
../src/internal/ReplaySubject.ts (65:15)
Object.next
node_modules/@ag-ui/client/dist/index.mjs (6:969)
ConsumerObserver.next
../src/internal/Subscriber.ts (161:25)
Subscriber._next
../src/internal/Subscriber.ts (119:22)
Subscriber.next
../src/internal/Subscriber.ts (75:12)
eval
../src/internal/operators/switchMap.ts (115:42)
OperatorSubscriber._this._next
../src/internal/operators/OperatorSubscriber.ts (70:13)
Subscriber.next
../src/internal/Subscriber.ts (75:12)
eval
node_modules/@ag-ui/client/dist/index.mjs (4:8724)
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.