featbit-python-sdk

Guides integration of the FeatBit Python Server-Side SDK for backend services. Use when users ask about FeatBit feature flags in Python, fbclient usage, or server frameworks like Flask, Django, or FastAPI. Not for client-side use.

16 stars

Best use case

featbit-python-sdk is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Guides integration of the FeatBit Python Server-Side SDK for backend services. Use when users ask about FeatBit feature flags in Python, fbclient usage, or server frameworks like Flask, Django, or FastAPI. Not for client-side use.

Teams using featbit-python-sdk should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/featbit-python-sdk/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/featbit-python-sdk/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/featbit-python-sdk/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How featbit-python-sdk Compares

Feature / Agentfeatbit-python-sdkStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Guides integration of the FeatBit Python Server-Side SDK for backend services. Use when users ask about FeatBit feature flags in Python, fbclient usage, or server frameworks like Flask, Django, or FastAPI. Not for client-side use.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# FeatBit Python Server-Side SDK

Expert guidance for integrating the FeatBit Python Server-Side SDK in backend applications. This skill is based on the official SDK README and keeps details in reference files for quick navigation.

## Activates When

- The user asks about FeatBit Python SDK setup, usage, or troubleshooting.
- The user mentions `fbclient`, `FBClient`, `variation`, `variation_detail`, or `flag_tracker`.
- The user needs server-side feature flag evaluation in Python (Flask, Django, FastAPI, etc.).

## Overview

Use this SDK to evaluate feature flags on the server. The SDK syncs flag data via websocket and stores it in memory by default. If you need a custom data source, use offline mode with bootstrap JSON.

## Core Knowledge Areas

### 1. Data Synchronization

- Websocket sync keeps local data updated (average sync < 100 ms).
- The connection can be interrupted but resumes automatically after outages.
- Offline mode disables remote sync; use bootstrap JSON if needed.

### 2. Installation and Prerequisites

- Install: `pip install fb-python-sdk` (Python 3.6–3.11).
- Required values: `env_secret`, `event_url`, `streaming_url`.
- Official FAQ: environment secret + SDK URLs.

### 3. Initialization and Client Lifecycle

- Preferred pattern: call `set_config(...)`, then `get()` for a singleton client.
- Direct instantiation: `FBClient(Config(...), start_wait=15)`.
- Async readiness: `client.update_status_provider.wait_for_OKState()`.

### 4. Evaluation and All Flags

- Evaluate: `variation()` for value, `variation_detail()` for value + reason.
- All flags: `get_all_latest_flag_variations(user)`.
- Defaults are returned when SDK is not initialized or keys are invalid.

### 5. User Model

- Use a dict with required `key` and `name`.
- Add custom properties (string, number, boolean).

### 6. Flag Change Tracking

- `flag_tracker.add_flag_value_maybe_changed_listener(...)`.
- `flag_tracker.add_flag_value_changed_listener(...)`.

### 7. Offline Mode and Bootstrap Data

- Enable: `Config(..., offline=True)`.
- Initialize with JSON: `client.initialize_from_external_json(json)`.
- Use FeatBit to export a bootstrap JSON snapshot.

### 8. Experiments (A/B/n)

- Track custom events: `client.track_metric(user, event_name, numeric_value)`.
- Ensure the flag is evaluated before tracking the metric.

## Quick Start (Concise)

```python
from fbclient import get, set_config
from fbclient.config import Config

set_config(Config(env_secret, event_url, streaming_url))
client = get()

if client.initialize:
    user = {"key": "bot-id", "name": "bot"}
    detail = client.variation_detail("flag-key", user, default=None)
    print(detail.variation, detail.reason)

client.stop()
```

For a complete walkthrough and full examples, see the reference guides below.

## Reference Guides

- [references/quick-start.md](references/quick-start.md) — installation, prerequisites, and full quick start
- [references/data-synchronization.md](references/data-synchronization.md) — websocket sync behavior and recovery
- [references/bootstrapping-and-lifecycle.md](references/bootstrapping-and-lifecycle.md) — singleton pattern, init waits, readiness
- [references/evaluation-and-tracking.md](references/evaluation-and-tracking.md) — evaluation, all-flags, change tracking, experiments
- [references/offline-mode.md](references/offline-mode.md) — offline setup and bootstrap JSON
- [references/support-and-links.md](references/support-and-links.md) — official docs, GitHub repo, support channels

## Best Practices

1. **Create one client per environment**: keep `FBClient` instances for the app lifetime.
2. **Check readiness only when needed**: evaluate with defaults if not ready, and log status for diagnostics.
3. **Prefer `variation_detail()` for debugging**: it returns evaluation reasons.
4. **Call `stop()` on shutdown**: allow pending events to flush.

## Documentation Reference

- Official Docs: https://docs.featbit.co/sdk/overview#python
- Complete Guide (full README and latest updates): https://github.com/featbit/featbit-python-sdk

## Related Topics

- FeatBit OpenFeature integration (if using OpenFeature with Python SDK)
- Server-side SDKs for other languages

Related Skills

fastapi-python-expert

16
from diegosouzapw/awesome-omni-skill

Use this agent when you need to design, implement, or optimize FastAPI backend applications. This includes API endpoint creation, database integration, authentication/authorization implementation, cloud deployment strategies, business logic architecture, performance optimization, and following FastAPI best practices.

faion-python-skill

16
from diegosouzapw/awesome-omni-skill

No description provided.

faion-python-developer

16
from diegosouzapw/awesome-omni-skill

Python development: Django, FastAPI, async patterns, testing, type hints.

enterprise-python

16
from diegosouzapw/awesome-omni-skill

Enterprise-ready Python development incorporating Kaizen (continuous improvement) and Monozukuri (meticulous craftsmanship) principles. Use this skill when building Python applications, APIs, CLI tools, data pipelines, automation scripts, or when the user requests clean, efficient, fast, simple, elegant, enterprise-grade, bulletproof, or production-ready Python code. This skill enforces modern Python 3.12+ best practices, type safety, testing patterns, security, and performance optimization.

dotnet-to-react-python-refactor

16
from diegosouzapw/awesome-omni-skill

Agent skill for refactoring .NET applications into a React frontend + Python backend. Use for migrating/modernizing .NET apps (ASP.NET MVC, Web API, Blazor, Web Forms) to React + Python, or analyzing .NET codebases for migration planning.

developing-with-python

16
from diegosouzapw/awesome-omni-skill

Python 3.11+ development with type hints, async patterns, FastAPI, and pytest. Use for backend services, CLI tools, data processing, and API development.

developing-python

16
from diegosouzapw/awesome-omni-skill

Modern Python development guide covering project setup, tooling, and 125 Pythonic best practices. MUST load when pyproject.toml or requirements.txt is detected. Covers Python 3.13 + uv + ruff + mypy, FastAPI/FastMCP, pytest, Docker, and Effective Python items (idioms, data structures, concurrency, testing).

dbos-python

16
from diegosouzapw/awesome-omni-skill

DBOS Python SDK for building reliable, fault-tolerant applications with durable workflows. Use this skill when writing Python code with DBOS, creating workflows and steps, using queues, using DBOSC...

dataverse-python

16
from diegosouzapw/awesome-omni-skill

dataverse-python guidelines Triggers on: **

dataverse-python-modules

16
from diegosouzapw/awesome-omni-skill

dataverse-python-modules guidelines Triggers on: **

dataverse-python-best-practices

16
from diegosouzapw/awesome-omni-skill

dataverse-python-best-practices guidelines

build-agent-python

16
from diegosouzapw/awesome-omni-skill

Python build agent for scripts, backends, data pipelines, and ML projects. Extends build-agent with Python conventions. Use when building Python applications, APIs, data processing, or automation.