Skip to main content
Seyn ships two official SDKs wrapping the v1 API in typed methods: TypeScript (private beta) and Python (early alpha). This page documents the TypeScript surface in full; the Python SDK mirrors it one-to-one, so the same reference applies.

Installation

See the Quickstart for install paths. Neither SDK is on a public registry yet: contact support@seynlabs.com for access until npm 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.
Everything below is the canonical reference, shown in TypeScript. Translate names mechanically: topK becomes top_k, reviewStatus becomes review_status, and methods are synchronous in Python.

Client

new SeynClient(options)

Throws synchronously if apiKey is empty or whitespace.

Resources

The client exposes four resource objects: Every method accepts an optional signal?: AbortSignal for cancellation/timeouts.

Knowledge

client.knowledge.query(options)

GET /v1/knowledge/query: runs a natural-language search.
Returns 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.
Returns 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.
Returns Promise<V1RuleSummary[]>.

client.rules.get(id)

GET /v1/rules/:id: full detail for a single rule.
Returns 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.
Returns Promise<V1Provenance>. Throws SeynError with code: "NOT_FOUND" if the rule doesn’t exist.
Provenance responses can be large (KBs to tens of KBs). Each sourceEvents or rawRecords array can contain dozens of entries: that’s the point. If you only need a summary, just count the arrays.

Libraries

client.libraries.list(options?)

GET /v1/libraries: list versioned knowledge libraries.
Returns Promise<V1LibrarySummary[]>.

client.libraries.get(id)

GET /v1/libraries/:id: single library detail.
Returns 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.
Returns 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.
Returns 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 the ingest 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.
Returns 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.
Returns 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.
Returns Promise<V1IngestBatch>.

Errors

Every non-2xx response throws SeynError:
SeynError shape:
See Authentication → Error codes for the full table.

Cancellation and timeouts

Pass an AbortSignal on any method to cancel in-flight requests:
For per-call timeouts on Node 20+:
The SDK does not provide built-in timeouts or retries: bring your own.

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/offset directly.
  • 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.