Learn about functions in Modus
Functions in Modus are stateless, request-response operations that handle specific tasks with precision and speed. They get in, complete their objective, and report back—no unnecessary complications, no lingering presence, just pure operational efficiency.
You can think of a function as an endpoint—each function you write automatically becomes a callable API endpoint that external systems can access.
Functions are the backbone of your app, handling everything from data gathering to AI-powered analysis, all while maintaining clean, predictable behavior.
Functions are stateless, request-response operations designed for fast, predictable execution. They’re your go-to choice when you need quick data processing, external API integration, or computational tasks without maintaining state between requests.
When you deploy your functions, Modus automatically exposes them through a GraphQL API. Your functions become either queries (for data retrieval) or mutations (for data modifications) based on their operation type.
Most functions become GraphQL queries—perfect for fetching and processing data:
Your functions are now accessible via GraphQL:
Response:
Functions that modify data automatically become GraphQL mutations. Modus detects these by their operation prefixes:
Now you can execute data modifications:
Response:
Functions starting with create
, update
, delete
, and similar action words
automatically become mutations.
Here’s a complete example that demonstrates how functions integrate external APIs with AI models for intelligent data processing:
This function automatically becomes available as a GraphQL query:
You’ll receive an intelligence report like:
To use this function, you’ll need to:
Sign up for a free API key at OpenWeatherMap
Add the connections and models to your modus.json
:
Set your API key in .env.dev.local
:
Functions are perfect for most computational tasks, but when you need persistent state, complex multi-step workflows, or processes that remember details across multiple interactions, it’s time to consider agents.
Consider upgrading to agents when your use case requires:
Your functions form the API backbone of your app—fast, reliable, and always ready for the next request. They handle the immediate computational needs while your agents manage the long-term stateful processes.
Learn about functions in Modus
Functions in Modus are stateless, request-response operations that handle specific tasks with precision and speed. They get in, complete their objective, and report back—no unnecessary complications, no lingering presence, just pure operational efficiency.
You can think of a function as an endpoint—each function you write automatically becomes a callable API endpoint that external systems can access.
Functions are the backbone of your app, handling everything from data gathering to AI-powered analysis, all while maintaining clean, predictable behavior.
Functions are stateless, request-response operations designed for fast, predictable execution. They’re your go-to choice when you need quick data processing, external API integration, or computational tasks without maintaining state between requests.
When you deploy your functions, Modus automatically exposes them through a GraphQL API. Your functions become either queries (for data retrieval) or mutations (for data modifications) based on their operation type.
Most functions become GraphQL queries—perfect for fetching and processing data:
Your functions are now accessible via GraphQL:
Response:
Functions that modify data automatically become GraphQL mutations. Modus detects these by their operation prefixes:
Now you can execute data modifications:
Response:
Functions starting with create
, update
, delete
, and similar action words
automatically become mutations.
Here’s a complete example that demonstrates how functions integrate external APIs with AI models for intelligent data processing:
This function automatically becomes available as a GraphQL query:
You’ll receive an intelligence report like:
To use this function, you’ll need to:
Sign up for a free API key at OpenWeatherMap
Add the connections and models to your modus.json
:
Set your API key in .env.dev.local
:
Functions are perfect for most computational tasks, but when you need persistent state, complex multi-step workflows, or processes that remember details across multiple interactions, it’s time to consider agents.
Consider upgrading to agents when your use case requires:
Your functions form the API backbone of your app—fast, reliable, and always ready for the next request. They handle the immediate computational needs while your agents manage the long-term stateful processes.