Skip to main content

python client for the semble api

Project description

semble-api

python client for the semble api — collaborative bookmarking and knowledge curation on atproto.

built on httpx2 and pydantic, with sync and async clients.

installation

uv add semble-api

quick start

create an api key at semble.so/settings/api-keys, then:

from semble import Semble

client = Semble()  # reads SEMBLE_API_KEY from the environment or a local .env

# add a url to your library
result = client.cards.add_url("https://example.com", note="worth a read")

# search your cards
for card in client.cards.search("durable execution"):
    print(card.url)

# semantic search across semble
for hit in client.search.semantic("agent memory", threshold=0.7):
    print(hit.metadata.title, hit.url)

async is the same surface:

from semble import AsyncSemble

async with AsyncSemble() as client:
    profile = await client.actors.get_my_profile(include_stats=True)
    feed = await client.feeds.get_following(limit=25)

api surface

resources mirror the network.cosmik.* xrpc namespaces:

namespace what's there
client.cards add/search/list urls and notes, metadata, library status
client.collections create/update/delete collections, followers, contributors
client.connections typed links between urls (supports, opposes, explains, ...)
client.feeds global and following activity feeds
client.notifications list, unread count, mark read
client.search semantic search, similar urls, account search
client.actors profiles
client.graph follow/unfollow users and collections

every endpoint not yet wrapped is reachable via the escape hatch:

client.get("network.cosmik.card.getLibraryStatus", {"url": "https://example.com"})

semble.records has pydantic models for the raw network.cosmik.* pds records, if you're reading or writing them directly (e.g. with pdsx).

configuration

settings come from explicit kwargs, then SEMBLE_* environment variables, then a local .env file (via pydantic-settings):

setting kwarg default
SEMBLE_API_KEY api_key unauthenticated (public reads work)
SEMBLE_BASE_URL base_url https://api.semble.so/xrpc
SEMBLE_TIMEOUT timeout 30.0

the api key is held as a pydantic SecretStr, so it won't leak into logs or reprs.

cli

a small cyclopts cli ships as an extra:

uv add 'semble-api[cli]'
# or run without installing
uvx --from 'semble-api[cli]' semble --help

semble whoami                          # auth sanity check
semble feed 10 --following             # activity feeds
semble search "durable execution"      # semantic search
semble library pdewey.com              # anyone's library (or yours, with no handle)
semble add https://example.com --note "worth a read"
semble rm <card-id>

output is machine-readable by default — lists are ndjson, single results are one json object, keys match the api's camelCase — so it pipes straight into jq or an agent. add --pretty to any command for human-formatted output:

semble feed 25 | jq -r '.card.url'
semble search "agent memory" | jq -r '.metadata.title'
semble feed --pretty

mcp server

the mcp extra ships a semble-mcp entry point that exposes this sdk to mcp clients via fastmcp code mode: three meta-tools (search / get_schema / execute) instead of one tool per endpoint, with model-written python composing sdk calls in a monty sandbox. intermediate results stay in the sandbox; only the final answer returns to the model's context.

claude mcp add semble -- uvx --from 'semble-api[mcp]' semble-mcp
# or from a checkout
claude mcp add semble -- uv run --directory /path/to/this/repo semble-mcp

auth comes from SEMBLE_API_KEY (environment or .env); without a key the server is limited to public reads.

examples

scripts/roundtrip.py exercises the write paths end to end (add url → note → collection → cleanup). it mutates your real account, so run it deliberately:

uv run scripts/roundtrip.py

development

just test   # pytest
just fmt    # ruff format + check
just check  # ty

see also

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

semble_api-0.0.1.tar.gz (130.5 kB view details)

Uploaded Source

Built Distribution

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

semble_api-0.0.1-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file semble_api-0.0.1.tar.gz.

File metadata

  • Download URL: semble_api-0.0.1.tar.gz
  • Upload date:
  • Size: 130.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","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}

File hashes

Hashes for semble_api-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fe1f33abd4853f8ac17568a828db0c1d788d5de52618a1ad608b77229e5fdb5e
MD5 c50378d84e651c37919297ae5498d054
BLAKE2b-256 1b83acc5ae70da1ed5a46d4c7ad9cf869e056f36ccf35a48f69d0ea7cd0390bc

See more details on using hashes here.

File details

Details for the file semble_api-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: semble_api-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","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}

File hashes

Hashes for semble_api-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ed3024135f786ef3cfff1059a39e51ab156b72e339973d06335c4182252cd2d3
MD5 4c6bca3528002902fa8fba94e1ea6dd6
BLAKE2b-256 95662be8903cc83e5d9c207d17003b79fb056cd3eca7b042b32ca0f93b8c4fcf

See more details on using hashes here.

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