hank-model-transport
Independent model transport and execution-binding primitives. Distribution
hank-model-transport version 1.2.1; Python import root
hank_model_transport. Requires Python 3.10 or newer.
Owner doc: none yet — nearest is docs/reference/model-authority.md (authority owns WHAT, this package HOW).
Ownership and dependencies
This package builds provider requests, streams responses, classifies credential failures, manages provider credential stores, binds selected capabilities for execution, and records provider-call usage. It does not own HTTP gateway routes, product authentication resolvers, sessions, or model registry data.
Model selection, registry entries, compatibility facts, and rates come from
model_authority (hank-model-authority). Shared wire contracts come from
agent-workflow-contracts and hank-contracts. HTTP transports use httpx and
httpx2; provider SDKs are optional. There is no dependency on the gateway or
product source trees, and no compatibility reexports from those packages.
Gateway 0.31.0 and CLI 0.8.17 use this 1.x distribution as the transport
owner. Code that previously imported transport modules from agent_gateway
must import their counterparts from hank_model_transport; the old paths are
removed rather than reexported. Gateway hosts retain authentication and
capability-resolution integration and supply the gateway's explicit runtime
binding when calling send_prompt.
Leaf model operations
hank_model_transport/capability_execution.py owns the registered leaf operations
and execute_leaf_model_call; callers name an operation rather than a raw
capability slot. Supported gateway judgments are verification (node.verify)
and citation_review (citation.review), invoked directly by the host or through
the kernel's hank.judge. Credential preparation precedes task registration so
the recorded bind and selection provenance, including credential_ref, name the
credential used; runner-backed calls share task waiting, cancellation and journal
usage with other jobs.
hank.completion returns the typed unsupported_operation error with
next_call=None: it has no product consumer and no gateway-executed completion
capability. The default general_completion leaf registration is removed;
edgar.general_completion remains owned by the EDGAR process. This does not add
a gateway slot, redirect callers to EDGAR, or change EDGAR execution.
Install
Install this distribution with the extras required for the selected adapters:
pip install 'hank-model-transport[anthropic]'
pip install 'hank-model-transport[openai]'
pip install 'hank-model-transport[claude]'
The all extra installs all three provider SDKs. HTTP-native adapters need no
SDK extra. Provider SDK imports remain deferred until the selected adapter needs
them.
Modules
| Path | Responsibility |
|---|---|
hank_model_transport/providers/ |
Provider adapters, wire helpers, OAuth and API-key stores, quota accounting |
hank_model_transport/auth.py |
Credential failure types, entitlement classification, and pure placement helpers; no product auth configuration or resolver classes |
hank_model_transport/rate_limit.py |
Process-local Anthropic token buckets |
hank_model_transport/openai_history_fence.py |
OpenAI history and signature fencing |
hank_model_transport/message_prefix.py |
The request-prefix boundary of a message list (the last cacheable block of the final message): the one provider-neutral position a learning fork replays from; the Anthropic adapter renders its cache_control marker at it, other providers carry none and the gateway reads the same position from the list |
hank_model_transport/user_runtime_credentials.py |
Explicit private single-user credential bundles (an unknown stored key is refused) and the one parse of the GATEWAY_USER_KEYS roster rows (an invalid row raises MalformedGatewayUserKeys, never dropped) |
hank_model_transport/pooled_completion.py |
Synchronous pooled completions for sibling-process capabilities (EDGAR): the authority's chain plus its typed failover tier as a CompletionPlan, SDK clients, key-pool rotation, failover only after the chain on a primary out_of_credit stop, one spend-ledger row per attempt, and per-call AnswerAttribution; design edgar-llm-client-onto-model-transport-2026-11-03.md |
hank_model_transport/embeddings.py |
The one embeddings call, embed_texts(bind, texts): takes the authority's memory.embed CapabilityBind and returns an EmbeddingResult (vectors in input order, provider_key such as ollama:nomic-embed-text, model_key, dimension) so a consumer persists the identity and refuses a mixed index. Serves the keyless ollama.local route (POST {OLLAMA_BASE_URL origin}/api/embed, truncate=false); any other route is EmbeddingRouteUnsupported. A transport failure is EmbeddingTransportError, a wrong vector count or dimension EmbeddingResponseInvalid; a response is never padded or truncated and there is no fallback or failover to another model. Each call that reaches the daemon writes one ProviderCallMeter row (call_site=memory_embeddings, the bound model_key, local_or_free, shadow cost 0), never an OpenAI row |
hank_model_transport/user_provider_keys.py |
A user's own Anthropic/OpenAI API keys: the UserKeySource protocol, one in-memory KeyPool per (risk_user_id, provider) named <provider>-user-keys (byok_payg, run_owner=str(risk_user_id)), served while fresh (refresh_after_s, 60 s) and rebuilt from Risk's answer on every resolution — after the TTL, after any failure, once before a typed empty outcome (Risk owns permanent stops; only rate-limit cooldowns stay local; keys are named by Risk's fingerprint, also for hosted edge handles), the typed outcomes (UserKeyMissing "connect your API key", UserKeysRateLimited, UserKeysExhausted, UserKeyInvalid, UserKeyBudgetExhausted, IdentityUnresolved, UserKeyResolverUnavailable; user_key_outcome reads one through a materializer's chained error) and adapter rotation within the user's keys (next_user_key_config). Never reaches a deployment pool (design user-provider-keys-2026-11-03 §6). capability_execution.py / send_prompt.py consume it: an exhausted owner seat rebinds to the user's key, and only UserKeysExhausted (every key out of credit, R1) fails over through resolve_failover_bind to the same user's other-provider key (attribution tier=failover, failover_reason=out_of_credit, failed_over_from); a missing target key is UserKeyFailoverMissing |
hank_model_transport/policy_imports.py |
Explicit process-scoped host policy binding for the SDK adapter |
hank_model_transport/tool_errors.py |
Structured error results used for provider history repair |
hank_model_transport/package_info.py |
This distribution's version lookup |
Import provider classes and helpers directly from their owning modules, for
example hank_model_transport.providers.base.ModelProvider. The package root
intentionally does not reexport implementation modules.
Resolver consumer identities use consumer_key_hash_for(risk_api_key) (the first
16 lowercase SHA-256 hex characters). Runs without a Risk API key, including
autonomous and batch work, use NO_API_KEY_CONSUMER (run:autonomous).
ResolveContext refuses every other form; runtime-edge forwarding preserves it.
The SDK adapter reads only the host policy explicitly installed through
hank_model_transport.policy_imports.configure_server_policy(); it does not
discover application modules. The embedding host must configure that binding
before constructing SDK requests that need product policy.
Credential-store paths, environment variable names, log namespaces, and existing operator CLI hints retain their established values. A CLI hint names an external operator tool, not a runtime import or an entrypoint supplied by this distribution.
Metadata
Release files for hank-model-transport 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hank_model_transport-1.2.1.tar.gz | 329.0 kB | Without provenance | Details for hank_model_transport-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hank_model_transport-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for hank_model_transport-1.2.1-py3-none-any.whl |
Total release size: 638.9 kB
Release files / hank_model_transport-1.2.1.tar.gz
| Download URL | hank_model_transport-1.2.1.tar.gz |
|---|---|
| Size | 329.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ea6585e761700da63fcad8fbee65a03c982787d0d34e7cac2231eb6f8d319fd
|
|
BLAKE2b-256 checksum How to use checksums |
43f429d102274d58c77257398f25467d3c5d89ca6654f17ef73032ebc6f34af6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / hank_model_transport-1.2.1-py3-none-any.whl
| Download URL | hank_model_transport-1.2.1-py3-none-any.whl |
|---|---|
| Size | 309.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db5d92127ac885026d11c78bfcce2d289a855aa1340bc00e69210312b1b31e4d
|
|
BLAKE2b-256 checksum How to use checksums |
8cffcd2002e32e53cab39601100ce1950e73e76332501d25bd04773d4c073d1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Security for hank-model-transport 1.2.1
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.