Skip to content

release: 0.12.0#350

Open
stainless-app[bot] wants to merge 6 commits into
mainfrom
release-please--branches--main--changes--next
Open

release: 0.12.0#350
stainless-app[bot] wants to merge 6 commits into
mainfrom
release-please--branches--main--changes--next

Conversation

@stainless-app
Copy link
Copy Markdown
Contributor

@stainless-app stainless-app Bot commented May 8, 2026

Automated Release PR

0.12.0 (2026-05-11)

Full Changelog: v0.11.0...v0.12.0

⚠ BREAKING CHANGES

  • remove AgentexTracingProcessor from default tracing processors (#349)

Features

  • internal/types: support eagerly validating pydantic iterators (2c528c6)
  • remove AgentexTracingProcessor from default tracing processors (#349) (73eca7a)

Bug Fixes

  • client: add missing f-string prefix in file type error message (dcb1cb4)
  • render .env.example template in agentex init (#351) (6092595)
  • tracing: make SGP processor stateless to stop dropping span closes (#354) (5e9f28d)
  • wire SGP_CLIENT_BASE_URL and silence openai-agents tracer in templates (#352) (870324e)

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

  • Makes SGPSyncTracingProcessor and SGPAsyncTracingProcessor stateless by replacing the per-instance _spans dict with an idempotent _build_sgp_span helper; fixes dropped span-close events in cross-pod Temporal scenarios. Also removes AgentexTracingProcessorConfig as a default tracing processor (breaking change).
  • Adds EagerIterable / _EagerIterable pydantic custom type that eagerly consumes any Iterable input (including generators), preserving the original container type for validation while always emitting a list during serialisation — fixing the pydantic generator-exhaustion bug.
  • Wires SGP_CLIENT_BASE_URL into the two openai-agents templates and silences the openai-agents SDK's native tracer via set_tracing_disabled(True) to prevent traces from leaking to api.openai.com.

Confidence Score: 4/5

Safe to merge with one fix: the temporal-openai-agents template should guard add_tracing_processor_config behind a credentials check like the sibling template does.

One P1 finding: workflow.py.j2 calls add_tracing_processor_config unconditionally, initialising SGPClient even with empty credentials, while the sibling acp.py.j2 correctly guards the call. All other changes (stateless processor refactor, EagerIterable, f-string fix, template env-var wiring) are well-implemented and covered by tests.

src/agentex/lib/cli/templates/temporal-openai-agents/project/workflow.py.j2

Important Files Changed

Filename Overview
src/agentex/lib/cli/templates/temporal-openai-agents/project/workflow.py.j2 Adds set_tracing_disabled(True) and sgp_base_url; add_tracing_processor_config is still called unconditionally unlike the guarded pattern in the sibling acp.py.j2 template
src/agentex/lib/core/tracing/processors/sgp_tracing_processor.py Stateless refactor: removes per-span _spans dict and replaces with idempotent _build_sgp_span helper; sync processor lacks explicit self.disabled guard but delegates to tracing.init(disabled=True)
src/agentex/lib/cli/templates/sync-openai-agents/project/acp.py.j2 Adds set_tracing_disabled(True) and sgp_base_url; correctly guards add_tracing_processor_config with if SGP_API_KEY and SGP_ACCOUNT_ID
src/agentex/_models.py Adds EagerIterable / _EagerIterable Pydantic custom type that eagerly consumes iterables, preserves original container types, and avoids the generator-exhaustion bug in Pydantic V2
src/agentex/lib/core/tracing/tracing_processor_manager.py Removes AgentexTracingProcessorConfig default and its lazy-init wrapper; breaking change aligned with the PR description
tests/lib/core/tracing/processors/test_sgp_tracing_processor.py Test suite rewritten for stateless processor: verifies no _spans dict exists, two flushes per span lifecycle, and correct behavior when END arrives without a prior START
tests/test_models.py Adds parametrized tests for EagerIterable covering list, tuple, set, iterator, generator, map, frozenset, deque, and the special str-falls-back-to-list case
src/agentex/_files.py Adds missing f prefix to f-string in file type error message; one-line bug fix

Sequence Diagram

sequenceDiagram
    participant Agent
    participant SyncProcessor as SGPSyncTracingProcessor
    participant AsyncProcessor as SGPAsyncTracingProcessor
    participant SGPBackend as SGP Backend

    Note over SyncProcessor,AsyncProcessor: Stateless — no _spans dict

    Agent->>SyncProcessor: on_span_start(span)
    SyncProcessor->>SyncProcessor: _build_sgp_span(span) → set start_time
    SyncProcessor->>SGPBackend: "flush(blocking=False)"

    Agent->>SyncProcessor: on_span_end(span)
    SyncProcessor->>SyncProcessor: _build_sgp_span(span) → set start_time + end_time
    SyncProcessor->>SGPBackend: "flush(blocking=False)"

    Agent->>AsyncProcessor: on_spans_start([span1, span2])
    AsyncProcessor->>AsyncProcessor: [_build_sgp_span(s) for s in spans]
    AsyncProcessor->>SGPBackend: upsert_batch(items) — 1 HTTP call

    Agent->>AsyncProcessor: on_spans_end([span1, span2])
    AsyncProcessor->>AsyncProcessor: build spans + set end_time
    AsyncProcessor->>SGPBackend: upsert_batch(items) — 1 HTTP call

    Note over AsyncProcessor,SGPBackend: Cross-pod Temporal: END with no prior START still upserts complete span
Loading

Comments Outside Diff (1)

  1. src/agentex/lib/cli/templates/temporal-openai-agents/project/workflow.py.j2, line 42-50 (link)

    P1 The tracing processor is registered unconditionally even when SGP_API_KEY and SGP_ACCOUNT_ID are absent, whereas the sibling acp.py.j2 template correctly guards the call. With empty credentials SGPSyncTracingProcessor still calls tracing.init(SGPClient(api_key="", …)) — constructing a client and initialising the tracing subsystem — before the disabled=True flag suppresses flushes. Users who generate this template without SGP credentials will still hit that initialisation path on every import.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/agentex/lib/cli/templates/temporal-openai-agents/project/workflow.py.j2
    Line: 42-50
    
    Comment:
    The tracing processor is registered unconditionally even when `SGP_API_KEY` and `SGP_ACCOUNT_ID` are absent, whereas the sibling `acp.py.j2` template correctly guards the call. With empty credentials `SGPSyncTracingProcessor` still calls `tracing.init(SGPClient(api_key="", …))` — constructing a client and initialising the tracing subsystem — before the `disabled=True` flag suppresses flushes. Users who generate this template without SGP credentials will still hit that initialisation path on every import.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.

    Fix in Cursor Fix in Claude Code Fix in Codex

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.

---

### Issue 1 of 1
src/agentex/lib/cli/templates/temporal-openai-agents/project/workflow.py.j2:42-50
The tracing processor is registered unconditionally even when `SGP_API_KEY` and `SGP_ACCOUNT_ID` are absent, whereas the sibling `acp.py.j2` template correctly guards the call. With empty credentials `SGPSyncTracingProcessor` still calls `tracing.init(SGPClient(api_key="", …))` — constructing a client and initialising the tracing subsystem — before the `disabled=True` flag suppresses flushes. Users who generate this template without SGP credentials will still hit that initialisation path on every import.

```suggestion
SGP_API_KEY = os.environ.get("SGP_API_KEY", "")
SGP_ACCOUNT_ID = os.environ.get("SGP_ACCOUNT_ID", "")
SGP_CLIENT_BASE_URL = os.environ.get("SGP_CLIENT_BASE_URL", "")

# Setup tracing for SGP (Scale GenAI Platform)
# This enables visibility into your agent's execution in the SGP dashboard
if SGP_API_KEY and SGP_ACCOUNT_ID:
    add_tracing_processor_config(
        SGPTracingProcessorConfig(
            sgp_api_key=SGP_API_KEY,
            sgp_account_id=SGP_ACCOUNT_ID,
            sgp_base_url=SGP_CLIENT_BASE_URL,
        )
    )
```

Reviews (5): Last reviewed commit: "release: 0.12.0" | Re-trigger Greptile

@stainless-app stainless-app Bot force-pushed the release-please--branches--main--changes--next branch from cac40be to c646eb3 Compare May 8, 2026 18:27
…plates (#352)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@stainless-app stainless-app Bot force-pushed the release-please--branches--main--changes--next branch from c646eb3 to 7ad5b19 Compare May 8, 2026 19:01
@stainless-app stainless-app Bot force-pushed the release-please--branches--main--changes--next branch from 7ad5b19 to 5eaf474 Compare May 8, 2026 21:16
@stainless-app stainless-app Bot changed the title release: 0.11.1 release: 0.12.0 May 8, 2026
@stainless-app stainless-app Bot force-pushed the release-please--branches--main--changes--next branch from 5eaf474 to ec02cb4 Compare May 8, 2026 21:16
@stainless-app stainless-app Bot force-pushed the release-please--branches--main--changes--next branch from ec02cb4 to 6d194bb Compare May 11, 2026 21:24
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.

2 participants