stdout and stderr.
The Execute Function API is designed to make it easier to pass values to and from
a function in a way that’s more natural to programmers and LLMs alike.
This API supports Python, JavaScript, and TypeScript. It requires you to write
your code in a specific way, with a function execute that takes a single
argument input. Your function must also return a value that can be serialized
to JSON.
Writing your execute function
The only rules are that your function must be named execute, take a single
argument input, and return a value that can be serialized to JSON. This
function will be passed as the code argument to your API call.
Passing input to the function
When calling the API, you can pass aninput argument to your request. This
will be passed to your function as the input argument. If you omit input in
your execution request, your function will receive null as input.
Output
The output of a function execution will contain both the output of the function as well as the execution details (exit_code, stdout, stderr).
We will also return an output_status field, which will be valid if the
function returned a valid JSON object; json_serialization_error if the
function returned a value that could not be serialized to JSON; and
error if your function raised an error during execution.