Skip to main content

content-sdk

Install

pip install content-sdk        # https://pypi.org/project/content-sdk/

Python 3.11+. Requires only httpx and pydantic. The wheel is also attached to each GitHub release; from a clone: pip install ./packages/python-sdk.

The official Python SDK for the Content engine — the one API client. It fully encapsulates the REST API (/api/v1); the CLI, the MCP server and applications all speak through it, so the engine's rules are never duplicated.

Install

pip install content-sdk        # or: uv pip install -e packages/python-sdk

Synchronous

from content_sdk import ContentClient, outputs

with ContentClient("http://localhost:8010") as client:
    analysis = client.analyze(outputs.url_source("https://www.youtube.com/watch?v=…"))
    caps = client.get_capabilities(analysis.id)  # analysis_id is addressable
    job = client.generate(analysis.id, [outputs.audio_output()])
    job.wait()  # polls until terminal
    for artifact in job.artifacts:
        print(artifact.filename, artifact.media_type)

analyze, get_capabilities and generate accept either an analysis_id / Analysis or inline sources (ADR 0014):

client.get_capabilities([outputs.url_source("https://…")])  # stateless, by sources

Asynchronous

import asyncio
from content_sdk import AsyncContentClient, outputs


async def main():
    async with AsyncContentClient("http://localhost:8010") as client:
        analysis = await client.analyze(outputs.url_source("https://…"))
        job = await analysis.generate([outputs.audio_output()])
        await job.wait()
        print([a.filename for a in await job.artifacts()])


asyncio.run(main())

Errors

Every non-2xx maps to a typed exception carrying the stable error codes:

from content_sdk import NotFound, Gone, ValidationError

try:
    client.get_analysis("ana_stale")
except Gone as exc:  # 410 — the analysis or its facts expired
    print(exc.codes)  # ["analysis_expired"]
except NotFound:  # 404
    ...
except ValidationError as exc:  # 422 / 409 idempotency
    print(exc.codes)

Design

  • models.py — pure pydantic contract models (data only, no client).
  • resources.py — behavioural objects (Analysis, Job) bound to a client.
  • _transport.py — httpx sync/async layer; conservative retries (transport errors + 5xx on safe GETs only; creations retried only with an idempotency key).

The SDK never imports the engine and never depends on the CLI or MCP.

Sending a local file

A file source names a path the engine can read. For a file on your own machine — a laptop talking to a homelab engine — upload it first:

source = client.upload_file("~/report.pdf")  # returns a ready-to-use source
analysis = client.analyze(source)
job = client.generate(analysis.id, [{"id": "s", "type": "summary"}])

upload_file streams from disk and hands back {"type": "upload", …} — the upload id never has to be handled by hand. upload_bytes(name, data, type) does the same for bytes that were never a file, which is what a browser upload is. upload() returns the record itself (size, sha256) for callers who want it, and get_upload / delete_upload complete the endpoint.

The async client mirrors all of it, with one deliberate difference: it buffers rather than streams, because handing httpx a blocking file handle inside an async send only relocates the stall. For a large upload, prefer the sync client.

Metadata

Release files for content-sdk 0.8.5

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

Source distribution (sdist)

Source distribution for content-sdk 0.8.5
File Size Uploaded
content_sdk-0.8.5.tar.gz 46.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for content-sdk 0.8.5
File Interpreter ABI Platform
content_sdk-0.8.5-py3-none-any.whl Python 3 none any Details

Total release size: 106.5 kB

Release files / content_sdk-0.8.5.tar.gz

Download URL content_sdk-0.8.5.tar.gz
Size 46.1 kB
Tags Source
SHA-256 checksum
How to use checksums
62b54d0ce16180e8f14e664738bed7c15385aab8edc0f696d5878a20b102e7bd
BLAKE2b-256 checksum
How to use checksums
ea5fae255e9c8000e0493a11434eea9a1766f4a06af4ac4dec24594eec10b6f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / content_sdk-0.8.5-py3-none-any.whl

Download URL content_sdk-0.8.5-py3-none-any.whl
Size 60.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1880750f15162a4042c3dbaf0995fb36202085b65477c04edbcd59a3b8e43a6
BLAKE2b-256 checksum
How to use checksums
f8d961de264f60e51916ae4285c580afe299858d5f3eb96ffbcbe85762a482d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.5 This release

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.8

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.0

2 release files

0.2.0

2 release files

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