Skip to content

v0.11.8

Choose a tag to compare

@stainless-app stainless-app released this 01 Jun 23:22
2df25c7

0.11.8 (2026-06-01)

Full Changelog: v0.11.7...v0.11.8

Features

  • cli: add Temporal + LangGraph agent template and example (#383) (bbc9e02)
  • tracing: OTel span queue and export telemetry (SGPINF-1863) (#373) (6669012)

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 release (0.11.8) ships two features: a new Temporal + LangGraph agent template/example, and OTel span queue + export telemetry instrumentation.

  • Temporal + LangGraph template: Adds a full CLI template (temporal-langgraph) and a matching tutorial example. The template includes human-in-the-loop interrupt handling via Temporal signals, live introspection queries, and per-turn SGP tracing (correctly guarded by SGP_API_KEY / SGP_ACCOUNT_ID). A new emit_langgraph_messages ADK helper converts LangGraph message objects to Agentex content types.
  • OTel span queue telemetry: Adds tracing_metrics.py (instrument definitions) and tracing_metrics_recording.py (best-effort recording helpers) with bounded tag cardinality throughout. The recording path is disabled via AGENTEX_TRACING_METRICS=0 and swallows all exceptions so it is safe on hot paths. enqueued_at timestamps are correctly preserved through re-enqueues for accurate lag histograms.

Confidence Score: 5/5

Safe to merge — changes are additive, all tag values are bounded, and the recording helpers are exception-safe on hot paths.

Both features are purely additive. The tracing metrics are well-isolated behind a feature flag and best-effort exception handling. The LangGraph template correctly guards credential-dependent setup. No behavioral regressions are introduced in existing code paths.

src/agentex/lib/core/tracing/span_queue.py — the retry path silently re-enqueues failed items without emitting a failure metric, making transient errors invisible until retries are exhausted.

Important Files Changed

Filename Overview
src/agentex/lib/core/tracing/span_queue.py Adds OTel instrumentation across enqueue, batch-drain, and shutdown paths. enqueued_at timestamp is correctly preserved through re-enqueues. record_export_failure is only called for permanently-dropped spans (exhausted retries or non-retriable errors), leaving transient failures unobservable in metrics.
src/agentex/lib/core/observability/tracing_metrics.py New file: defines the OTel instrument set for span queue + export telemetry. All tag cardinalities are explicitly bounded. Singleton is created lazily via get_tracing_metrics().
src/agentex/lib/core/observability/tracing_metrics_recording.py New file: best-effort recording helpers that lazy-load the OTel SDK module. AGENTEX_TRACING_METRICS=0 disables all recording. All helpers silently swallow exceptions.
src/agentex/lib/core/tracing/processors/sgp_tracing_processor.py Adds record_export_success calls after successful upsert_batch on both on_spans_start and on_spans_end.
src/agentex/lib/adk/_modules/_langgraph_messages.py New helper converting LangGraph/LangChain message objects to Agentex content types after ainvoke. Handles both OpenAI and Anthropic content block formats.
src/agentex/lib/cli/templates/temporal-langgraph/project/workflow.py.j2 Full-featured Temporal+LangGraph template with human-in-the-loop, live queries, and properly guarded tracing setup.
examples/tutorials/10_async/10_temporal/130_langgraph/project/workflow.py Simplified example workflow with durable multi-turn state kept on the workflow instance.
tests/lib/core/tracing/test_span_queue.py New TestAsyncSpanQueueMetrics suite covering enqueue, drop, failure, and disabled-metrics fast-path scenarios.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant AsyncSpanQueue
    participant Metrics as tracing_metrics_recording
    participant Processor as SGPAsyncTracingProcessor
    participant SGP as SGP HTTP API

    Caller->>AsyncSpanQueue: enqueue(event_type, span, processors)
    AsyncSpanQueue->>Metrics: record_span_enqueued(event_type)
    Note over AsyncSpanQueue: stores enqueued_at timestamp

    AsyncSpanQueue->>AsyncSpanQueue: drain loop (linger_ms)
    AsyncSpanQueue->>Metrics: record_batch_coalesced(queue_depth, batch_items)

    AsyncSpanQueue->>Processor: on_spans_start / on_spans_end
    Processor->>SGP: upsert_batch(...)

    alt HTTP success
        SGP-->>Processor: 200 OK
        Processor->>Metrics: record_export_success(event_type, span_count, sgp)
    else Retriable failure (retries remaining)
        SGP-->>Processor: 5xx / network error
        Processor-->>AsyncSpanQueue: raises exception
        Note over AsyncSpanQueue: re-enqueues item, no metric emitted
    else Retries exhausted
        AsyncSpanQueue->>Metrics: record_export_failure(exhausted_count)
    else Permanent non-retriable failure
        AsyncSpanQueue->>Metrics: record_export_failure(all items)
    end

    AsyncSpanQueue->>Metrics: record_batch_phase(phase, size, duration_ms)

    Note over AsyncSpanQueue: on shutdown timeout
    AsyncSpanQueue->>Metrics: record_shutdown_timeout(remaining_items)

Fix All in Cursor Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.