Writing Workflows
Local Development
Develop workflows locally against a Bifrost instance
Develop workflows locally using the Bifrost SDK and CLI. No Docker required - connect directly to your Bifrost instance.
Prerequisites
Section titled “Prerequisites”- Python 3.11+ installed
- Access to a Bifrost instance (cloud or self-hosted)
Quick Start
Section titled “Quick Start”-
Install the Bifrost SDK:
Terminal window pip install bifrost-sdk -
Set your Bifrost API URL (create a
.envfile or export):Terminal window export BIFROST_API_URL=https://your-bifrost-instance.com -
Start developing - authentication happens automatically on first SDK call
How Authentication Works
Section titled “How Authentication Works”When you first use the SDK, it automatically triggers device authorization:
- SDK detects no credentials exist
- Opens your browser to verification page
- You enter the displayed code and authenticate
- Credentials saved locally with auto-refresh
Tokens refresh automatically when expired. Run bifrost logout to clear credentials.
Creating Workflows
Section titled “Creating Workflows”Create Python files locally and test them before uploading:
from bifrost import workflow, context
@workflowasync def hello_world(name: str): """A simple example workflow.""" return {"message": f"Hello, {name}!", "org": context.org_id}Use the web UI editor to upload, or sync via the API.
Using SDK Features Locally
Section titled “Using SDK Features Locally”All SDK modules work in local development:
from bifrost import ai, knowledge, config
# AI completionsresponse = await ai.complete("Summarize this ticket")
# Knowledge storeawait knowledge.store("Policy content...", namespace="policies")results = await knowledge.search("refund policy", namespace="policies")
# Configurationapi_key = await config.get("external_api_key")IDE Setup
Section titled “IDE Setup”VS Code
Section titled “VS Code”Install the Python extension and configure your interpreter to the venv with bifrost-sdk installed. The SDK provides full type hints.
Environment Variables
Section titled “Environment Variables”Create a .env file in your project root:
BIFROST_API_URL=https://your-bifrost-instance.comThe SDK loads .env automatically via python-dotenv if installed.
Self-Hosted Development
Section titled “Self-Hosted Development”For contributors developing the platform itself, use Docker Compose:
-
Clone the repository:
Terminal window git clone https://github.com/jackmusick/bifrost.gitcd bifrost -
Start with hot reload:
Terminal window docker compose -f docker-compose.yml -f docker-compose.dev.yml up -
Access at
http://localhost:3000
| Service | Dev Behavior |
|---|---|
| api | Hot reload with uvicorn, debugpy on port 5678 |
| worker | Auto-restart on code changes |
| client | Vite dev server with HMR |