What a block does
A block declares its inputs, outputs, configuration, and behavior. The studio uses these declarations to build the palette and interface. Individual blocks are open source; check the license of any block you reuse.
Transform an input with Python
The Python block executes a run(inputs, outputs, params) function. The dictionaries use your port names. With the default in and out ports, this function converts text to uppercase.
def run(inputs, outputs, params):
text = str(inputs.get("in", ""))
outputs["out"] = text.upper()
The structure of a standalone block
In the source code, each block type lives in blocs/<kind>/. block.py contains its behavior, model.json its default parameters and ports, and README.md its documentation. Its specific templates, styles, and scripts stay in its directory.
The studio provides a common framework for execution and editing. Start with a block close to your needs and consult docs/framework-interfaces.md to follow its contracts.
Before proposing a block
- Define one responsibility and clear port names.
- Document dependencies, configuration, and execution side effects.
- Check its behavior in every execution mode it claims to support.
- Provide a minimal example, an error case, and an explicit license.
- Keep secrets in the appropriate local configuration.
Block or blueprint?
Create a block to add a reusable function. Create a blueprint to assemble existing functions and address a use case. A useful blueprint also explains when to use it and how to verify its result.