Skip to content

YepCode Coding Rules

This file provides guidelines for LLMs to write source code compatible with the YepCode platform and ready to use it’s specific helpers.

Download this file

YepCode is an enterprise-ready integration and automation platform that offers comprehensive features for API integrations, workflow automation, and data processing. It excels in providing enterprise-grade sandboxing and security measures specifically designed for running code generated by LLMs.

This offers developers a familiar coding environment, while handling all the infrastructure concerns, security measures, and dependency management automatically.

  • Basic unit of execution in YepCode
  • Contains business logic written in JavaScript (NodeJS v22) or Python (v3.13)
  • Each process may have input parameters, that are defined using a JSON Schema file (parametersSchema.json) and can be accessed during execution using the yepcode.context.parameters object
  • If you use the YepCode CLI, the copy of your YepCode workspace in your local environment will have the following folder structure:
📦 <workspace-name>
┣ 📂 modules
┃ ┣ 📂 <javascript-module-slug>
┃ ┃ ┗ 📜 <module-slug>.js
┃ ┣ 📂 <python-module-slug>
┃ ┃ ┗ 📜 <module-slug>.py
┃ ┣ 📂 <module-with-versions>
┃ ┃ ┣ 📂 versions
┃ ┃ ┃ ┣ 📂 v1.0
┃ ┃ ┃ ┃ ┗ 📜 <module-slug>.js
┃ ┃ ┃ ┗ 📂 ...
┃ ┃ ┗ 📜 <module-slug>.js
┃ ┗ 📂 ...
┣ 📂 processes
┃ ┣ 📂 <javascript-process-slug>
┃ ┃ ┣ 📜 README.md
┃ ┃ ┣ 📜 index.js
┃ ┃ ┣ 📜 parametersSchema.json
┃ ┃ ┗ 📜 parameters.json
┃ ┣ 📂 <python-process-slug>
┃ ┃ ┣ 📜 README.md
┃ ┃ ┣ 📜 main.py
┃ ┃ ┣ 📜 parametersSchema.json
┃ ┃ ┗ 📜 parameters.json
┃ ┣ 📂 <process-slug-with-versions>
┃ ┃ ┣ 📂 versions
┃ ┃ ┃ ┣ 📂 v1.0
┃ ┃ ┃ ┃ ┣ 📜 README.md
┃ ┃ ┃ ┃ ┣ 📜 index.js
┃ ┃ ┃ ┃ ┣ 📜 parametersSchema.json
┃ ┃ ┃ ┃ ┗ 📜 parameters.json
┃ ┃ ┃ ┗ 📂 ...
┃ ┃ ┣ 📜 README.md
┃ ┃ ┣ 📜 index.js
┃ ┃ ┣ 📜 parametersSchema.json
┃ ┃ ┗ 📜 parameters.json
┃ ┗ 📂 ...
┣ 📜 datastore.json
┣ 📜 variables.env
┣ 📜 variables.local.env
┣ 📜 .gitignore
┗ 📂 .yepcode
- `processes`: Processes' source code, with one folder per process, containing process files.
- `README.md`: Markdown file with the process description.
- `index.js` or `index.py`: Process source code in JavaScript or Python.
- `parametersSchema.json`: Parameters schema JSON file.
- `parameters.json`: Sample input file dynamically generated. It will be used as default input file in local executions, but you may provide another one.
- `versions`: if process has published versions, a new folder will exists and each version folder will have a process replica with the published contents.
- `modules`: Modules' source code, with one folder per module, containing the module file.
- `versions`: if module has published versions, a new folder will exists and each version folder will have a module replica with the published contents.
- `variables.env`: Includes all team variables in .env file format (KEY=VALUE).
- `variables.local.env`: Local environment variables that override `variables.env`.
- `datastore.json`: YepCode datastore file.
- `.gitignore`: Auto generated gitignore file. It will be used if you create a git repo for this directory to ignore sensitive resources (variables .env).
- `.yepcode`: YepCode workspace metadata directory.
  • Reusable code libraries shared across processes
  • Help maintain DRY (Don’t Repeat Yourself) principle
  • Support versioning for better code management
  • Each process runs in an isolated environment
  • Has access to:
    • Input parameters
    • Environment variables
    • Execution metadata
    • Process information
    • Team settings
    • Request data (for webhooks)
  • Key-value pairs available across processes
  • Can store sensitive information securely
  • Accessible via environment variables or yepcode.env
  • Key-value storage system for data persistence
  • Share data between process executions
  • Available in paid plans with specific limits
  • Useful for maintaining state and caching
  • Follow the language-specific code style guidelines
  • Handle errors appropriately and provide meaningful error messages (errors may be thrown for failed executions)
  • Use logging for debugging and tracking execution state
  • Validate input parameters when needed
  • Use environment variables for sensitive data
  • Do not use hardcoded values and suggest to change it to input parameters or to env vars
  • Use appropriate status codes for responses
  • Use NodeJS v20 features
  • Wrap code in async function for await support
  • Export functions using module.exports for modules
  • Use ES6+ features when appropriate
async function main() {
// Access input parameters
const { parameters } = yepcode.context;
// Your code here
// Return result
return { "message": "Success!" };
}
module.exports = { main };
  • Access execution info: const { id, comment } = yepcode.execution;
  • Access process info: const { id: processId, name: processName } = yepcode.execution.process;
  • Access schedule info: const { id: scheduleId, comment: scheduleComment } = yepcode.execution.schedule;
  • Access team timezone: const timezone = yepcode.execution.timezone;
  • Use environment variables: const apiKey = process.env.API_KEY // (or yepcode.env.API_KEY);
  • Import YepCode modules: const { myFunc } = yepcode.import("module-name");
  • Import YepCode modules with specific version: const { myFunc } = yepcode.import("module-name", "v1.0");
  • Run another process: await yepcode.processes.run("process-identifier", options);
console.log('INFO message');
console.debug('DEBUG message');
console.info('INFO message');
console.warn('WARNING message');
console.error('ERROR message');
  • You may use external npm packages
  • Just add the require statement to the code and the package will be installed automatically
  • If package import name is different than the package name, you must use the the add-package comment:
// @add-package axios
const axios = require('axios');
const path = require('path');
// Calculate the path to the temporary file
const filePath = path.join(process.env.TMP_DATA_DIR, 'myfile.txt');
// Writing a file
const fs = require('fs');
fs.writeFileSync(filePath, 'Hello from YepCode!');
// Setting a value
await yepcode.datastore.set("key", "value");
// Getting a value
const value = await yepcode.datastore.get("key");
// Deleting a value
await yepcode.datastore.del("key");
const path = require("node:path");
const localPath = path.join(process.env.TMP_DATA_DIR, "localfile.txt");
// Uploading a file
await yepcode.storage.upload("path/myfile.txt", fs.createReadStream(localPath));
// Listing files
const files = await yepcode.storage.list();
// Downloading a file
const stream = await yepcode.storage.download("path/myfile.txt");
stream.pipe(fs.createWriteStream(localPath));
// Deleting a file
await yepcode.storage.delete("path/myfile.txt");
return { "message": "Success!" };
  • This is the format for custom HTTP status codes:
return {
status: 404,
body: { "message": "Not found" },
headers: { "Content-Type": "application/json" }
return {
transient: true,
data: sensitiveData
};
  • Use Python 3.13 features
  • Define main() function for debugging support
  • Use type hints when appropriate
  • Follow PEP 8 style guidelines
def main():
# Access input parameters
parameters = yepcode.context.parameters
# Your code here
# Return result
return { "message": "Success!" }
  • Access execution info: id, comment = yepcode.execution.id, yepcode.execution.comment
  • Access process info: processId, processName = yepcode.execution.process.id, yepcode.execution.process.name
  • Access schedule info: scheduleId, scheduleComment = yepcode.execution.get("schedule", {}).values()
  • Access team timezone: timezone = yepcode.execution.timezone
  • Use environment variables: api_key = os.getenv("API_KEY") # (or yepcode.env.API_KEY)
  • Import YepCode modules: my_func = yepcode.import_module("module-name")
  • Import YepCode modules with specific version: my_func = yepcode.import_module("module-name", "v1.0")
  • Run another process: yepcode.processes.run("process-identifier", options)
print("INFO message") # Generates INFO level log
logger.debug("DEBUG message")
logger.info("INFO message")
logger.warn("WARNING message")
logger.error("ERROR message")
  • You may use external npm packages
  • Just add the require statement to the code and the package will be installed automatically
  • If package import name is different than the package name, you must use the the add-package comment:
# @add-package requests
import requests
import os
# Calculate the path to the temporary file
file_path = os.path.join(os.environ.get("TMP_DATA_DIR"), "myfile.txt")
# Writing a file
with open(file_path, 'w') as f:
f.write('Hello from YepCode!')
# Setting a value
yepcode.datastore.set("key", "value");
# Getting a value
value = yepcode.datastore.get("key");
# Deleting a value
yepcode.datastore.delete("key");
import os
local_path = os.path.join(os.environ.get("TMP_DATA_DIR"), "localfile.txt")
// Uploading a file
with open(local_path, "rb") as f:
obj = yepcode.storage.upload("path/myfile.txt", f)
print("Uploaded:", obj.name, obj.size, obj.link)
// Listing files
objects = yepcode.storage.list()
// Downloading a file
content = yepcode.storage.download("path/myfile.txt")
with open(local_path, "wb") as f:
f.write(content)
// Deleting a file
yepcode.storage.delete("path/myfile.txt")
return { "message": "Success!" }
  • This is the format for custom HTTP status codes:
return {
"status": 404,
"body": { "message": "Not found" },
"headers": { "Content-Type": "application/json" }
}
return {
"transient": True,
"data": sensitive_data
}