Overview

Functions enable code authors to write logic that can be executed quickly in operational contexts, such as dashboards and applications designed to empower decision-making processes. This logic is executed on the server side in an isolated environment.

Notably, Functions include first-class support for authoring logic based on the Foundry ontology. This includes support for reading properties of various object types, traversing links, and flexibly making ontology edits.

Common use cases for Functions include:

  • Returning object sets or variable values for use in Workshop.
  • Displaying transformed values in a derived table column using Workshop's Function-backed Columns.
  • Aggregating object type values to display as Workshop charts.
  • Expressing a complex edit to the ontology that updates many objects through a Function Backed Action.
  • Running logic in the backend to return information to be displayed in the frontend in Slate.
  • Computing custom metrics or aggregations for display in Quiver.
  • Querying external systems to enrich objects in the Ontology through external functions

The languages supported by Functions are TypeScript ↗ and Python (Beta)↗.

To get started using Functions in Foundry, we recommend the following tutorials:

Function feature support by language

Not all features are supported by both languages. Refer to the chart below for language support for specific features.

Functions capabilitySupported in TypescriptSupported in PythonDescription
Ontology object supportYesYesThe ability to access Ontology objects in your function.
Ontology edits supportYesYesThe ability to edit Ontology objects in your function.
Queryable in WorkshopYesYesInvoking a function from a workshop app.
Usable in Pipeline BuilderNoYesCalling a function from Pipeline Builder pipelines.
Functions on models supportYesNoWriting functions that can be embedded within a model.
Semantic search supportYesNoUse functions to create vectors for semantic search.
External API call supportYesNoQuerying external services from within functions.
Serverless execution supportYesNoA serverless function will be spun up on demand when invoked.
Deployed execution supportNoYesA deployed function will have dedicated resources allocated to it, ready to serve requests.
Calling function from API GatewayYesYesThe ability to hit a Query function from the API gateway.
Marketplace supportYesNoThe ability to package and ship functions via Marketplace

Serverless function timeout

Currently, each serverless function is allocated a total of 60 seconds of wall time to run. This includes 30 seconds of CPU time and a 30-second buffer for any network delays. The function will fail if the timeout is exceeded.

Deployed function timeout

Currently, each deployed function is allocated a total of 60 seconds of wall time to run. The function will fail if the timeout is exceeded.