Skip to main content

Filament Python API

A Python client for the Filament platform, communicating over SignalR. It comes in two forms: the async FilamentClient, and the blocking FilamentClientSync for code that does not use asyncio.

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",
)

Synchronous usage

FilamentClientSync offers the same request methods as ordinary blocking calls, with no asyncio in your code:

import filament
from filament.types import ReadDataRequest, ReadDataTypeRequest

with filament.FilamentClientSync(
    organization_id="my-org", api_key_name="my-key", api_key="secret",
) as f:
    result = f.read_data(
        ReadDataRequest(request=ReadDataTypeRequest(type_name="UserEntity"))
    )

It takes the same constructor arguments as FilamentClient. Subscriptions and event callbacks are not available on it; use FilamentClient for those.

Both clients can also be opened and closed explicitly instead of with a with block: f.connect() / f.close() on the sync client, await f.connect() / await f.close() on the async one.

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.9.0

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.9.0
File Size Uploaded Provenance Actions
filament_api-0.9.0.tar.gz 153.0 kB With provenance Details for filament_api-0.9.0.tar.gz

Built distribution (wheel)

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

Total release size: 344.1 kB

Release files / filament_api-0.9.0.tar.gz

Download URL filament_api-0.9.0.tar.gz
Size 153.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6680b1ceaf47c6e8fef74d2ba3d9ee33f901737341afe5c1a84f48fbb0f6601d
BLAKE2b-256 checksum
How to use checksums
b779080caf09330e22afc2c3303e8050cc669b145ec9d677e9c2636ac218d8e3
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.9.0-py3-none-any.whl

Download URL filament_api-0.9.0-py3-none-any.whl
Size 191.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d549e714b7f5c4073ea742cad0714dc33a128d77c358b1dabc626261fe17220
BLAKE2b-256 checksum
How to use checksums
a80afd49483dff697e053b40091d22cce4ac122f28c3bc98d3fe7cd88839c4a1
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.9.0

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.9.0.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.9.0 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