Skip to content

feat(sdk): 59787 merge events#155

Open
namrataghadi-galileo wants to merge 10 commits intomainfrom
feature/59787-merge-events
Open

feat(sdk): 59787 merge events#155
namrataghadi-galileo wants to merge 10 commits intomainfrom
feature/59787-merge-events

Conversation

@namrataghadi-galileo
Copy link
Copy Markdown
Contributor

Summary

  • add an optional SDK-side merged-event path so local and server ControlExecutionEvents can be emitted together after evaluation
  • keep event generation separate from evaluation by reconstructing events after evaluation results are available, instead of sending full event payloads over the wire
  • reduce wire transfer for the merged path by keeping server evaluation responses focused on evaluation semantics and reconstructing server events in the SDK
  • preserve event identity consistency during reconstruction by using ControlDefinition.observability_identity() for composite conditions
  • add a merged-event sink interface in the SDK and a server-side merge-mode signal so the SDK can become the final emitter when needed

Behavior

  • default behavior remains unchanged: local events are reconstructed in the SDK and enqueued through the existing SDK observability pipeline, while server-side evaluation still builds and ingests its own events on the server
  • when a control event sink is registered, the SDK switches to the merged-event path: it reconstructs local and server events after evaluation, sends X-Agent-Control-Merge-Events: true to the server, and emits one merged batch through the registered sink
  • server-side merge mode skips final server ingestion but still returns the same evaluation semantics, so the SDK can merge results and reconstruct the final event batch locally
  • trace/span correlation is preserved in both paths through the tracing resolver and reconstructed control metadata

What changed

  • added shared SDK event reconstruction helpers in evaluation_events.py
  • updated evaluation.py to support:
  • local reconstruction + default enqueue path
  • optional merged-event sink path
  • SDK reconstruction of server events from the lean server response plus cached control definitions
  • added merged-event sink registration helpers in event_sink.py
  • updated server evaluation.py so the server:
  • still ingests events in the default path
  • skips final ingestion when X-Agent-Control-Merge-Events: true is set

Testing

  • SDK and server tests were updated to cover:
  • default local enqueue behavior
  • merged-event emission behavior
  • provider-backed trace/span propagation
  • server merge-mode skip-ingest behavior

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 93.84615% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
sdks/python/src/agent_control/evaluation_events.py 89.79% 5 Missing ⚠️
sdks/python/src/agent_control/evaluation.py 93.75% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant