Skip to content

fix(memory): batch-wrap create_observation and remove observation auto-creation#90

Open
ryanrishi wants to merge 3 commits into
mainfrom
fix-create-observation
Open

fix(memory): batch-wrap create_observation and remove observation auto-creation#90
ryanrishi wants to merge 3 commits into
mainfrom
fix-create-observation

Conversation

@ryanrishi

Copy link
Copy Markdown
Member

Summary

Two related fixes to the Conversation Memory observation flow (Python parity for twilio/twilio-agent-connect-typescript#81):

  1. create_observation() sent an unwrapped body. The Observations endpoint is a batch-create API expecting {"observations": [ { ... } ]}, but the method posted a single observation at the top level. It also only included occurredAt when the caller passed it. The body is now wrapped in an observations array, and occurredAt defaults to the current UTC time (ISO 8601) when omitted. The method stays public.

  2. Removed internal post-conversation observation auto-creation. Per a product decision, TAC no longer mechanically creates observations after conversations end. Removed the observation dispatch branch in _process_operator_result, the _process_observation_event method, and its _parse_observations_content helper. An operator result matching neither summary nor the (former) observation operator now skips as unconfigured. The summary path is fully intact.

observation_operator_sid on ConversationIntelligenceConfig is retained (GA, no breaking change) but is now accepted-and-ignored, with a deprecation note in its description.

Type of Change

  • Bug fix
  • Refactoring

Checklist

  • Tests added/updated
  • Documentation updated

SDK Parity

This is the Python SDK parity fix for twilio/twilio-agent-connect-typescript#81.

🤖 Generated with Claude Code

ryanrishi and others added 2 commits July 21, 2026 16:05
The Observations endpoint is a batch-create API expecting
{"observations": [ ... ]}, but create_observation posted a single
observation at the top level. Wrap the observation in an observations
array and default occurredAt to the current time when the caller omits
it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ation

Per a product decision, TAC no longer creates observations after
conversations end. Remove the observation dispatch branch in
_process_operator_result, the _process_observation_event method, and its
_parse_observations_content helper. The summary path is unchanged.

observation_operator_sid remains accepted for backward compatibility but
is now ignored; its docstring notes the deprecation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 21, 2026 20:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Fixes the Conversation Memory observation flow by aligning create_observation() with the batch-create API contract and removing post-conversation observation auto-creation from the intelligence event processor.

Changes:

  • Wrap create_observation() request bodies in an observations array and default occurredAt when omitted.
  • Remove observation operator parsing/dispatching from OperatorResultProcessor and adjust tests accordingly.
  • Deprecate (accept-but-ignore) observation_operator_sid in config docs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test_profile_retrieval.py Adds HTTP-level tests asserting create_observation() payload wrapping and default timestamp behavior.
tests/test_intelligence.py Removes observation parsing/creation tests and updates processor tests to reflect observation auto-creation removal.
src/tac/intelligence/operator_result_processor.py Removes observation parsing/dispatch path and updates docs/logic to only create summaries.
src/tac/core/config.py Deprecates observation_operator_sid via description update while keeping field for compatibility.
src/tac/context/memory.py Fixes create_observation() payload shape and defaults occurredAt to current UTC time.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tac/context/memory.py Outdated
Comment thread src/tac/intelligence/operator_result_processor.py Outdated
Comment thread src/tac/intelligence/operator_result_processor.py Outdated
Comment thread src/tac/context/memory.py Outdated
- create_observation: default occurred_at only when it is None (via an
  explicit is-None check) so a caller-supplied falsy value such as an
  empty string is preserved.
- create_observation: reword the content docstring to describe an
  observation as an extracted fact/note, not summary text.
- operator result processor: distinguish an unconfigured summary
  operator SID (clearer skip reason) from a configured SID that doesn't
  match the operator.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.

2 participants