Skip to content

chat: Add source attribution to agent responses - #453

Open
Logan Ramos (lramos15) wants to merge 1 commit into
mainfrom
lramos15/response-attribution
Open

Logan Ramos (lramos15) wants to merge 1 commit into
mainfrom
lramos15/response-attribution

Conversation

@lramos15

@lramos15 Logan Ramos (lramos15) commented Sep 16, 2026

Copy link
Copy Markdown
Member

Problem

An agent may base an answer on web pages, files, or documents. AHP currently has no shared way to connect those sources to the parts of the answer they support. That information should remain available when another client joins, reconnects, or loads older turns.

Closes #452.

What changed

  • Added an optional attribution response part. It points to an earlier Markdown or reasoning part and lists supporting sources and text ranges.
  • Kept the existing streaming flow: send the answer first, then append attribution with chat/responsePart before ending the turn. No new command or action is needed.
  • Added optional source titles, URIs, short quotations, and text or page locations. Sources do not have to be public URLs or local files.
  • Defined how identifiers, UTF-16 positions, overlapping ranges, turn resume, and unknown location kinds behave.
  • Regenerated the schemas and client types, updated client part-ID handling, and added shared round-trip and reducer tests.
  • Added a plain-English guide and a changelog fragment.

Compatibility and scope

Clients can ignore attribution and continue showing the original answer. The data stays in chat state for snapshots and history. It does not grant access to a source or claim that the answer has been independently verified.

The change is not tied to a particular agent, model, harness, or search tool. Search planning, live search progress, ranking, and citation/source-panel UI are not included. No protocol or package version was changed.

Validation

All passed:

  • npm run generate
  • npm test (459 tests; 100% reducer branch coverage)
  • npm run docs:build
  • TypeScript client tests and build
  • Rust formatting, Clippy, workspace tests, and typed attribution round trips
  • Swift package tests
  • Go client tests and go vet
  • Kotlin client tests using an isolated JDK 17 container
  • .NET solution formatting, Release build, and all 543 tests using an isolated .NET 10 SDK, .NET 8 runtime, and Node 24 container

The shared fixtures cover attribution after streaming, Unicode and multi-line ranges, overlapping spans, whole-answer attribution, history loading, cancellation, error/resume, snapshots, and unknown source-location kinds.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Keep supporting sources and text ranges in chat state so clients can display citations after streaming and recover them from snapshots and history. Add provider-neutral text and page locations, documentation, generated client types, and shared conformance tests.\n\nRefs #452.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support source attribution in agent responses

2 participants