Skip to main content

sergent-py-providers

sergent-py-providers is the concrete model transport of the sergent python reference implementation stack. It depends on sergent-py-core, implements the async ModelClient interface, and is the only package in the stack that speaks to a model provider.

The Big Picture

The Sergent Specification closes its trust model with a short, closed list of boundaries. This package is one of them made concrete: the external-systems boundary. Every provider SDK call, every credential read, and every strict parse of provider text happens here.

That placement decides the shape of everything inside. Above this package, sergent-py-runtime drives a deterministic Run. Below it, the provider SDKs disagree about request shape, schema facility, error classes, and what a successful response looks like. This package is the narrow seam between those two worlds. It hands the runtime one ModelResponse beside one parsed JSON object, and it hands each provider what that provider's documented API requires. Nothing above it learns a provider name beyond the provider/model string the application chose, and nothing below it learns what the JSON means. Judging whether that JSON is a valid proposal belongs to the runtime, at the model-output boundary.

The Technical Design And Its Philosophy

The design is one client and one adapter per provider. LlmClient owns everything that must behave identically whichever provider is selected: selection, the attempt loop, error classification, call evidence, and the strict parse. An adapter owns only what genuinely differs. The specification treats the adapter as a suggested strategy rather than a rule (canonical schema dialect); this implementation takes the suggestion because the provider differences are real and each one is small enough to isolate.

These decisions shape the rest:

  • Each provider is called through its official Python SDK, as the specification's implementer guidance recommends. The package relies on documented SDK promises and never re-proves them.
  • Provider text gets one strict parse and no repair. Trim once, parse once, reject anything that is not a single JSON object. Fence stripping, brace hunting, and truncation repair are all forbidden here.
  • Retry is bounded and hidden retries are disabled. Two attempts at most, the second request identical to the first. Every SDK client this package builds has its own retry machinery off, so one attempt is exactly one provider request.
  • Classification reads structured facts. An exception class and an integer HTTP status decide an error kind; a command exit status decides the local model check. No decision reads human-readable provider prose.
  • Credentials come from the environment, read only at real client construction.
  • Provider-shaped fakes are the test seam. SDK clients and the local command runner are injected; no test reaches a provider or reads a real credential.
  • There is no model catalog. The package curates provider identifiers, not model names; a provider's own rejection is the capability answer.

Applications never import this package directly. The battery package sergent_py constructs LlmClient in its default wiring and re-exports ModelSettings, ThinkingEffort, CREDENTIAL_ENV_VARS, and PerplexityAgentClient. StaticLlmClient is the sanctioned provider-shaped fake for hermetic tests.

The Specific Challenges Of Different Providers

Providers agree on little below the request. Four differences matter most:

  • Anthropic is the only adapter that does not send the canonical schema unchanged. Its SDK lowers the schema to the dialect its Messages API accepts, and the adapter performs that lowering explicitly, before the request.
  • Gemini enables automatic function calling by default and warns about it on the async path before checking whether tools exist, so every request disables it. Its timeout and retry bounds travel in HTTP options, not client arguments.
  • Ollama runs through the OpenAI SDK against a local OpenAI-compatible endpoint, so OpenAI error classes cover it, but a model the machine never pulled looks like an ordinary HTTP failure. A local existence check runs first and turns that into a clear model-not-found result.
  • OpenAI and Anthropic can refuse or truncate while still returning HTTP success, so both adapters inspect the response envelope before treating any text as usable output.

Knowledge Artifacts

  • docs/KNOWLEDGE.md: the distilled design, covering the client-and-adapter shape, the machinery of one call, the trust and error model, and how to add a provider.
  • docs/providers.md: the catalog, and the one list of supported adapters with their SDKs, endpoints, native Proposal Schema fields, and credential variables.

Metadata

Release files for sergent-py-providers 0.1.0

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

Source distribution (sdist)

Source distribution for sergent-py-providers 0.1.0
File Size Uploaded Provenance Actions
sergent_py_providers-0.1.0.tar.gz 19.0 kB Without provenance Details for sergent_py_providers-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sergent-py-providers 0.1.0
File Interpreter ABI Platform Actions
sergent_py_providers-0.1.0-py3-none-any.whl Python 3 none any Details for sergent_py_providers-0.1.0-py3-none-any.whl

Total release size: 39.8 kB

Release files / sergent_py_providers-0.1.0.tar.gz

Download URL sergent_py_providers-0.1.0.tar.gz
Size 19.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6de35f8cc52d193dfdd112cc7121f6adb437b88e53fff1d6f361fe8a88992933
BLAKE2b-256 checksum
How to use checksums
fe6ec0acc54761c68f298d2ea47382e4798e526b8c90e39088b1501fb91ab939
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}

Release files / sergent_py_providers-0.1.0-py3-none-any.whl

Download URL sergent_py_providers-0.1.0-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac98790d52b7f546168d8f1e37351f7816e3ed3a858c382f6d8291097d8cca85
BLAKE2b-256 checksum
How to use checksums
53436a56a220654d6f29494469a816211bcd14ac01af61e2084bebb7a42d751a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}

Security for sergent-py-providers 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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