Skip to main content

Typed async client for the Hermes Agent API Server

Project description

Hermes Agent API Client

Hermes Agent API Client is a typed async Python client for authenticated capability discovery and streaming Chat Completions from the Hermes Agent API Server. Version 0.1.0 requires Python 3.13 or later.

Installation

Install the package from PyPI:

uv add hermes-agent-api-client

Usage

HermesAgentApiClient is a single-use async context manager. Without an injected HTTP client, it creates and closes its own httpx.AsyncClient:

from hermes_agent_api_client import HermesAgentApiClient, TerminalEvent


async def ask_hermes(request: dict[str, object]) -> None:
    async with HermesAgentApiClient(
        "https://hermes.example",
        "bearer-key",
    ) as client:
        capabilities = await client.probe_capabilities()
        assert capabilities.chat_completions_streaming

        async for event in client.stream_chat_events(request):
            if isinstance(event, TerminalEvent):
                print(event.outcome)

The default verify=None uses httpx's verified TLS default. An owned client may instead receive verify=False or an ssl.SSLContext. Disabling certificate verification weakens transport security and should be limited to controlled environments.

To share a caller-managed client, inject it explicitly:

import httpx

from hermes_agent_api_client import HermesAgentApiClient


async def probe_with_shared_transport() -> None:
    async with httpx.AsyncClient(verify=True) as http_client:
        async with HermesAgentApiClient(
            "https://hermes.example",
            "bearer-key",
            http_client=http_client,
        ) as client:
            await client.probe_capabilities()

The caller owns an injected client, so exiting HermesAgentApiClient does not close it. TLS verification must be configured on the injected client; passing both http_client and a non-None verify value is rejected.

Supported contract

Version 0.1.0 supports only these Hermes operations:

  • GET /v1/capabilities through probe_capabilities().
  • Streaming POST /v1/chat/completions through stream_chat_events().

The exact OpenAI-compatible request document remains a caller-owned mapping; version 0.1.0 does not define additional request-model semantics.

The stream yields immutable AssistantDeltaEvent, ToolProgressEvent, UsageEvent, KeepaliveEvent, and TerminalEvent values. Terminal outcomes are success, length, or upstream_error.

Public failures derive from HermesContractError and expose only safe category, status_code, and retryable metadata. Authentication, HTTP status, transport, and protocol failures are represented by distinct public exception types. Callers should not expect upstream response bodies, bearer credentials, request payloads, or URLs in public error text.

Compatibility targets Hermes v2026.7.7.2. Evidence is derived from captured Hermes fixtures for that version and local protocol/transport tests; it is not evidence from a live Hermes server.

Security: Hermes API access exposes the configured agent toolset. Protect the bearer key, restrict network access, and grant the Hermes agent only the tools appropriate for the calling application.

Development

Install the exact locked development environment and run all local gates:

uv sync --locked --all-groups
uv run ruff format --check .
uv run ruff check .
uv run coverage run -m pytest
uv run coverage report
npx --yes pyright@1.1.411
uv run npx --yes pyright@1.1.411 --verifytypes hermes_agent_api_client --ignoreexternal
uv build
uv run python scripts/verify_dist.py dist/*.whl dist/*.tar.gz

License

Licensed under the Universal Permissive License 1.0 (UPL-1.0). See LICENSE.

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

hermes_agent_api_client-0.1.0.tar.gz (47.5 kB view details)

Uploaded Source

Built Distribution

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

hermes_agent_api_client-0.1.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hermes_agent_api_client-0.1.0.tar.gz
  • Upload date:
  • Size: 47.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for hermes_agent_api_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d508bb96f9c0cca86ca1b6dff6d5296ab6739f855373fdf66a0274ad1efe6be
MD5 14880f859b1ae11e4fd46c067b85ebc8
BLAKE2b-256 04b933086e01d664172abbcb34f51004c0bd05025883a06f39a71e01315c5d41

See more details on using hashes here.

Provenance

The following attestation bundles were made for hermes_agent_api_client-0.1.0.tar.gz:

Publisher: release.yml on Djelibeybi/hermes-agent-api-client

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

File details

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

File metadata

File hashes

Hashes for hermes_agent_api_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8748e449c0036b0eb98e931902e31705f03a54e0c128645b27770548a36033ba
MD5 1ee8219453acf51344ce665e0856a4b3
BLAKE2b-256 3d5880b1926e23c3bbdaf833130eebc07929a5b950757fc2d62406e378882086

See more details on using hashes here.

Provenance

The following attestation bundles were made for hermes_agent_api_client-0.1.0-py3-none-any.whl:

Publisher: release.yml on Djelibeybi/hermes-agent-api-client

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