Skip to content

Commit bc44436

Browse files
Merge branch 'next' into maxparke/agx1-418-build-provenance-capture
2 parents 4fd94eb + 152bc75 commit bc44436

82 files changed

Lines changed: 2104 additions & 528 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
lint:
1919
timeout-minutes: 10
2020
name: lint
21-
runs-on: ${{ github.repository == 'stainless-sdks/agentex-sdk-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
21+
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
2222
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
2323
steps:
2424
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -44,7 +44,7 @@ jobs:
4444
permissions:
4545
contents: read
4646
id-token: write
47-
runs-on: ${{ github.repository == 'stainless-sdks/agentex-sdk-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
47+
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
4848
steps:
4949
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5050

@@ -87,7 +87,7 @@ jobs:
8787
test:
8888
timeout-minutes: 10
8989
name: test
90-
runs-on: ${{ github.repository == 'stainless-sdks/agentex-sdk-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
90+
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
9191
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
9292
steps:
9393
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.release-please-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
".": "0.18.0",
3-
"adk": "0.18.0"
2+
".": "0.20.0",
3+
"adk": "0.20.0"
44
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 74
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp/agentex-sdk-f3f1b47fa785a0d7b4e1cce1932a2ab0c0b6531d67d499e6188292ea2a00c9d8.yml
3-
openapi_spec_hash: 77044dc5774eb88f1541ebbe53b413a7
4-
config_hash: 5c4e326f797c879e72d6bf32fc1ea49d
1+
configured_endpoints: 75
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp/agentex-sdk-644a4ec06aa1f055c614cbef3379684819a4edd84eeb20d2fb29ae01663622a3.yml
3+
openapi_spec_hash: a6a4dc0c09691ac9783bf38e9653a464
4+
config_hash: 593e89b291976a5e84e4c3c3f8324354

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,30 @@
1212

1313
* **tracing:** emit OTel metrics for async span queue depth, batch drain, and SGP export success/failure (HTTP status labels). Disable SDK-side recording with ``AGENTEX_TRACING_METRICS=0``.
1414

15+
## 0.20.0 (2026-07-16)
16+
17+
Full Changelog: [agentex-client-v0.19.0...agentex-client-v0.20.0](https://github.com/scaleapi/scale-agentex-python/compare/agentex-client-v0.19.0...agentex-client-v0.20.0)
18+
19+
### Features
20+
21+
* **api:** add interrupt task ([936a2b1](https://github.com/scaleapi/scale-agentex-python/commit/936a2b1d28a5409bd7548d59b0f18491495c805b))
22+
* **api:** add task/interrupt method and INTERRUPTED status to agents/tasks ([4f1c093](https://github.com/scaleapi/scale-agentex-python/commit/4f1c09348c2ddffeb8c78738fb9b7aa14ed4b752))
23+
* **interrupt:** task/interrupt hook + protocol + resume-safe session capture (AGX1-391) ([#462](https://github.com/scaleapi/scale-agentex-python/issues/462)) ([eaa3dd5](https://github.com/scaleapi/scale-agentex-python/commit/eaa3dd526b88c454fc604d0e617f7191b66952bb))
24+
25+
## 0.19.0 (2026-07-14)
26+
27+
Full Changelog: [agentex-client-v0.18.0...agentex-client-v0.19.0](https://github.com/scaleapi/scale-agentex-python/compare/agentex-client-v0.18.0...agentex-client-v0.19.0)
28+
29+
### Features
30+
31+
* **tracing:** emit token usage on spans for SGP billing ([#458](https://github.com/scaleapi/scale-agentex-python/issues/458)) ([7d19ada](https://github.com/scaleapi/scale-agentex-python/commit/7d19ada2db5d1eca5268a10fe04dfc85a367cf7f))
32+
33+
34+
### Bug Fixes
35+
36+
* **internal:** resolve build failures ([9245b70](https://github.com/scaleapi/scale-agentex-python/commit/9245b700ceee95be9a0c478e518d9c06228d4b9f))
37+
* **tracing:** capture span body exceptions and export SGP status=ERROR ([#460](https://github.com/scaleapi/scale-agentex-python/issues/460)) ([6c23d76](https://github.com/scaleapi/scale-agentex-python/commit/6c23d7625ccf58ac9793dcf5219e4f7f4de38353))
38+
1539
## 0.18.0 (2026-07-10)
1640

1741
Full Changelog: [agentex-client-v0.17.0...agentex-client-v0.18.0](https://github.com/scaleapi/scale-agentex-python/compare/agentex-client-v0.17.0...agentex-client-v0.18.0)

adk/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## 0.20.0 (2026-07-16)
4+
5+
Full Changelog: [agentex-sdk-v0.19.0...agentex-sdk-v0.20.0](https://github.com/scaleapi/scale-agentex-python/compare/agentex-sdk-v0.19.0...agentex-sdk-v0.20.0)
6+
7+
### Chores
8+
9+
* **agentex-sdk:** Synchronize agentex versions
10+
11+
## 0.19.0 (2026-07-14)
12+
13+
Full Changelog: [agentex-sdk-v0.18.0...agentex-sdk-v0.19.0](https://github.com/scaleapi/scale-agentex-python/compare/agentex-sdk-v0.18.0...agentex-sdk-v0.19.0)
14+
15+
### Chores
16+
17+
* **agentex-sdk:** Synchronize agentex versions
18+
319
## 0.18.0 (2026-07-10)
420

521
Full Changelog: [agentex-sdk-v0.17.0...agentex-sdk-v0.18.0](https://github.com/scaleapi/scale-agentex-python/compare/agentex-sdk-v0.17.0...agentex-sdk-v0.18.0)

adk/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# (agentex/{__init__.py, _*.py, types/, resources/}) ships from the slim
55
# sibling package `agentex-client` which is pinned as a runtime dep.
66
name = "agentex-sdk"
7-
version = "0.18.0"
7+
version = "0.20.0"
88
description = "Agent Development Kit (ADK) overlay for the Agentex API — FastACP server, Temporal workflows, LLM provider integrations, observability"
99
license = "Apache-2.0"
1010
authors = [

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ Methods:
126126
- <code title="post /tasks/{task_id}/complete">client.tasks.<a href="./src/agentex/resources/tasks.py">complete</a>(task_id, \*\*<a href="src/agentex/types/task_complete_params.py">params</a>) -> <a href="./src/agentex/types/task.py">Task</a></code>
127127
- <code title="delete /tasks/name/{task_name}">client.tasks.<a href="./src/agentex/resources/tasks.py">delete_by_name</a>(task_name) -> <a href="./src/agentex/types/shared/delete_response.py">DeleteResponse</a></code>
128128
- <code title="post /tasks/{task_id}/fail">client.tasks.<a href="./src/agentex/resources/tasks.py">fail</a>(task_id, \*\*<a href="src/agentex/types/task_fail_params.py">params</a>) -> <a href="./src/agentex/types/task.py">Task</a></code>
129+
- <code title="post /tasks/{task_id}/interrupt">client.tasks.<a href="./src/agentex/resources/tasks.py">interrupt</a>(task_id, \*\*<a href="src/agentex/types/task_interrupt_params.py">params</a>) -> <a href="./src/agentex/types/task.py">Task</a></code>
129130
- <code title="get /tasks/{task_id}/query/{query_name}">client.tasks.<a href="./src/agentex/resources/tasks.py">query_workflow</a>(query_name, \*, task_id) -> <a href="./src/agentex/types/task_query_workflow_response.py">TaskQueryWorkflowResponse</a></code>
130131
- <code title="get /tasks/name/{task_name}">client.tasks.<a href="./src/agentex/resources/tasks.py">retrieve_by_name</a>(task_name, \*\*<a href="src/agentex/types/task_retrieve_by_name_params.py">params</a>) -> <a href="./src/agentex/types/task_retrieve_by_name_response.py">TaskRetrieveByNameResponse</a></code>
131132
- <code title="get /tasks/{task_id}/stream">client.tasks.<a href="./src/agentex/resources/tasks.py">stream_events</a>(task_id) -> object</code>

examples/tutorials/10_async/00_base/030_tracing/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,39 @@ await adk.tracing.end_span(
4141

4242
Spans create a hierarchical view of agent execution, making it easy to see which operations take time and where errors occur.
4343

44+
## Token Usage & Cost Tracking
45+
46+
Token usage on spans is what the backend bills from, and it reads two shapes:
47+
48+
- **Per-turn aggregate**`span.data["usage"]` + `span.data["cost_usd"]`. Emit at most
49+
once per turn, holding that turn's own usage (not a session-cumulative total). When a
50+
trace has an aggregate, the backend keeps it and de-dups all per-call spans against it.
51+
- **Per-call detail**`span.output["usage"]`. Optional; the SDK's LLM adapters
52+
(litellm, OpenAI Agents SDK, LangGraph) emit this automatically. Summed only when no
53+
aggregate exists in the trace.
54+
55+
Record the turn rollup with `adk.tracing.turn_span()` instead of hand-writing usage keys.
56+
It accepts the harness `TurnUsage` that every turn adapter reports (`LangGraphTurn.usage()`,
57+
`run_turn(...).usage`, `ClaudeCodeTurn.usage()`, ...), cost included:
58+
59+
```python
60+
async with adk.tracing.turn_span(
61+
trace_id=task.id,
62+
name="turn",
63+
input={"prompt": prompt},
64+
task_id=task.id,
65+
) as turn:
66+
result = await run_turn(...)
67+
turn.output = {"response": result.final_output}
68+
turn.record_usage(result.usage) # TurnUsage; cost_usd stamped automatically
69+
```
70+
71+
**Never put usage on both a rollup span's `output` and its per-call children's
72+
`output`** — that double-counts. `turn_span` writes the aggregate to `data`, so child
73+
spans stay safe to emit. Recognized token keys: `input_tokens`/`prompt_tokens`,
74+
`output_tokens`/`completion_tokens`, `cached_input_tokens`/`cached_tokens`,
75+
`reasoning_tokens`; cost is `cost_usd`.
76+
4477
## When to Use
4578
- Debugging complex agent behaviors
4679
- Performance optimization and bottleneck identification

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# overlay (formerly `src/agentex/lib/*`) now lives in `adk/` and ships
44
# as the sibling `agentex-sdk` package — see `adk/pyproject.toml`.
55
name = "agentex-client"
6-
version = "0.18.0"
6+
version = "0.20.0"
77
description = "The official Python REST client for the Agentex API"
88
dynamic = ["readme"]
99
license = "Apache-2.0"

scripts/lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ else
1313
fi
1414

1515
echo "==> Running pyright"
16-
uv run pyright
16+
uv run pyright -p .
1717

1818
echo "==> Making sure it imports"
1919
uv run python -c 'import agentex'

0 commit comments

Comments
 (0)