Skip to main content

Stdlib-only PTC event emitter shared by Athena's sandboxed authoring SDKs (athena-python-pptx, athena-python-docx, athena-openpyxl)

Project description

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_URL is unset — running locally or in tests is silent. emit_begin still 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._send and docs/plans/2026-05-14-ptc-flush-race.md.
  • Per-call URL snapshot. The URL is read at emit_begin and stashed per call_id so a late emit_end always targets the begin-time URL, even if a new sandbox run replaced ATHENA_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 as athena-python-pptx)
  • docx-studio/python-sdk/ (docx → published as athena-python-docx)
  • xlsx-studio/python-sdk/ (openpyxl → published as athena-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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

athena_ptc_emitter-0.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

athena_ptc_emitter-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file athena_ptc_emitter-0.1.0.tar.gz.

File metadata

  • Download URL: athena_ptc_emitter-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for athena_ptc_emitter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dec649ba18e9b89fe2fb68b8492740102f079413be379d197763ff69ec93454f
MD5 9cc7c22522de16c417254040c46682a9
BLAKE2b-256 8db9a81286a62c5848a9929b12af0d98b3be34b3d6be34beb717d2bd4aa31cf4

See more details on using hashes here.

File details

Details for the file athena_ptc_emitter-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: athena_ptc_emitter-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for athena_ptc_emitter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f54a04a2907891f5293da313bedb6070355dd2b050ec5715d9b9fc65d928177
MD5 03e78ed1456b49229228b99cf786d1fc
BLAKE2b-256 a0fb54a4123fb6c66ca93dcc0490a68e8acba01eb8a5e0b78c875a5e76f9a2b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page