honcho/tests/routes
Eugene Eisenstein 7b3d331846 feat(dialectic): return the evidence a chat answer was built from
Add an opt-in `include_evidence` to both chat endpoints. The response then
carries the conclusions and messages the agent read while answering, plus the
tools it called.

Evidence is collated from what the agent accessed rather than reported by the
model. That over-reports -- a conclusion appears because the agent saw it, not
as proof the answer used it -- but it is deterministic, costs no model tokens,
and behaves the same at every reasoning level. Asking the model to cite its
sources fails quietly instead: weaker models produce incomplete or invented
citations, and a sparse citation list is indistinguishable from a sparse
answer. The prefetch already makes the point, feeding explicit conclusions
into the prompt without their IDs, so the model could not cite them if asked.

An accumulator is threaded from the router through the agent into ToolContext,
and read handlers hand it the rows they already loaded. Nothing is re-queried
when the response is built, so evidence inherits the scoping of the reads that
produced it and cannot become a way around a session allowlist.

Three details worth knowing:

- Prefetched conclusions never pass through the tool executor, so they are
  captured via a new `documents_out` sink on `search_memory`. On a query that
  answers without a tool call they are the whole of what was read.
- Conclusions dedupe by ID. `Representation`'s own deduplication keys on
  content and timestamp and ignores IDs, which would collapse distinct
  conclusions that happen to read alike.
- Conclusion timestamps are re-stamped UTC. `Representation` strips tzinfo so
  observations render compactly into prompts, which would otherwise put naive
  timestamps in the API beside timezone-aware message ones.

The two chat routes had byte-identical nested SSE formatters; they now share
one helper, so the terminal event carries evidence on both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 13:19:10 -04:00
..
__init__.py [0.0.10] Release 2024-07-25 13:45:27 -04:00
test_auth_route_policy.py Fix scoped JWTs (#679) 2026-06-22 17:30:00 -04:00
test_conclusions.py fix(filter): make the filter DSL reject bad input instead of 500ing, and fix negation over unset fields (#947) 2026-08-13 10:39:19 -04:00
test_dialectic_evidence.py feat(dialectic): return the evidence a chat answer was built from 2026-09-03 13:19:10 -04:00
test_files.py fix(files): handle empty json uploads safely (#434) 2026-03-18 18:36:34 -04:00
test_keys.py feat: honcho 3.0, sdks 2.0, excise stainless, update v3 docs, changelogs (#331) 2026-01-22 15:16:28 -05:00
test_messages.py feat(llm backend): enable combined tool calling + structured output in the LLM backend transport layer (#907) 2026-07-15 11:47:49 -04:00
test_peers.py feat(dialectic): optional structured outputs with limited schema for Dialectic calls (#896) 2026-07-20 18:46:49 -04:00
test_queue_status.py Refactor clients.py to add modern features and more flexible configuration (#459) 2026-04-20 02:46:37 -04:00
test_scope_reads.py feat: Add workspace-level chat (#931) 2026-08-24 15:54:23 -04:00
test_scope_route_policy.py Scopes Phase 2b: `scope` option on chat, representation, context, and search (#897) 2026-08-12 18:34:55 -04:00
test_scoped_api.py Fix scoped JWTs (#679) 2026-06-22 17:30:00 -04:00
test_scopes.py Scopes Phase 2a: scope-kind peers, guardrails, and scopes CRUD routes (#884) 2026-08-12 16:21:40 -04:00
test_sessions.py Scopes Phase 2b: `scope` option on chat, representation, context, and search (#897) 2026-08-12 18:34:55 -04:00
test_validation_api.py Align API contract with DB contract for IDs (#684) 2026-05-14 16:37:39 -04:00
test_webhooks.py feat: honcho 3.0, sdks 2.0, excise stainless, update v3 docs, changelogs (#331) 2026-01-22 15:16:28 -05:00
test_workspaces.py Session-purity invariant + card_refresh dream type (DEV-2000) (#883) 2026-07-23 14:22:07 -04:00