The Python SDK (Documentation Index
Fetch the complete documentation index at: https://docs.getomni.co/llms.txt
Use this file to discover all available pages before exploring further.
omni-connector) provides everything you need to build custom connectors that integrate with Omni’s search and AI platform.
Installation
The SDK is not published to PyPI. Connectors live in the Omni monorepo and depend on the SDK as a local path dependency. To start a new Python connector, fork or clone omni and create a directory underconnectors/:
pyproject.toml that pulls the SDK from the local checkout — copy from any existing Python connector (e.g. connectors/notion/pyproject.toml):
uv:
- Python >= 3.11
- uv (used throughout the monorepo for Python dependency management)
fastapi- Web frameworkuvicorn- ASGI serverhttpx- Async HTTP clientpydantic- Data validation
Quick Start
Core Concepts
Connector Class
TheConnector abstract base class defines the interface for all connectors.
Required Properties:
| Property | Type | Description |
|---|---|---|
name | str | Unique connector identifier (e.g., "my-connector") |
version | str | Semantic version (e.g., "1.0.0") |
| Property | Type | Default | Description |
|---|---|---|---|
sync_modes | list[str] | ["full"] | Supported modes: "full", "incremental" |
actions | list[ActionDefinition] | [] | Custom actions the connector supports |
SyncContext
TheSyncContext object is passed to your sync method and provides utilities for the sync operation.
Properties:
| Property | Type | Description |
|---|---|---|
sync_run_id | str | Unique identifier for this sync run |
source_id | str | Source identifier |
state | dict | None | State from previous sync |
content_storage | ContentStorage | Storage for document content |
documents_emitted | int | Count of emitted documents |
documents_scanned | int | Count of scanned items |
ContentStorage
TheContentStorage class handles storing document content.
content_id is a ULID that references the stored content.
Document Model
TheDocument class represents a searchable document.
| Field | Type | Required | Description |
|---|---|---|---|
external_id | str | Yes | Unique ID from the source system |
title | str | Yes | Document title for display |
content_id | str | Yes | Reference to stored content |
metadata | DocumentMetadata | No | Document metadata |
permissions | DocumentPermissions | No | Access control |
attributes | dict | No | Custom searchable attributes |
Actions
Connectors can define custom actions that users can trigger from the Omni UI.RSS Connector Example
Here’s a complete example of an RSS feed connector:Error Handling
The SDK provides custom exception classes:Development
Project Setup
Running Tests
Type Checking
Linting
Testing
The SDK includes a testing module (omni_connector.testing) with utilities for writing integration tests for your connectors.
TestHarness
TheTestHarness class provides a self-contained environment for testing your connector without needing a running Omni deployment.
Assertions
The harness captures all emitted documents, errors, and state changes for easy assertion:API Reference
Exports
The SDK exports the following: Core Classes:Connector- Abstract base classSyncContext- Sync operation contextContentStorage- Content storage interfaceSdkClient- SDK client for connector-manager
Document,DocumentMetadata,DocumentPermissionsConnectorEvent,EventTypeActionDefinition,ActionParameterActionRequest,ActionResponseConnectorManifest,SyncModeSyncRequest,SyncResponseCancelRequest,CancelResponse
ConnectorError,SdkClientError,SyncCancelledError,ConfigurationError
What’s Next
SDK Overview
Learn about SDK architecture
TypeScript SDK
Build connectors with TypeScript