Skip to content

.NET: Hosted agent streaming drops url_citation annotations (no response.output_text.annotation.added SSE emitted) #6926

Description

@graemefoster

Description

This would re-open #6641 - unfortunately the fix did not fix the problem.

The issue is the OutputConverter class has no case statement for SSEs from the LLM which look like this:

event: response.output_text.annotation.added
data: {"type":"response.output_text.annotation.added","annotation":{"type":"url_citation","end_index":221,"start_index":209,"title":"MO_Policy_KM_Agent_v3.2.docx","url":"https://search-knowledgebaseagent.search.windows.net/"},"annotation_index":1,"content_index":0,"item_id":"msg_02959b8381e6341a006a3b6a06c39c81958191aa20a92096b2","output_index":2,"sequence_number":48}

which follow something like this:
event: response.output_text.delta
data: {"type":"response.output_text.delta","content_index":0,"delta":"【5:4†source】\n\n","item_id":"msg_02959b8381e6341a006a3b6a06c39c81958191aa20a92096b2","logprobs":[],"obfuscation":"1i","output_index":2,"sequence_number":47}

The dotnet MAF agent only outputs the response.output_text.delta event. There's no reference to the url_citation.

Unfortunately when calling the AI Search tool we still don't see any response.output_text.annotation.added SSE events coming out of the hosted agent.

Code Sample

var search = FoundryAITool.CreateAzureAISearchTool(new AzureAISearchToolOptions(
[
    new AzureAISearchToolIndex()
    {
        ProjectConnectionId = "/...azure-ai-search-connection",
        IndexName = "mortgage-operations-kb"
    }
]));

ChatClientAgentOptions options = new()
{
    Name = "KnowledgeBaseAgentOTel",
    Description = "Mortgage Operations Knowledge Agent with toolbox-powered search",
    ChatOptions = new ChatOptions
    {
        ModelId = deployment,
        Instructions = instructions,
        Tools = [search]
    },
};

var agent = projectClient
    .AsAIAgent(options);

Error Messages / Stack Traces

No error - but the Hosted Agent does not emit response.output_text.annotation.added SSE events. The events do get returned from the LLM call to the Hosted Agent.

Package Versions

Microsoft.Agents.AI - 1.13.0

.NET Version

dotnet 10.

Additional Context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

.NETUsage: [Issues, PRs], Target: .NetreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions