-
Notifications
You must be signed in to change notification settings - Fork 30
Description
I am not able to start conversations with agents that perform handoffs, because I get an error 500 back from the client.beta.conversations.start() function stating "Response failed during handoff orchestration" and "invalid_request_error". I have set up a one page script that simply runs the exact code given in the agent handoff documentation page, but still this does not work.
Here is the call I'm making to the conversations API:
client.beta.conversations.start({
agentId: agents.financeAgent.id,
inputs: [
{
role: "user",
content:
"Fetch the current US bank interest rate and calculate the compounded effect if investing for the next 10y",
},
],
//store:false
})
Note for when reproducing this behavior: I noticed that adding a period at the end of the prompt makes the agent not perform handoff at all.
I am running on v22.15.1 of Node, v1.10.0 of mistralai, and v3.25.76 of zod. I am currently using a free-tier API key.
Here is the debug messages that I am getting:
Agents initialized: {"financeAgent":{"instructions":null,"tools":[],"completionArgs":{"stop":null,"presencePenalty":null,"fre
quencyPenalty":null,"temperature":null,"topP":null,"maxTokens":null,"randomSeed":null,"prediction":null,"responseFormat":null
,"toolChoice":"auto"},"model":"mistral-large-latest","name":"finance-agent","description":"Agent used to answer financial rel
ated requests","handoffs":["ag_0199afa58ec87383bf19e98b34518a46","ag_0199afa58e00761a86c1d8636b4dd998"],"object":"agent","id"
:"ag_0199afa58c9b754ca6bae88c6ff47fde","version":1,"createdAt":"2025-10-04T14:34:46.306Z","updatedAt":"2025-10-04T14:34:47.58
2Z"}}
Starting new conversation with agentHandoffTestingAgentId: ag_0199afa58c9b754ca6bae88c6ff47fde
> Request: POST https://api.mistral.ai/v1/conversations
Headers:
accept: application/json
authorization: BEARER_TOKEN_CENSORED
content-type: application/json
cookie:
user-agent: mistral-client-typescript/1.10.0
Body:
{
inputs: [
{
object: 'entry',
type: 'message.input',
role: 'user',
content: 'Fetch the current US bank interest rate and calculate the compounded effect if investing for the next 10y
',
prefix: false
}
],
stream: false,
agent_id: 'ag_0199afa58c9b754ca6bae88c6ff47fde'
}
< Response: POST https://api.mistral.ai/v1/conversations
Status Code: 500 Internal Server Error
Headers:
access-control-allow-origin: *
alt-svc: h3=":443"; ma=86400
cf-cache-status: DYNAMIC
cf-ray: RAY_CENSORED
connection: keep-alive
content-length: 118
content-type: application/json
date: Sat, 04 Oct 2025 14:34:48 GMT
mistral-correlation-id: REQUEST_ID_CENSORED
server: cloudflare
set-cookie: COOKIE_CENSORED; path=/; expires=Sat, 04-Oct-25 15:04:48 GMT; domain=.m
istral.ai; HttpOnly; Secure; SameSite=None
set-cookie: COOKIE_CENSORED; path=/; domain=.mistral.
ai; HttpOnly; Secure; SameSite=None
strict-transport-security: max-age=15552000; includeSubDomains
x-envoy-upstream-service-time: 332
x-kong-proxy-latency: 4
x-kong-request-id: REQUEST_ID_CENSORED
x-kong-upstream-latency: 333
Body:
{
object: 'Error',
message: 'Response failed during handoff orchestration',
type: 'invalid_request_error',
code: 3000
}
C:\Users\flami\flareup\flareup-demo\node_modules\@mistralai\mistralai\lib\matchers.js:149
error: new sdkerror_js_1.SDKError("API error occurred", { request, response, body }),
^
SDKError: API error occurred: Status 500
Body: {"object":"Error","message":"Response failed during handoff orchestration","type":"invalid_request_error","code":3000}
at matchFunc (C:\Users\flami\flareup\flareup-demo\node_modules\@mistralai\mistralai\lib\matchers.js:149:28)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async $do (C:\Users\flami\flareup\flareup-demo\node_modules\@mistralai\mistralai\funcs\betaConversationsStart.js:112:2
2) {
statusCode: 500,
body: '{"object":"Error","message":"Response failed during handoff orchestration","type":"invalid_request_error","code":300
0}',
headers: Headers {},
contentType: 'application/json',
rawResponse: Response {
[Symbol(state)]: {
aborted: false,
rangeRequested: false,
timingAllowPassed: true,
requestIncludesCredentials: true,
type: 'default',
status: 500,
timingInfo: {
startTime: 2856.6437,
redirectStartTime: 0,
redirectEndTime: 0,
postRedirectStartTime: 2856.6437,
finalServiceWorkerStartTime: 0,
finalNetworkResponseStartTime: 3431.5876,
finalNetworkRequestStartTime: 2858.4939,
endTime: 3455.7825,
encodedBodySize: 118,
decodedBodySize: 118,
finalConnectionTimingInfo: {
domainLookupStartTime: 2856.6437,
domainLookupEndTime: 2856.6437,
connectionStartTime: 2856.6437,
connectionEndTime: 2856.6437,
secureConnectionStartTime: 2856.6437,
ALPNNegotiatedProtocol: undefined
}
},
cacheState: '',
statusText: 'Internal Server Error',
headersList: HeadersList {
cookies: [
'COOKIE_CENSORED; path=/; expires=Sat, 04-Oct-25 15:04:48 GMT; domain=.mistra
l.ai; HttpOnly; Secure; SameSite=None',
'COOKIE_CENSORED; path=/; domain=.mistral.ai; H
ttpOnly; Secure; SameSite=None'
],
[Symbol(headers map)]: Map(16) {
'date' => { name: 'date', value: 'Sat, 04 Oct 2025 14:34:48 GMT' },
'content-type' => { name: 'content-type', value: 'application/json' },
'content-length' => { name: 'content-length', value: '118' },
'connection' => { name: 'connection', value: 'keep-alive' },
'cf-ray' => { name: 'cf-ray', value: 'RAY_CENSORED' },
'mistral-correlation-id' => {
name: 'mistral-correlation-id',
value: 'REQUEST_ID_CENSORED'
},
'x-kong-request-id' => {
name: 'x-kong-request-id',
value: 'REQUEST_ID_CENSORED'
},
'x-envoy-upstream-service-time' => { name: 'x-envoy-upstream-service-time', value: '332' },
'access-control-allow-origin' => { name: 'access-control-allow-origin', value: '*' },
'x-kong-upstream-latency' => { name: 'x-kong-upstream-latency', value: '333' },
'x-kong-proxy-latency' => { name: 'x-kong-proxy-latency', value: '4' },
'cf-cache-status' => { name: 'cf-cache-status', value: 'DYNAMIC' },
'set-cookie' => {
name: 'set-cookie',
value: 'COOKIE_CENSORED; path=/; expires=Sat, 04-Oct-25 15:04:48 GMT; domai
n=.mistral.ai; HttpOnly; Secure; SameSite=None, COOKIE_CENSORED; path=/; domain=.mistral.ai; HttpOnly; Secure; SameSite=None'
},
'strict-transport-security' => {
name: 'strict-transport-security',
value: 'max-age=15552000; includeSubDomains'
},
'server' => { name: 'server', value: 'cloudflare' },
'alt-svc' => { name: 'alt-svc', value: 'h3=":443"; ma=86400' }
},
[Symbol(headers map sorted)]: [
[ 'access-control-allow-origin', '*' ],
[ 'alt-svc', 'h3=":443"; ma=86400' ],
[ 'cf-cache-status', 'DYNAMIC' ],
[ 'cf-ray', 'RAY_CENSORED' ],
[ 'connection', 'keep-alive' ],
[ 'content-length', '118' ],
[ 'content-type', 'application/json' ],
[ 'date', 'Sat, 04 Oct 2025 14:34:48 GMT' ],
[
'mistral-correlation-id',
'REQUEST_ID_CENSORED'
],
[ 'server', 'cloudflare' ],
[
'set-cookie',
'COOKIE_CENSORED; path=/; expires=Sat, 04-Oct-25 15:04:48 GMT; domain=.mist
ral.ai; HttpOnly; Secure; SameSite=None'
],
[
'set-cookie',
'COOKIE_CENSORED; path=/; domain=.mistral.ai;
HttpOnly; Secure; SameSite=None'
],
[
'strict-transport-security',
'max-age=15552000; includeSubDomains'
],
[ 'x-envoy-upstream-service-time', '332' ],
[ 'x-kong-proxy-latency', '4' ],
[
'x-kong-request-id',
'REQUEST_ID_CENSORED'
],
[ 'x-kong-upstream-latency', '333' ]
]
},
urlList: [ https://api.mistral.ai/v1/conversations ],
body: {
stream: ReadableStream {
constructor: [class ReadableStream] { from: [Function: from] },
[Symbol(kType)]: 'ReadableStream',
[Symbol(kState)]: [Object: null prototype] {
disturbed: true,
reader: [ReadableStreamDefaultReader],
state: 'closed',
storedError: undefined,
transfer: [Object: null prototype],
controller: [ReadableByteStreamController]
},
[Symbol(nodejs.webstream.isClosedPromise)]: {
promise: [Promise],
resolve: [Function (anonymous)],
reject: [Function (anonymous)]
}
},
source: null,
length: null
}
},
[Symbol(headers)]: Headers {}
}
}
Node.js v22.15.1
Is there something I am doing wrong? I can attach the script as well if needed.