Skip to content

chore: release main#461

Merged
stainless-app[bot] merged 4 commits into
mainfrom
release-please--branches--main--changes--next
Jul 14, 2026
Merged

chore: release main#461
stainless-app[bot] merged 4 commits into
mainfrom
release-please--branches--main--changes--next

Conversation

@stainless-app

@stainless-app stainless-app Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

✨ Stainless prepared a new release

agentex-client: 0.19.0

0.19.0 (2026-07-14)

Full Changelog: agentex-client-v0.18.0...agentex-client-v0.19.0

Features

  • tracing: emit token usage on spans for SGP billing (#458) (7d19ada)

Bug Fixes

  • internal: resolve build failures (9245b70)
  • tracing: capture span body exceptions and export SGP status=ERROR (#460) (6c23d76)
agentex-sdk: 0.19.0

0.19.0 (2026-07-14)

Full Changelog: agentex-sdk-v0.18.0...agentex-sdk-v0.19.0

Chores

  • agentex-sdk: Synchronize agentex versions

This pull request is managed by Stainless's GitHub App.

The semver version number is based on included commit messages. Alternatively, you can manually set the version number in the title of this pull request.

For a better experience, it is recommended to use either rebase-merge or squash-merge when merging this pull request.

🔗 Stainless website
📚 Read the docs
🙋 Reach out for help or questions

Greptile Summary

This is a release PR bumping both agentex-client and agentex-sdk from 0.18.0 to 0.19.0, shipping two features and a build fix: (1) token usage is now emitted on spans for SGP billing via a new TurnSpan / turn_span() helper and per-call usage injection into LiteLLM and TemporalStreamingModel spans; (2) span body exceptions are now captured and exported as SGPStatus=ERROR.

  • Token usage on spans: New TurnSpan wraps rollup usage into span.data["usage"]; per-call spans get usage via span.output["usage"] from LiteLLM and the TemporalStreamingModel. A _stream_kwargs_with_usage helper enables stream_options.include_usage for litellm streaming, and concat_completion_chunks is fixed with zip_longest so usage-only final chunks (empty choices) are no longer dropped.
  • Span error capture: Trace.span() / AsyncTrace.span() now call set_span_error(span, exc) on exception; _build_sgp_span reads the stored error and calls sgp_span.set_error() to propagate status=ERROR to SGP.
  • Build fix: TemporalTracingModelProvider and related classes (superseded by TemporalStreamingModel) are deleted, resolving pyright build failures; scripts/lint is updated to pass -p . explicitly.

Confidence Score: 5/5

Safe to merge — all changes are well-scoped billing/observability additions with thorough test coverage and no modifications to core workflow or data-path logic.

The PR introduces token usage recording on spans and span-level error capture. Both features follow the existing reserved-key convention in span.data, are no-ops when tracing is disabled, and are covered by dedicated unit tests. The concat_completion_chunks zip_longest fix is correct and tested. The deleted TemporalTracingModelProvider was a build-failure source; its removal is clean. No auth, data mutation, or critical control-flow paths are touched.

No files require special attention — the key billing logic in TurnSpan.record_usage and the LiteLLM usage injection are each accompanied by tests that cover the happy path, the opt-out path, and the no-usage fallback.

Important Files Changed

Filename Overview
src/agentex/lib/adk/_modules/tracing.py Adds TurnSpan class and turn_span() context manager for recording per-turn aggregate usage in span.data for SGP billing; includes validation, warnings, and no-op behavior when tracing is disabled.
src/agentex/lib/core/services/adk/providers/litellm.py Adds _stream_kwargs_with_usage() to enable include_usage on streaming calls; injects completion.usage into span.output for both auto-send and stream paths; fixes chunk accumulation to capture usage-only final chunks before the choices guard.
src/agentex/lib/core/tracing/span_error.py New module with set_span_error/get_span_error helpers storing exception info under data["error"]; no-ops on list-shaped data, consistent with _add_source_to_span conventions.
src/agentex/lib/core/tracing/trace.py Both Trace.span() and AsyncTrace.span() now catch exceptions, call set_span_error(), and re-raise; enables SGP status=ERROR export.
src/agentex/lib/core/tracing/processors/sgp_tracing_processor.py _build_sgp_span now calls get_span_error() and forwards error_type/error_message to sgp_span.set_error(), mapping captured exceptions to SGP status=ERROR.
src/agentex/lib/utils/completions.py concat_completion_chunks now uses zip_longest instead of zip for merging choices, preserving choices from a non-empty side when the other side is empty (e.g., usage-only final chunk with choices=[]).
src/agentex/lib/core/temporal/plugins/openai_agents/models/temporal_tracing_model.py File deleted — TemporalTracingModelProvider and related classes removed as they were superseded by TemporalStreamingModel; resolves pyright build failures.
src/agentex/lib/core/temporal/plugins/openai_agents/models/temporal_streaming_model.py TemporalStreamingModel now captures ResponseCompletedEvent usage and writes it to span.output["usage"]; zero-usage fallback retained for error paths where the stream ends without a completed event.

Reviews (3): Last reviewed commit: "chore: release main" | Re-trigger Greptile

#460)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@stainless-app stainless-app Bot force-pushed the release-please--branches--main--changes--next branch from 4266454 to bc499ed Compare July 13, 2026 18:45
@stainless-app stainless-app Bot force-pushed the release-please--branches--main--changes--next branch from bc499ed to 98f58e1 Compare July 14, 2026 14:19
@stainless-app stainless-app Bot merged commit 90ca889 into main Jul 14, 2026
71 checks passed
@stainless-app stainless-app Bot deleted the release-please--branches--main--changes--next branch July 14, 2026 21:29
@stainless-app

stainless-app Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@stainless-app

stainless-app Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants