Skip to main content

Filament Python API

An async Python client for the Filament platform, communicating over SignalR.

Documentation

Full, multi-page documentation lives in docs/:

Runnable scripts are in examples/. The sections below are a quick overview; see the docs for the full detail.

Claude Code skill

This repo doubles as a Claude Code plugin that ships a using-filament-api skill. Install it in any project that uses this package so Claude has the API reference on hand:

/plugin marketplace add FilamentSoftware/filament-api-python
/plugin install filament-api@filament

The skill routes Claude to the bundled docs/ — it stays in sync with the documentation rather than duplicating it. Once installed, invoke it with /filament-api:using-filament-api.

Requirements

  • Python 3.10, 3.11, 3.12, or 3.13

Installation

Stable releases are published to PyPI:

pip install filament-api
# or
poetry add filament-api

If your deployment's file store uses CRC32C checksums (GCS), install the crc32c extra:

pip install "filament-api[crc32c]"

Installing from the internal index (Filament staff / dev builds)

Every release, including the development builds cut from develop, is also published to Filament's internal Google Cloud Artifact Registry. Its virtual repository serves those releases together with a mirror of PyPI, so use it as your only index (--index-url, not --extra-index-url, which would let a same-named package on PyPI compete with the internal one).

Access requires the roles/artifactregistry.reader role on the repository and Application Default Credentials (e.g. gcloud auth application-default login). Ask your Filament contact for access.

With pip:

pip install keyrings.google-artifactregistry-auth
pip install --index-url https://europe-west2-python.pkg.dev/filament-artifacts/python/simple/ filament-api

With Poetry:

poetry self add keyrings.google-artifactregistry-auth
poetry source add --priority=primary filament-internal https://europe-west2-python.pkg.dev/filament-artifacts/python/simple/
poetry add filament-api

Dev builds are PEP 440 pre-releases (e.g. 0.8.1.dev4), so installers skip them unless asked. Use pip install --pre ..., pin an exact version (filament-api==0.8.1.dev4), or poetry add filament-api --allow-prereleases (which sets allow-prereleases = true on the dependency).

Usage

import asyncio
import filament
from filament.types import ReadDataRequest, ReadDataTypeRequest

async def main() -> None:
    async with filament.FilamentClient(
        organization_id="my-org", api_key_name="my-key", api_key="secret",
    ) as f:
        result = await f.read_data(
            ReadDataRequest(request=ReadDataTypeRequest(type_name="UserEntity"))
        )

asyncio.run(main())

The server, port, and path are configurable:

f = filament.FilamentClient(
    organization_id="my-org",
    api_key_name="my-key",
    api_key="secret",
    server="https://backend.filament-software.com",
    port=1234,
    path="api/v1",
)

Conditions (Typed)

Build type-safe query conditions with the Condition builder. The mypy plugin validates field names and value types at type-check time.

from filament import Condition
from filament.types.generated.entities.user_service import UserEntity
from filament.types.generated.enums import UserStatusEnum
from filament.types.generated.misc import ReadDataRequest, ReadDataTypeRequest

# Mypy validates that "schedule_status" exists on UserEntity
# and that the value is a UserStatusEnum
condition = Condition(UserEntity).prop("schedule_status").equal_to(UserStatusEnum.Enabled)

# Comparable fields support ordering operations
condition = Condition(UserEntity).prop("given_name").less_than("M")

# Combine conditions
condition = Condition.and_(
    Condition(UserEntity).prop("schedule_status").equal_to(UserStatusEnum.Enabled),
    Condition(UserEntity).prop("given_name").like("%Alice%"),
)

# Use in queries
async def main() -> None:
    async with filament.FilamentClient(
        organization_id="my-org", api_key_name="key", api_key="secret",
    ) as f:
        result = await f.read_data(
            ReadDataRequest(request=ReadDataTypeRequest(
                type_name="UserEntity",
                condition=condition,
            ))
        )

To enable mypy validation, add to your pyproject.toml:

[tool.mypy]
plugins = ["filament_mypy_plugin"]

Conditions (Untyped)

For quick usage without entity class references, use the convenience constructors:

from filament.types.conditions import and_, equal_to, less_than, like

condition = and_(
    equal_to("scheduleStatus", "1"),
    like("givenName", "%Alice%"),
)

Data Options

Typed key-value options for service data requests:

from filament.types.options import string_option, int_option, bool_option

options = {
    "mode": string_option("preview"),
    "limit": int_option(100),
    "includeDeleted": bool_option(False),
}

Subscriptions

Subscribe to real-time data updates with a callback:

from uuid_utils import UUID

from filament.types.generated.misc import SubscriptionConfig, ServiceDataUpdate
from filament.types.generated.enums import DataProcessingStatus, SubscriptionMode

def on_update(update: ServiceDataUpdate) -> None:
    print("Data changed:", update.modified_entities)

scenario_id = UUID(int=0)  # replace with your scenario ID

async def main() -> None:
    async with filament.FilamentClient(
        organization_id="my-org", api_key_name="my-key", api_key="secret",
    ) as f:
        result = await f.subscribe(
            SubscriptionConfig(
                scenario_id=scenario_id,
                status=DataProcessingStatus.Pending,
                type_name="TaskEntity",
                mode=SubscriptionMode.Data,
            ),
            callback=on_update,
        )

Event Callbacks

Register callbacks for processing lifecycle events:

async with filament.FilamentClient(
    organization_id="my-org", api_key_name="my-key", api_key="secret",
) as f:
    f.on_processing_started(lambda status: print("Started:", status.scenario_id))
    f.on_processing_completed(lambda status: print("Done:", status.scenario_id))
    f.on_processing_failed(lambda status: print("Failed:", status.message))

Development

Working on the client itself needs Poetry:

# Install with test dependencies
poetry install --with test

# Run tests
poetry run pytest tests/ -v

# Run type checking
poetry run mypy src/

Releases are built and published by .github/workflows/create-release.yml: every release goes to the internal Artifact Registry, and stable releases also go to PyPI. See Publishing releases for the flow and the one-off setup.

License

MIT

Metadata

Release files for filament-api 0.8.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for filament-api 0.8.2
File Size Uploaded Provenance Actions
filament_api-0.8.2.tar.gz 142.2 kB With provenance Details for filament_api-0.8.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for filament-api 0.8.2
File Interpreter ABI Platform Actions
filament_api-0.8.2-py3-none-any.whl Python 3 none any Details for filament_api-0.8.2-py3-none-any.whl

Total release size: 322.4 kB

Release files / filament_api-0.8.2.tar.gz

Download URL filament_api-0.8.2.tar.gz
Size 142.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cece68835146c30942bcf18842f72ca507b638c9e87a32321652be444870d953
BLAKE2b-256 checksum
How to use checksums
efc51b827d6457cb9a9fbd1a9a656bf148c5d11d344d76f2e9ff4a78642fb4d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / filament_api-0.8.2-py3-none-any.whl

Download URL filament_api-0.8.2-py3-none-any.whl
Size 180.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35054fc2ab2f5a2700d36909854ff2b45f660a92015465a5483df621501d4fe2
BLAKE2b-256 checksum
How to use checksums
939e0da94a7b16549b33c070d5c6182146335012acdb94e9f9e54885fed32b06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for filament-api 0.8.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for filament_api-0.8.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page