Skip to main content

SDK for building Flowire workflow nodes

Project description

Flowire SDK

SDK for building Flowire workflow nodes.

Installation

uv add flowire-sdk

For development:

uv add flowire-sdk --dev

Quick Start

Create a custom node by extending BaseNode:

from pydantic import BaseModel, Field
from flowire_sdk import BaseNode, BaseNodeOutput, NodeMetadata

# Define input schema
class GreetInput(BaseModel):
    name: str = Field(..., description="Name to greet")
    greeting: str = Field(default="Hello", description="Greeting to use")

# Define output schema (must extend BaseNodeOutput)
class GreetOutput(BaseNodeOutput):
    message: str = Field(..., description="The greeting message")

# Define the node
class GreetNode(BaseNode):
    input_schema = GreetInput
    output_schema = GreetOutput

    metadata = NodeMetadata(
        name="Greet",
        description="Generates a greeting message",
        category="utility",
        icon="👋",
    )

    async def execute_logic(self, validated_inputs, context):
        name = validated_inputs["name"]
        greeting = validated_inputs["greeting"]
        return GreetOutput(message=f"{greeting}, {name}!")

Core Concepts

BaseNode

The abstract base class all nodes inherit from. Provides:

  • Input/output validation via Pydantic schemas
  • Expression parsing for {{node-id.field}} references
  • Credential resolution via execution context

NodeMetadata

Configuration for node appearance and behavior:

metadata = NodeMetadata(
    name="My Node",              # Display name in UI
    description="Does X",        # Tooltip description
    category="utility",          # Category for organization
    icon="🔧",                   # Emoji or icon name
    color="#4CAF50",            # UI color (optional)
    is_entry_point=False,       # Can start a workflow
    skip_execution=False,       # Visual-only node (e.g., comments)
)

BaseNodeOutput

Base class for all node outputs. Supports routing:

# Simple output (passthrough routing)
return MyOutput(result=data)

# Conditional routing (activates specific handle)
return MyOutput(result=data, output_handle="success")

# Data split routing (different data per handle)
return MyOutput(outputs_data={"path_a": data_a, "path_b": data_b})

NodeExecutionContext

Abstract context provided during execution with access to:

  • workflow_id, execution_id, node_id, project_id
  • node_results - outputs from previous nodes
  • resolve_credential() - decrypt stored credentials
  • resolve_project_variable() - access project variables

Credential Support

Nodes that need credentials define a credential schema:

class MyCredentialSchema(BaseModel):
    api_key: str = Field(..., description="API key")

class MyNode(BaseNode):
    credential_schema = MyCredentialSchema

    async def execute_logic(self, validated_inputs, context):
        cred_id = validated_inputs.get("credential_id")
        if cred_id:
            creds = await context.resolve_credential(
                cred_id,
                self.get_credential_type()
            )
            api_key = creds["api_key"]

Publishing Nodes

Package your nodes with entry points so Flowire auto-discovers them:

# pyproject.toml
[project.entry-points."flowire.nodes"]
my_node = "my_package.nodes:MyNode"
greet = "my_package.nodes:GreetNode"

See fw-nodes-core for a complete example.

Development

# Install with dev dependencies
just install

# Run linter
just lint

# Auto-fix lint issues
just lint-fix

# Format code
just format

# Run tests
just test

# Run all checks
just check

API Reference

Classes

Class Description
BaseNode Abstract base class for all nodes
BaseNodeOutput Base class for node outputs with routing support
NodeMetadata Node display and behavior configuration
NodeExecutionContext Abstract execution context interface
HandleConfig Configuration for connection handles
NodeHandles Input/output handle definitions

BaseNode Methods

Method Description
execute(inputs, context) Main entry point (handles parsing/validation)
execute_logic(validated_inputs, context) Override this for your logic
get_input_schema() Returns input Pydantic model
get_output_schema() Returns output Pydantic model
get_metadata() Returns NodeMetadata
resolve_expression(expr, context) Resolve a {{...}} expression

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flowire_sdk-0.0.1a2.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flowire_sdk-0.0.1a2-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file flowire_sdk-0.0.1a2.tar.gz.

File metadata

  • Download URL: flowire_sdk-0.0.1a2.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for flowire_sdk-0.0.1a2.tar.gz
Algorithm Hash digest
SHA256 b1042a478f122e422e505f9bf62f033e0bbf00b0817ba98960fb79de4547489c
MD5 8c32a1a34f2075c5ccf9bf0c12e6eae2
BLAKE2b-256 022042b67d5f0484aec4e36c9c4a2ccae5df15c7fff1fe011a1dc8d8c1f97b1d

See more details on using hashes here.

File details

Details for the file flowire_sdk-0.0.1a2-py3-none-any.whl.

File metadata

File hashes

Hashes for flowire_sdk-0.0.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 094292d8e289f6d64ddc1fe75e043ede2d92c2bdb267d1cef2a23947d96f7a71
MD5 b159a885c16a95421212ba065ec0b0b6
BLAKE2b-256 2d82b1b662bd98b29a0ab2a5242aa14af36cd795f72827ade77d425af9527ee8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page