Installation
See the Quickstart for install paths. Neither SDK is on a public registry yet: contact support@seynlabs.com for access untilnpm install @seyn/sdk and pip install seyn-sdk go live.
Python SDK (early alpha)
The Python SDK exposes the same four resources with the same semantics, in Python idiom: snake_case arguments and fields (top_k, review_status), typed result objects, and SeynError carrying the same error codes.
Early alpha means the method surface matches this reference, but Python-side ergonomics (async client, retries, pagination helpers) are still moving. Pin the exact version you receive and read the changelog that ships with each build.
topK becomes top_k, reviewStatus becomes review_status, and methods are synchronous in Python.
Client
new SeynClient(options)
| Option | Type | Default | Notes |
|---|---|---|---|
apiKey | string | (none) | Required. sk_live_* token from the dashboard. |
baseUrl | string | https://api.seynlabs.com | Override for staging or local development. |
apiKey is empty or whitespace.
Resources
The client exposes four resource objects:client.knowledge: natural-language searchclient.rules: process rule operationsclient.libraries: knowledge librariesclient.patterns: aggregate analytics
signal?: AbortSignal for cancellation/timeouts.
Knowledge
client.knowledge.query(options)
GET /v1/knowledge/query: runs a natural-language search.
Promise<V1KnowledgeQueryResult>:
client.knowledge.memory(options)
POST /v1/knowledge/memory: teach Seyn something in plain language. Send a sentence describing what you want the knowledge base to know; Seyn extracts the claims, reconciles them against what it already believes, and writes them as assertions. Processing is async, attributed as a human edit. Needs an ingest-scoped key.
Promise<V1MemorySubmission> with memoryId and status. Throws SeynError with code: "INSUFFICIENT_SCOPE" for a read-only key, or "LIBRARY_NOT_FOUND" for an unknown libraryId.
Rules
client.rules.list(options?)
GET /v1/rules: paginated list of rules in the org.
Promise<V1RuleSummary[]>.
client.rules.get(id)
GET /v1/rules/:id: full detail for a single rule.
Promise<V1RuleDetail>. Throws SeynError with code: "NOT_FOUND" if the rule doesn’t exist in the caller’s org.
client.rules.provenance(id)
GET /v1/rules/:id/provenance: the full audit chain back to source records.
Promise<V1Provenance>. Throws SeynError with code: "NOT_FOUND" if the rule doesn’t exist.
Libraries
client.libraries.list(options?)
GET /v1/libraries: list versioned knowledge libraries.
Promise<V1LibrarySummary[]>.
client.libraries.get(id)
GET /v1/libraries/:id: single library detail.
Promise<V1LibraryDetail>. Throws SeynError with code: "LIBRARY_NOT_FOUND" if missing.
client.libraries.rules(libraryId, options?)
GET /v1/libraries/:id/rules: rules scoped to one library.
Promise<V1RuleSummary[]>. Throws SeynError with code: "LIBRARY_NOT_FOUND" if the library doesn’t exist.
Patterns
client.patterns.metrics()
GET /v1/patterns/metrics: aggregate pipeline analytics.
Promise<V1PatternMetrics>. See Core Concepts → Pattern Metrics for what each array means.
Ingestion
Reading is the bulk of the v1 surface, but you can also push data in. The ingestion methods need an API key with theingest scope (request one from support); read-only keys get INSUFFICIENT_SCOPE. See Connectors → Build your own for the model.
client.sources.create(options)
POST /v1/sources: register a custom source to ingest from any system.
Promise<V1Source>. The source.id is what you ingest into.
client.ingest(options)
POST /v1/ingest: push a batch of records. Records are deduplicated by content hash and normalized asynchronously; reuse a recordId on update and Seyn supersedes the prior version. Up to 500 records per call.
Promise<V1IngestBatch> with batchId, accepted, deduplicated, and rejected[]. Throws SeynError with code: "SOURCE_NOT_FOUND" for an unknown source, or "PAYLOAD_TOO_LARGE" past the batch limits.
client.ingest.status(batchId)
GET /v1/ingest/{batchId}: poll a batch. Normalization is async, so a batch moves queued → processing → done.
Promise<V1IngestBatch>.
Errors
Every non-2xx response throwsSeynError:
SeynError shape:
Cancellation and timeouts
Pass anAbortSignal on any method to cancel in-flight requests:
What’s not in the SDK
- Knowledge writes: you can ingest source data, but rules and libraries are produced by extraction, not written directly.
- Auto-pagination helpers: use
limit/offsetdirectly. - Server-sent events / streaming: not part of v1.
- Browser bundle: Node-first, and ingest-scoped keys must stay server-side. For browser use, proxy through your own backend.