-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
I am back from the leave and trying to catch up with most recent changes in the A2A project. While doing that, I've focused on exception handling.
I've noticed that A2AEventStreamResult.A2AEventStreamResult
does not perform any exception handling.
Since it was the first time I was using SSE ever, I've asked Copilot about the best practices:

It has suggested to add a bunch of headers and I can see that some of our repos use it:
Lines 33 to 39 in b568259
context.Response.ContentType = "text/event-stream"; | |
context.Response.Headers.CacheControl = "no-cache,no-store"; | |
context.Response.Headers.Pragma = "no-cache"; | |
// Make sure we disable all response buffering for SSE | |
var bufferingFeature = context.Features.GetRequiredFeature<IHttpResponseBodyFeature>(); | |
bufferingFeature.DisableBuffering(); |
@DamianEdwards should we also do that? And moreover, should we also ignore OperationCanceledException
and treat it as end of streaming as suggested by LLM? And emit error and close events as it suggested below?

@DamianEdwards I was not able to find any high quality docs about best practices for that which makes it impossible for me to say whether LLM is hallucinating or telling the truth.