Dynamiq
Platform Integration

Deploy from the SDK

Package an SDK application as a container and deploy it to Dynamiq as a service with the dynamiq CLI — from source build or prebuilt image.

The dynamiq package ships a CLI that deploys services — your own containers, including apps built with the SDK — onto the platform's managed infrastructure. You point it at a directory with a Dockerfile (or a prebuilt image), and the platform builds, runs, scales, and exposes it under its own hostname.

Be precise about what deploys where: the CLI deploys services (custom containers). Workflow Apps — deployments of workflows built on the canvas — are created from the platform UI; see Deploy a Workflow App. A common pattern is to wrap an SDK workflow in a small HTTP server and deploy that server as a service.

Prerequisites

  • pip install dynamiq — the CLI installs as the dynamiq command.
  • CLI configured with your API host and a Personal Access Token, and an organization and project selected — see CLI Overview.

Example application

A minimal FastAPI server that runs an SDK workflow per request:

# app.py
import os

from fastapi import FastAPI
from pydantic import BaseModel

from dynamiq import Workflow
from dynamiq.connections import OpenAI as OpenAIConnection
from dynamiq.flows import Flow
from dynamiq.nodes.llms import OpenAI
from dynamiq.prompts import Message, Prompt

app = FastAPI()

llm = OpenAI(
    connection=OpenAIConnection(api_key=os.environ["OPENAI_API_KEY"]),
    model="gpt-4o-mini",
    prompt=Prompt(messages=[Message(role="user", content="{{question}}")]),
)
workflow = Workflow(flow=Flow(nodes=[llm]))


class Question(BaseModel):
    question: str


@app.post("/ask")
def ask(body: Question):
    result = workflow.run(input_data={"question": body.question})
    return result.output
# Dockerfile
FROM python:3.12-slim
WORKDIR /app
RUN pip install --no-cache-dir dynamiq fastapi uvicorn
COPY app.py .
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8080"]

Create and deploy the service

Create the service record

dynamiq service create --name qa-service --access private

--access is private (default, requests need an Access Key) or public. The command prints the created service, including its id and hostname.

Deploy from source

From the project directory:

dynamiq service deploy --id <service-id> \
  --source ./ \
  --docker-file Dockerfile \
  --env-secret OPENAI_API_KEY "$OPENAI_API_KEY" \
  --min-replicas 1 --max-replicas 2

The CLI archives the source directory as a tarball, uploads it to POST /v1/services/{id}/deploy, and the platform builds the image and rolls it out. Alternatively, skip the build and deploy a prebuilt image with --image registry.example.com/qa-service:1.0.0.

Watch the rollout

dynamiq service status --id <service-id>

This prints the latest deployment record. dynamiq service get --id <service-id> shows the service itself, including the hostname your container is served on.

All service deploy flags — resources, autoscaling, env vars and secrets, command/args overrides, resource profiles — are documented in the CLI Reference.

Resource sizing

Either set explicit requests/limits:

dynamiq service deploy --id <service-id> \
  --cpu-requests 250m --memory-requests 512Mi \
  --cpu-limits 500m --memory-limits 1Gi

or pick a predefined resource profile and let the platform size the container:

dynamiq resource-profiles list --purpose service
dynamiq service deploy --id <service-id> --resource-profile <profile-id>

Programmatic deploys

There is no public Python deployment client in the SDK today — dynamiq.cli.client.ApiClient is an internal helper behind the CLI commands. For CI/CD, call the CLI from your pipeline (it is non-interactive once --id and flags are provided), or call the management API directly with a Personal Access Token; the CLI uses POST /v1/services and POST /v1/services/{id}/deploy under the hood.

Next steps

On this page