Skip to main content

Core client SDK for the Copass platform (Python mirror of @copass/core)

Project description

copass-core

Core client SDK for the Copass platform. Python mirror of @copass/core — shared foundation for every Python Copass adapter.

Install

pip install copass-core

Requires httpx>=0.27. Python ≥ 3.10.

Quickstart

import asyncio
from copass_core import CopassClient, ApiKeyAuth

async def main():
    client = CopassClient(auth=ApiKeyAuth(key="olk_..."))

    # Retrieval
    menu = await client.retrieval.discover(
        sandbox_id="sb_...",
        query="How does auth work?",
    )
    print(menu["items"])

    # Context for agent
    context = await client.context.for_agent(
        sandbox_id="sb_...",
        tier="adaptive",
        query="auth flow",
    )
    print(context)

asyncio.run(main())

Auth options

from copass_core import CopassClient, ApiKeyAuth, BearerAuth, ProviderAuth

# Long-lived API key (olk_ prefix)
CopassClient(auth=ApiKeyAuth(key="olk_..."))

# Raw Bearer JWT (caller owns refresh)
CopassClient(auth=BearerAuth(token="eyJ..."))

# Custom AuthProvider implementation
class MyProvider:
    async def get_session(self):
        from copass_core import SessionContext
        return SessionContext(access_token=await _mint_token())

CopassClient(auth=ProviderAuth(provider=MyProvider()))

Available resources

Full resource surface matching @copass/core:

client = CopassClient(auth=ApiKeyAuth(key="olk_..."))

# Narrow retrieval tools
await client.retrieval.discover(sandbox_id, query="...")
await client.retrieval.interpret(sandbox_id, query="...", items=[...])
await client.retrieval.search(sandbox_id, query="...")
await client.context.for_agent(sandbox_id="...", tier="adaptive")

# Storage layer
await client.sandboxes.create(name="...", owner_id="...")
await client.sources.register(sandbox_id, provider="custom", name="...")
await client.ingest.text_in_sandbox(sandbox_id, text="...")
await client.projects.create(sandbox_id, name="...")
await client.vault.store(sandbox_id, "key/path", b"bytes")

# Knowledge graph
await client.entities.search(sandbox_id, q="auth")
await client.matrix.query(query="...")

# Account
await client.users.get_profile()
await client.api_keys.create(name="ci")
await client.usage.get_balance()

# Higher-order — ephemeral data source wrapping agent conversation
window = await client.context_window.create(sandbox_id=sandbox_id)
await window.add_turn(ChatMessage(role="user", content="..."))
# Pass directly to retrieval for window-aware calls:
await client.retrieval.search(sandbox_id, query="...", window=window)

v0.2 scope

Shipped in v0.2:

  • Full resource surface (12 resource classes, all public paths).
  • ContextWindow + ContextWindowResource.
  • BaseDataSource + ensure_data_source for custom driver subclasses.
  • HttpClient raw-body / raw-response support (enables vault blob I/O).

Deferred to v0.3:

  • Crypto primitives (HKDF, AES-GCM, session tokens, DEK).
  • Supabase OTP auth provider (requires crypto).
  • BearerAuth(encryption_key=...) currently stores the key but doesn't derive a session token — works when the server doesn't demand one.

Open a PR with a scoped addition if you need those sooner.

License

MIT.

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

copass_core-0.4.3.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

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

copass_core-0.4.3-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file copass_core-0.4.3.tar.gz.

File metadata

  • Download URL: copass_core-0.4.3.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for copass_core-0.4.3.tar.gz
Algorithm Hash digest
SHA256 d083defaf729ff090680a40dd1f55f0a90b818c9be212409262761aeacbd5b08
MD5 3525c40a23ae1fea7e404de2151fc309
BLAKE2b-256 c69e92d40c582251728a1fa3ce30c0fa79cb78041a8a111269337629b8340f4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for copass_core-0.4.3.tar.gz:

Publisher: release-python.yml on olane-labs/copass-harness

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file copass_core-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: copass_core-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 33.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for copass_core-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ccbd2584194b76704639d46b9bbe475d9183791938e28ee29983d983565b36b3
MD5 d0aa442583278b038620a8e56f469ab6
BLAKE2b-256 916ded065bdf0d8e6c91b207ad74515fe6c36d9be920f14af6e58d719d45c2c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for copass_core-0.4.3-py3-none-any.whl:

Publisher: release-python.yml on olane-labs/copass-harness

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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