Fabio A.
Fabio A.5w ago

Obtaining stream failure from AI Agent

Hi all, I'm building using the AI Agent Component and part of what I want to do is show the user the reason for a stream failure. I can see that when I go to the agent component, there's a streamingMessages table that contains the state which (when aborted) contains an object like this:
{
kind: "aborted",
reason: "user_aborted"
}
{
kind: "aborted",
reason: "user_aborted"
}
I'd like for an API to exist for me to be able to query this status, but I'm not sure how I'd go about doing this as there's no documentation and I can't find a method that extracts this state. Any help is greatly appreciated.
6 Replies
Convex Bot
Convex Bot5w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
Fabio A.
Fabio A.OP5w ago
No description
ian
ian4w ago
Hey Fabio - btw there's an #agents
ian
ian4w ago
You can fetch more message statues in the syncStreams call. You can also call listStreams that you can import from the library https://github.com/get-convex/agent/blob/ai-sdk-v5/src/client/streaming.ts#L94
GitHub
agent/src/client/streaming.ts at ai-sdk-v5 · get-convex/agent
Build AI agents on Convex with persistent chat history - get-convex/agent
ian
ian4w ago
I also want to persist stream errors as full-on failed messages in the regular thread so this isn't necessary - but that is work in progress
Fabio A.
Fabio A.OP4w ago
Oh my bad there Ohhh, well thank you very much. I'll implement this soon

Did you find this page helpful?