Midio docs
  • Getting Started
    • Welcome
    • Quick Start Guide
  • Your First Midio App
  • Guides
    • HTTP
      • Making HTTP Requests
      • Responding to HTTP Requests
      • How to reach your own endpoints
      • CORS
      • Server-Sent Events (SSE)
    • Branching
    • Loops
    • Map, filter, reduce
    • Working with Data
    • Expressions
    • Building Agents
      • Streaming Agent API (experimental)
    • Debugging
    • Secrets and Environment variables
    • Convert JSON to data nodes
    • Writing tests
    • Cleaning up your flows
  • Package Manager
  • Integrating with third party services
  • Troubleshooting
  • Tutorials
    • Connecting LLMs to MCP-servers using the MCP-client package
    • Making Your Own MCP Server in Midio
    • A Fast Path to Functional RAG Agents
    • How to build a streaming agent using Server-Sent Events (SSE)
  • Reference
    • The Midio Editor
      • The Node Editor
      • User Traces
      • Traces (execution)
      • Processes
      • Log
      • Services
      • Problems
      • Function Signature
      • Data
      • Settings
    • The Midio Language
      • Nodes and execution
      • Functions and Events
        • Anonymous functions
      • Modules
      • Contexts
      • Data type
      • Local variables
      • Portals
      • Waypoint node
      • Partial function application
  • The Midio Engine
  • Built in Nodes
    • Core (std)
    • HTTP
    • LLM
Powered by GitBook
On this page
  • The anatomy of a node
  • Execution order

Was this helpful?

Edit on GitHub
  1. Reference
  2. The Midio Language

Nodes and execution

PreviousThe Midio LanguageNextFunctions and Events

Last updated 2 months ago

Was this helpful?

The anatomy of a node

A node represents an instance of a function or event, with the original function or event being its declaration. Each node has input and output properties, as well as input and output triggers. Properties handle data acceptance and production, while triggers determine when a node is called.

Nodes without triggers are called on demand.

Execution order

Understanding the difference between triggers and properties is crucial. Properties pull data from their connected sources, while triggers pushes the flow of execution to the next trigger.

Example of execution order

  1. When a request is received matching the /hello endpoint with method GET and a query parameter name, the HttpEndpoint event is triggered.

  2. The Template node is then called, because the Log node depends on its result, and it doesn't have any triggers.

  3. The Log node is executed, with input from the Template node.

  4. The Template node is called again, since the HttpResponse node also depends on it.

  5. The HttpResponse node is called with input from the Template node.

Functions without triggers

Functions without any trigger inputs or outputs are called on demand, and don't cache their results, meaning that if several nodes depend on the output of a single non-triggerable node, it is called several times, like in the example above.

Functions with triggers can only be called by triggering them from a previous function or event, or by clicking the play-button in their header.

They do cache their results, meaning that as long as a triggered node has been called, any node that depends on any of its outputs will use the values from its last execution.

If a node depends on value from a triggered node which has not yet been called, the result will be null.

anatomy
execution_order
value from triggered node which hasn't been executed yet