Skip to main content

g8e Protocol Constants and Models

Project description

g8e

Python protocol library for the g8e zero-trust execution platform. Provides protocol constants, dynamic enums, and Pydantic models for building g8e-compatible clients and services.

Installation

Requires Python 3.10 or later. Dependencies are pydantic>=2.0.0 and protobuf>=4.0.0.

pip install g8e

Usage

Constants

The g8e.constants module loads JSON protocol constants from protocol/constants/ at import time. It exports dicts for events, status, collections, headers, channels, pubsub, intents, prompts, timestamps, document IDs, platform configuration, agents, network, API paths, key-value keys, and sender identifiers. The module also exports the ComponentName StrEnum and individual HTTP header string constants for session, context, and g8e-specific headers.

Set the G8E_PROTOCOL_DIR environment variable to override the default protocol directory resolution. The loader checks this variable first, then falls back to the relative path from the package, then to /app/protocol/constants for containerized environments.

Enums

The g8e.enums module dynamically generates StrEnum and IntEnum classes from the STATUS and EVENTS protocol constants. Enum member names use SCREAMING_SNAKE_CASE; values preserve the raw protocol wire format. Integer-valued categories produce IntEnum; all others produce StrEnum. Access enums by PascalCase name via attribute lookup, for example g8e.enums.OperatorToolName or g8e.enums.EventType.

Models

The g8e.models package provides Pydantic v2 models for protocol data structures. All models extend G8eBaseModel, which configures populate_by_name and extra="ignore", and defaults exclude_none on serialization. The UTCDatetime annotated type serializes datetimes to ISO 8601 with a Z suffix.

  • g8e/models/base.py: G8eBaseModel, UTCDatetime, and re-exports of Pydantic Field, ConfigDict, field_validator, model_validator.
  • g8e/models/context.py: RequestContext and BoundOperator. RequestContext validates session identity for CLIENT source components, requiring either web_session_id or cli_session_id and a user_id.
  • g8e/models/events.py: SSE wire models (SessionEventWire, BackgroundEventWire) and AI event payload models for chat processing, tool lifecycle, citations, errors, thinking, turn completion, retry, and triage clarification.
  • g8e/models/internal_api.py: ChatMessageRequest, ChatStartedResponse, and ResourceCreationRequest for internal API interactions.
  • g8e/models/settings.py: G8eeUserSettings, PlatformSettings, and nested settings models for LLM providers, search, eval judge, command validation, and batch execution.

Examples

Working examples are in protocol/python/examples/. Run constants_example.py for constants and headers usage, or models_example.py for model instantiation, serialization, and validation.

Components

  • g8e/constants.py: Runtime loader for JSON protocol constants from protocol/constants/. Exports dict constants, ComponentName enum, and HTTP header string constants.
  • g8e/enums.py: Dynamic StrEnum and IntEnum generation from STATUS and EVENTS protocol constants.
  • g8e/models/: Pydantic v2 models for protocol data structures, SSE events, internal API requests, and user settings.

Protocol Versioning

This package follows semantic versioning. Major version changes indicate breaking protocol changes. Minor version changes add new protocol features. Patch version changes include bug fixes and non-breaking enhancements.

License

Apache License 2.0. See protocol/LICENSE for details.

Contributing

Protocol changes require coordination across all g8e components. Submit protocol change proposals via GitHub issues with clear justification and impact analysis.

Support

For protocol questions and support, open a GitHub issue or visit https://github.com/g8e-ai/g8e

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

g8e-1.4.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

g8e-1.4.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file g8e-1.4.1.tar.gz.

File metadata

  • Download URL: g8e-1.4.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for g8e-1.4.1.tar.gz
Algorithm Hash digest
SHA256 52a4b2537a8ca9e97c2828d019d740d7b1b6338c8d6fa80dbca8da79daf52f4d
MD5 d72cd0f3232bf037d935ba0a010b5171
BLAKE2b-256 88e7c4c01a1043612097a574267cee3cd5f7f0f04b00e0a548df7f45c474bc8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for g8e-1.4.1.tar.gz:

Publisher: release-python-protocol.yml on g8e-ai/g8e

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file g8e-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: g8e-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for g8e-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d832eec1c1b6d1d6a8b510d07181d78a8c81254988cd4ce42184deea226d0ac
MD5 e67f37c493fb065ae6ee61cbbb2a1b75
BLAKE2b-256 b903aab603591d26a618f99e225b4607e322ce291bada177021c992f6c0870b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for g8e-1.4.1-py3-none-any.whl:

Publisher: release-python-protocol.yml on g8e-ai/g8e

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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