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
- pipx recommended for CLI installation (or pip)
- Access to a Bifrost instance (cloud or self-hosted)
Quick Start
Section titled “Quick Start”-
Install the Bifrost CLI:
The SDK is served directly from your Bifrost instance:
Terminal window pipx install https://your-instance.gobifrost.com/api/cli/downloadOr with pip:
Terminal window pip install https://your-instance.gobifrost.com/api/cli/downloadVerify the installation:
Terminal window bifrost help -
Authenticate:
Terminal window bifrost login --url https://your-instance.gobifrost.comThis opens your browser for authentication. Credentials are saved to
~/.bifrost/credentials.jsonand refresh automatically. -
Start developing - write workflows locally and test them against your instance
Creating Workflows
Section titled “Creating Workflows”Create Python files locally and test them with the CLI:
from bifrost import workflow, context
@workflowasync def hello_world(name: str): """A simple example workflow.""" return {"message": f"Hello, {name}!", "org": context.org_id}Test locally:
bifrost run hello_world.py hello_world --params '{"name": "Alice"}'Sync to the platform:
bifrost watchThis watches your workspace and auto-syncs every file change. Keep it running while you develop.
Using SDK Features Locally
Section titled “Using SDK Features Locally”All SDK modules work in local development - they call the remote API using your saved credentials:
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 environment with the Bifrost SDK installed. The SDK provides full type hints.
Managing Credentials
Section titled “Managing Credentials”bifrost login --url https://your-instance.gobifrost.com # Authenticatebifrost logout # Clear credentialsTokens refresh automatically when expired. If refresh fails (e.g., password changed), run bifrost login again.
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-api.gitcd bifrost-api -
Run setup and start with hot reload:
Terminal window ./setup.sh./debug.sh -
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 |