> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/workflows/blocks/blocks/custom-blocks.md).

# Custom Blocks

Write and run your own logic in a Workflow with custom Python blocks.

When the built-in Blocks do not cover your use case, you can write your own logic in Python and run it as a Block inside a Workflow.

Custom Python blocks let you transform data, call external services, or implement bespoke logic without building and publishing a full plugin. The code lives inside the Workflow Definition itself and is compiled into a real Block at runtime. They run on self-hosted `inference` servers and on Dedicated Deployments, and on the Roboflow Serverless v2 API where they execute in isolated containers.

{% hint style="warning" %}
Self-hosted Inference keeps Custom Python enabled with local execution by default. Anyone allowed to submit that code can use the server process's permissions, so restrict access as described in [server security](https://docs.roboflow.com/deployment/self-hosted/inference-server/configuration/security). Set `ALLOW_CUSTOM_PYTHON_EXECUTION_IN_WORKFLOWS=False` to disable local execution; Modal execution is a separate mode.
{% endhint %}

## Next steps

* [Dynamic Python blocks](/workflows/developer-guide/developer-guide/dynamic-python-blocks.md) - the full reference for defining a block inside a Workflow Definition: manifest, dynamic inputs and outputs, the `run(...)` and `init(...)` methods, state management, and debugging.
* [Create a Workflow block](/workflows/developer-guide/developer-guide/create-a-block.md) - write a proper Block class when you need versioning, batch processing, flow control, or custom dimensionality.
* [Bundling blocks into a plugin](/workflows/developer-guide/developer-guide/block-bundling.md) - package your Blocks into an installable plugin so a whole team or the community can use them.
