Core Concepts

Dafthunk is a platform for creating, executing, and monitoring visual workflows. It enables you to automate complex tasks by connecting different processing units, called nodes, in a drag-and-drop interface. Built on Cloudflare, Dafthunk leverages serverless functions for scalable execution and AI capabilities for intelligent processing.

Workflows

A Workflow is the blueprint for your automation. It's a visual representation of a series of steps, defined by connecting nodes together. Each workflow is saved within your organization and can be versioned and updated as your needs evolve. Think of it as the overall process you want to automate, like processing new user sign-ups or handling customer support tickets.

Nodes

Nodes are the individual building blocks of a workflow. Each node performs a specific task, such as making an HTTP request, running an AI model for text analysis, transforming data, or making a decision based on input. You connect nodes by their inputs and outputs to define the flow of data and logic.

Executions

An Execution is a single run of a workflow. Every time your workflow is triggered, an execution record is created. This record tracks the status of the run (e.g., submitted, executing, completed, or error), its inputs, outputs, and any logs. Executions are crucial for monitoring, debugging, and understanding how your workflows are performing.

Triggers

Triggers define how workflows are started. A workflow can have one or more triggers that initiate execution when a specific event occurs. Dafthunk supports several trigger types:

  • HTTP triggers: Add an HTTP trigger node to a workflow and it can be started with a request to /http/{workflowId}. HTTP triggers support both webhook (fire-and-forget) and request (synchronous response) modes, chosen by the trigger node type.
  • Queues: Message queues that trigger workflows when a message is published. Useful for decoupling producers from consumers and handling asynchronous workloads.
  • Emails: Email addresses that trigger workflows when a message is received, enabling email-driven automation.
  • Schedules: Cron-based schedules that trigger workflows at regular intervals.
  • Bots: Discord and Telegram bots that trigger workflows from chat messages.

Resources

Resources are shared assets that workflows can use during execution:

  • Schemas: Reusable definitions that describe the shape of records used in your workflows. Each schema has a name, description, and a set of typed fields. Use schemas to validate and enforce consistent data structures across nodes, ensuring that inputs and outputs conform to expected formats.
  • Databases: Managed SQLite databases for storing and querying structured data. Workflows can read from and write to databases using SQL nodes, and you can query them directly via the API.
  • Datasets: Collections of documents for Retrieval-Augmented Generation (RAG). Upload files to a dataset and use RAG nodes to search and retrieve relevant content within your workflows.
  • Secrets: Securely stored credentials and API keys that nodes can access at runtime (e.g., third-party API tokens). Secrets are encrypted and never exposed in workflow definitions or logs.
  • Integrations: OAuth connections to third-party services (e.g., Google, Slack, GitHub). Once configured, integration nodes can use these connections to interact with external APIs on your behalf.

Organizations

Dafthunk is designed for collaboration. Organizations serve as containers for your workflows, triggers, resources, and executions. Users belong to organizations and can collaborate on building and managing workflows based on their roles and permissions.

Practical Example

Let's illustrate with an example: generating an image from text and saving it.

  1. Design a Workflow: In your Dafthunk organization, you create a new Workflow. You connect the following nodes:
    • A "Parameter" node to accept a text prompt, for example, "a futuristic cityscape at sunset."
    • An "Image Generation" AI node, which takes the text prompt as input and produces an image.
    • An "HTTP Request" node configured to send the generated image to an external storage service or your own server for saving.
  2. Set Up a Trigger: Add an HTTP trigger node to your workflow. Enable the workflow to make it active.
  3. Trigger and Execute: You (or an external system) send a POST request containing the text prompt to /http/{workflowId}. This starts an Execution.
  4. Monitor the Result: In Dafthunk, you can observe the Execution. You'll see the input prompt, the successful generation of the image by the AI node, and the confirmation that the HTTP request node successfully sent the image data to your specified storage location. If any step failed, the execution status would indicate an error, allowing you to investigate.

This example shows how Dafthunk can orchestrate standard web tasks, all visually configured and monitored through Workflows, Triggers, and Executions.