source-connector-implementation

A guide to building an Airweave source connector, a Python module that retrieves data from another service and turns it into searchable records. It covers synced data and searches made directly against the service.

In plain words
What is it for?
Use it to add entity schemas, source implementation, and OAuth settings for a new service. It also helps choose between syncing all data and searching the service when a query is made.
Why use it?
It explains the code and configuration needed to connect a new external service to Airweave. This avoids having to work out the data model, authentication, and connector structure from scratch.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/airweave-ai/airweave/source-connector-implementation
Clone the repo
git clone --depth 1 https://github.com/airweave-ai/airweave

Made for: Cursor.

Per session 8,713 This file is loaded in full into every session.
When invoked 8,713 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.08713 $0.08713
Opus 5 $0.04356 $0.04356
Sonnet 5 $0.01743 $0.01743
Haiku 4.5 $0.00871 $0.00871

Measured yesterday against content hash 223515e5fcb5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

source-connector-implementation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/source-connector-implementation.mdc · 1,223 lines

How it starts

The opening of the file, as written. The whole thing — 1,223 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Building a Source Connector in Airweave

Overview

A source connector in Airweave is a Python module that extracts data from an external service and transforms it into searchable entities. This guide covers everything you need to build a production-ready connector.

There are two types of source connectors:

  1. Standard (Sync-Based): Extracts and syncs all data from the source to Airweave's vector database
  2. Federated Search: Searches the source's API at query time without syncing data

Core Components

Every source connector requires three main components:

  1. Source implementation (backend/airweave/platform/sources/{short_name}.py)
  2. Entity schemas (backend/airweave/platform/entities/{short_name}.py)
  3. OAuth configuration (backend/airweave/platform/auth/yaml/dev.integrations.yaml)

Part 1: Entity Schemas

Start with entities because they define your data model.

File Location

backend/airweave/platform/entities/{short_name}.py

Entity Types

There are two base entity types:

  1. ChunkEntity - Text-based entities (tasks, messages, documents, etc.)
  2. FileEntity - File attachments (PDFs, images, etc.)

Basic Structure

"""Entity schemas for {Connector Name}."""

from datetime import datetime
from typing import Any, Dict, List, Optional

from pydantic import Field

from airweave.platform.entities._airweave_field import AirweaveField
from airweave.platform.entities._base import ChunkEntity, FileEntity


class MyConnectorEntity(ChunkEntity):
    """Schema for primary entity type."""

    # Required fields
    name: str = AirweaveField(
        ...,
        description="Display name of the entity",
        embeddable=True  # This field will be embedded for search
    )

    # Timestamps (critical for incremental sync)
    created_at: Optional[datetime] = AirweaveField(
        None,
        description="When this entity was created",
        embeddable=True,
        is_created_at=True  # Marks this as the creation timestamp
    )

    modified_at: Optional[datetime] = AirweaveField(
        None,
        description="When this entity was last modified",
        embeddable=True,
        is_updated_at=True  # Marks this as the update timestamp
    )

    # Content fields
    content: Optional[str] = AirweaveField(
        None,
        description="The main text content",
        embeddable=True  # Make searchable
    )

    # Metadata fields (not embeddable)
    external_id: str = Field(
        ...,
        description="Unique ID from the external system"
    )

    permalink_url: Optional[str] = Field(
        None,
        description="Direct link to view in external system"
    )

Read the full file on GitHub · 1,223 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 1,223 lines · 8,713 tokens per session scan A 223515e5fcb5

Subscribe to this mod's changes

source-connector-implementation is a cursor rule published in the GitHub repository airweave-ai/airweave (6,567 stars, last pushed 2mo ago), licensed MIT. It adds 8,713 tokens to every session, about $0.0436 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.