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
  • Triggers
  • ## Making your own functions
  • Adding inputs and outputs to your function
  • Events

Was this helpful?

Edit on GitHub
  1. Reference
  2. The Midio Language

Functions and Events

PreviousNodes and executionNextAnonymous functions

Last updated 2 months ago

Was this helpful?

In Midio, functions take input from the left and provide output on the right. Unlike most programming languages, such as JavaScript, Python, or C, Midio functions can produce multiple outputs. Functions in Midio are similar to those in other languages, and they form alongside events the core components of the language. Almost every node in Midio is either a function or an event. For information the builtin functions and events in Midio, refer to the .

Triggers

Some functions and events also has triggers, which are the green sockets. Functions with triggers need to be explicitly 'triggered' in order to be called, while non-triggable functions (functions without any triggers), are called 'on-demand', if connected to a node that is called.

## Making your own functions

You can easily make your own functions, either by selecting a group of nodes and using 'Convert to Function' from the right-click/context menu, or by right clicking a module in the modules over view and clicking 'Add function here'.

Adding inputs and outputs to your function

You can add inputs and output, either through the node-menu (space bar), or by control-clicking the canvas while your adding a new arrow. This will automatically add a new input/output to your function, and hook it up to the arrow you started.

TODO: Screen capture

Trigger input/output

Data input/output

Events

Events have a green header, and never any input triggers.

Triggers don't require much setup to use, but can optionally declare what context they consume or borrow (for inputs) or produce (for outputs). Contexts is a slightly advanced topic that you can read more about .

Data inputs can be assigned a type, if you want to be specific about the kinds of data it expects. If you don't care about the type, assign it to the Anytype. Use the dropdown menu on the input/output node to assign a new type.

Events are used to trigger flows, based on a variety of external conditions, like receiving an , or on a .

here
(read more about types here)
standard library
HTTP request
schedule
Add new function to the Main module.
Convert to function
You can change the type of data your inputs or outputs expect.