---
title: Deploy Prefect with AI on Blossom
url: "/deploy/prefect/"
canonical_url: https://blossom88.com/deploy/prefect/
markdown_url: https://blossom88.com/deploy/prefect.md
summary: Run Python workflows with Prefect, a separate process worker, and Blossom
  Managed PostgreSQL and Redis.
categories:
- deployment
- workflows
- developer-tools
stack:
- Python
- PostgreSQL
- Redis
---

# Deploy Prefect with AI on Blossom

[Prefect](https://www.prefect.io/) runs Python workflows on demand or on a
schedule. Its dashboard shows each run’s status and the results your flow
publishes.

![A sample report generated by a Prefect process worker.](/deploy/assets/images/prefect/worker-result.webp)

## Ask Your Agent

> **Ask your AI agent:** Deploy Prefect on Blossom and help me run my first Python workflow.
>
> Follow this guide: https://blossom88.com/deploy/prefect/

[Install the Blossom CLI and skill](https://docs.blossom88.com/learn/getting-started/install/) on your agent's machine and choose a Blossom Cloud Location when you log in. You can also use [Blossom BYOC (bring your own cloud)](https://docs.blossom88.com/learn/getting-started/choose-your-cloud/#blossom-byoc).

## Run a Python Workflow

Create a process work pool and register a sample flow that adds up
workshop orders. Trigger it and open the resulting report in Prefect.

<details class="optional-reading" markdown="1">
<summary>Deployment setup and commands</summary>

Use the [official Prefect image](https://www.prefect.io/docs/v3/how-to-guides/self-hosted/docker-compose)
for three Services on App Capacity. Run the API and UI with
`prefect server start --no-services`, background services with
`prefect server services start`, and a process worker with
`prefect worker start --pool cedar-process --type process`. Package the
sample flow in the worker’s working directory.

Link managed PostgreSQL and Redis. For the API and background Services, use
the PostgreSQL link with a `postgresql+asyncpg://` scheme and set the
events broker and cache to `prefect_redis.messaging` with the Redis link as
`PREFECT_REDIS_MESSAGING_URL`. Set the UI’s API URL to
`BLOSSOM_SERVICE_URL` plus `/api`. Direct the worker to the internal API
address. Use Blossom Account access for the HTTPS dashboard and keep Prefect
API credentials in runtime variables.

    blossom profile:show
    blossom app:create --data app.yml
    blossom environment:create --data environment.yml
    blossom database_instance:create --data postgres.yml
    blossom cache_instance:create --data redis.yml
    blossom environment_link:create --data postgres-link.yml
    blossom environment_link:create --data redis-link.yml
    blossom service:create --data web.yml
    blossom service:create --data jobs.yml
    blossom service:create --data worker.yml
    blossom env_var:push --environment environment-100 --file .env.runtime
    blossom environment:deploy --id environment-100 --follow

</details>

## What You Get

- A private Prefect dashboard for flow runs and results
- A separate process worker that runs your Python workflows
