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()))

v0.1.0 scope

Shipped:

  • CopassClient top-level entry point
  • Auth providers: ApiKeyAuthProvider, BearerAuthProvider
  • HttpClient with retry + request/response middleware
  • RetrievalResourcediscover / interpret / search
  • ContextResource/context/for-agent/{minimal,adaptive,comprehensive}

Deferred to a future release:

  • Crypto primitives (HKDF, AES-GCM, session tokens, DEK) + Supabase auth provider
  • ContextWindow + SourcesResource + IngestResource
  • MatrixResource, SandboxesResource, ProjectsResource, EntitiesResource, VaultResource, UsageResource, ApiKeysResource, UsersResource

Add incrementally when a concrete Python consumer needs each. Opening a PR with a scoped addition is the expected path.

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.1.0.tar.gz (12.2 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.1.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: copass_core-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for copass_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5ec62491605592cc01ffcb34e9fa6f9f5b3c7b2e651baeda1177166fe09df7f7
MD5 9ff801bcf7c24b1297fa908d7a0ab514
BLAKE2b-256 22b84024129682bb7eab134c9e4379bd816a0e9ba505acb261b3ea5a2f52d01d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copass_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for copass_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5652a60f87e3f7866df76146a4bcdbb9e5fe9c739eae78fefbe851bca21a9b37
MD5 651e68745b5657af83b5a6ae8f651de4
BLAKE2b-256 a4e8e6035b80e28d5fa5857145526962c711cbf1d1083224ad81ab26318115cb

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