[RFC] Python SDK

Author: z-a-fCreated Mar 8, 2026Updated Mar 10, 2026
Labelsenhancement

A lot of LLM application development today is in Python: LangChain, LangGraph, CrewAI, AutoGen, DSPy, plain Anthropic/OpenAI SDK scripts. A developer building a Python agent who wants to programmatically fetch docs for their workflow currently has two awkward options:

  • Shell out to chub get and parse stdout
  • Parse the JSON registry themselves from the CDN

A Python SDK with chub.search("stripe") and chub.get("stripe/payments") would be nicer. IN addition to that it's a low-risk, moderate effort, and high value.

(IMHO) What it should and shouldn't be

Should be:

  • A lightweight registry client: fetch, cache, search, get - mirroring the CLI's core operations
  • Async-native (plays well with asyncio, which all modern Python agent frameworks use)
  • A pip install chub or pip install context-hub that has zero heavy dependencies

Should not be:

  • A port of the full CLI (the Node CLI already does that well)
  • A reimplementation of BM25 (server-side search via the registry JSON is sufficient)
  • Dependent on the Node binary being installed

(IMHO) What it should expose

python
import chub

# Search the registry
results = chub.search("stripe payments")

# Get a doc entry
doc = chub.get("stripe/payments", lang="python", version="2024-06")

# Get with a specific reference file
detail = chub.get("stripe/payments", file="references/webhooks.md")

# Annotate (agent memory)
chub.annotate("stripe/payments", "Always use idempotency keys for charges")

Risks / considerations

  • Maintenance burden: Two SDKs to keep in sync with registry schema changes. Given the registry format is stable JSON with YAML frontmatter, this is low risk, but it's real.
  • The MCP path may be enough: If the target agents are MCP-aware, they already get everything through the MCP server. A Python SDK is most valuable for developers building custom agent frameworks or tooling that doesn't use MCP.
  • Distribution: The Node CLI requires Node ≥18 which is not universally present in Python environments. A pure-Python SDK removes that dependency entirely, which is a genuine UX improvement for Python developers.