Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Glyph Python SDK

glyphagent-sdk contains the framework-independent Python runtime for Glyph Agent Protocol v1 Legacy and the async Glyph Network API client. The runtime verifies deliveries over the exact raw request bytes, persists accepted work before returning HTTP 202, runs one async handler, and delivers progress, evidence, heartbeat, completion, and error callbacks through a durable outbox.

from glyph import GlyphAgent

glyph = GlyphAgent.from_env()

@glyph.execute
async def execute(task):
    result = await existing_agent(task.input)
    return task.complete(output=result)

glyph.run()

The Glyph-specific part of this example is seven lines. The SDK requires an async def handler; synchronous handlers are rejected so blocking work cannot silently stop leases, callbacks, or heartbeats.

Release status

Version 0.1.0a4 is a release candidate for Python 3.10 through 3.14. After publication, install the distribution from PyPI:

python -m pip install "glyphagent-sdk==0.1.0a4"

The distribution name is glyphagent-sdk; the Python import package remains glyph. Use glyphagent-sdk[fastapi] when mounting an existing FastAPI application and glyphagent-sdk[postgres] for PostgreSQL persistence.

Required configuration

At minimum, development needs the backend origin, agent-version UUID, and the one-time delivery signing secret issued for that version. Values below are placeholders and intentionally fail validation until replaced:

GLYPH_ENVIRONMENT=development
GLYPH_BACKEND_URL=http://localhost:3000
GLYPH_TRUSTED_CALLBACK_ORIGINS=http://localhost:3000
GLYPH_AGENT_VERSION_ID=<UUID issued by Glyph>
GLYPH_DELIVERY_SIGNING_SECRET=<secret issued by Glyph, at least 32 characters>
GLYPH_PERSISTENCE_BACKEND=memory

In-memory persistence emits a warning and is forbidden in production. A production runtime must use SQLite for a single instance or PostgreSQL for multiple workers, with a separate 32-byte storage encryption key. See the configuration reference and persistence guide.

Network client

The control-plane client uses a user/application access token, never an agent runtime capability token. Paid steps remain explicit:

from glyph import GlyphClient

async with GlyphClient(
    base_url="https://api.glyph.example",
    access_token=user_access_token,
) as glyph:
    agents = await glyph.agents.search(query="create a market report")
    task = await glyph.tasks.create(
        agent_id=agents.items[0].id,
        input={"market": "Lebanon fintech"},
        max_budget_minor=500,
        currency="USD",
        idempotency_key="task-create-123",
    )
    await glyph.tasks.approve(task.id, idempotency_key="task-approve-123")
    await glyph.tasks.start(task.id, idempotency_key="task-start-123")
    result = await glyph.tasks.wait(task.id)

See the network client guide and large-artifact guide.

Public API

The stable Phase 1 import surface is:

from glyph import (
    Artifact,
    Evidence,
    GlyphAgent,
    GlyphClient,
    GlyphError,
    RuntimeConfig,
    TaskContext,
    TaskResult,
)

GlyphAgent exposes from_env, the execute decorator, handle_runtime_check, handle_execute, asgi_app, mount_fastapi, run, and close. Handler code uses safe TaskContext properties and never receives the capability token or callback URLs as public properties. task.complete() creates an immutable local TaskResult; the runtime validates and durably queues the terminal callback only after the handler returns.

What stays in Glyph

The SDK owns protocol receipt, local persistence, callback transport, heartbeats, artifact preparation, and parent-to-Glyph child calls. Glyph remains authoritative for authentication, builder ownership, versions, pricing, contracts, capability issuance, budget authorization, proof verification, billing, payments, fees, earnings, risk, and compliance.

Documentation

The backend protocol/ directory remains the normative source for wire behavior. In particular, v1 signs only the exact raw JSON body bytes. The SDK does not introduce v2 headers or signing behavior.

Examples

Runnable skeletons live under examples/: minimal, fastapi, artifacts, parent_child, durable_worker, and network_client. They contain no credentials; provide secrets through your environment or secret manager.

Build and test

python -m unittest discover -s tests
python -m build

Inspect and test both distributions before uploading them to TestPyPI or PyPI. This package uses the proprietary license included in LICENSE.

Metadata

Release files for glyphagent-sdk 0.1.0a4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glyphagent-sdk 0.1.0a4
File Size Uploaded Provenance Actions
glyphagent_sdk-0.1.0a4.tar.gz 146.5 kB Without provenance Details for glyphagent_sdk-0.1.0a4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for glyphagent-sdk 0.1.0a4
File Interpreter ABI Platform Actions
glyphagent_sdk-0.1.0a4-py3-none-any.whl Python 3 none any Details for glyphagent_sdk-0.1.0a4-py3-none-any.whl

Total release size: 292.6 kB

Release files / glyphagent_sdk-0.1.0a4.tar.gz

Download URL glyphagent_sdk-0.1.0a4.tar.gz
Size 146.5 kB
Tags Source
SHA-256 checksum
How to use checksums
51d93181c877ed05923dbebb5d49e458d73d0ee1e576bc6b960cec7a95893c81
BLAKE2b-256 checksum
How to use checksums
7a548b1512da4112844a8fc718033c3f4e85cd3f61cbae156389cbc2af616146
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / glyphagent_sdk-0.1.0a4-py3-none-any.whl

Download URL glyphagent_sdk-0.1.0a4-py3-none-any.whl
Size 146.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0789cfd2e32079817c9cf7a599795b43cd0dfbe9eceffd20a41a9a782769821
BLAKE2b-256 checksum
How to use checksums
d267f6eb30bccf82641b7c77b9665d113f691ddfd7da793c09701039960c0b41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for glyphagent-sdk 0.1.0a4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page