Returning a plain response from onChatMessage triggers nothing with no error messages
I have this in onChatMessage:
const lastMessage = this.messages.slice(-1);
if (lastMessage[0].content === "hardcoded") {
return new Response("hello");
}
// stream response
This does not trigger anything with no errors visible
Hmm, we should make this experience better...
hey @threepointone !
I am trying to implement agents but without streaming - is it currently possible with agents-sdk? current way of doing is hacking around onChatMessage like this:
return new Response(0:"${agentResp.response}"\n);
but I still have to call onFinish somewhere or else the message won't persist, so kinda hardcoding the params.
FYI I'm doing this because I am generating the response as a part of a structured output - AFAIK theres no way to stream that?
ex.
experimental_output: Output.object({
schema: z.object({
response: z.string(), // this is the response that gets returned back to the us
emotionReasoning: z.string(), // these get stored in DB
emotion: z.string(),
})
});
@jcheese1 this has been amended, you will have a proper message now, let me know if we are good to close it