athena-ptc-emitter
Stdlib-only PTC event emitter shared by Athena's sandboxed authoring
SDKs (athena-python-pptx, athena-python-docx, athena-openpyxl).
Each of those SDKs runs inside a Daytona sandbox spawned by Agora's
run_python_code tool, and emits begin/end events to the agora-side
PTC runtime so every
SDK method call surfaces as a nested sub-tool-card under the parent
run_python_code tool in Olympus.
Previously each SDK shipped its own byte-identical _ptc.py. This
package consolidates them so a bugfix can land in one place, in one
release, instead of being cp-ed across three packages with three
release pipelines and three Daytona snapshot rebuilds.
Usage
from athena_ptc_emitter import emit_begin, emit_end
call_id = emit_begin(
tool_name="CreateParagraph",
args={"text": "hello"},
asset_id="asset_abc123", # optional
)
# … do the actual operation …
emit_end(
call_id=call_id,
tool_name="CreateParagraph",
result={"ok": True},
is_error=False,
)
Behavior
- No-op when
ATHENA_PTC_URLis unset — running locally or in tests is silent.emit_beginstill returns a valid call-id so call sites don't have to branch on whether PTC is active. - Synchronous, best-effort. Each emit blocks for the duration of
one HTTP POST (sub-ms loopback, ~10ms over the network); transport
errors are swallowed. Synchronous-ness matters for the teardown
invariant — see the docstring of
_emitter._sendanddocs/plans/2026-05-14-ptc-flush-race.md. - Per-call URL snapshot. The URL is read at
emit_beginand stashed percall_idso a lateemit_endalways targets the begin-time URL, even if a new sandbox run replacedATHENA_PTC_URL. - 64 KB body cap with
{"__truncated__": true}substitution. - 2-second HTTP timeout with no retries.
Wire protocol
See docs/PROGRAMMATIC_TOOL_CALLING_GUIDE.md
at the monorepo root for the full begin/end JSON shape, the HMAC token
the URL carries, and the receiver side.
Source of truth
This package is published from python-sdk/athena-ptc-emitter/. The
three SDK consumers are:
pptx-studio/python-sdk/(pptx → published asathena-python-pptx)docx-studio/python-sdk/(docx → published asathena-python-docx)xlsx-studio/python-sdk/(openpyxl → published asathena-openpyxl)
Migration tracking — each SDK is cutover in a separate PR through that SDK's bump skill so each Daytona snapshot rebuild happens in isolation.
Release files for athena-ptc-emitter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| athena_ptc_emitter-0.1.0.tar.gz | 7.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| athena_ptc_emitter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.5 kB
Release files / athena_ptc_emitter-0.1.0.tar.gz
| Download URL | athena_ptc_emitter-0.1.0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dec649ba18e9b89fe2fb68b8492740102f079413be379d197763ff69ec93454f
|
|
BLAKE2b-256 checksum How to use checksums |
8db9a81286a62c5848a9929b12af0d98b3be34b3d6be34beb717d2bd4aa31cf4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / athena_ptc_emitter-0.1.0-py3-none-any.whl
| Download URL | athena_ptc_emitter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1f54a04a2907891f5293da313bedb6070355dd2b050ec5715d9b9fc65d928177
|
|
BLAKE2b-256 checksum How to use checksums |
a0fb54a4123fb6c66ca93dcc0490a68e8acba01eb8a5e0b78c875a5e76f9a2b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|