Environments
Environments are used to store predefined code snippets and docker images for the use of Coder
agents with code execution.
Environments are automatically choosen based on what the user is trying to accomplish. For example, if the user is trying to perform some data analysis over a set of csv files using python code, if there is an environment with applicable libraries installed, that environment will be used.
In case no environment is found, the agent will use the default environment.
Environments can only be setup using python as programming language for now.
Code environment default setup
Available libraries:
- numpy
- pandas
- matplotlib
- PyPDF2
- pdfminer
- openpyxl
- xlsxWriter
- python-docx
- python-pptx
- xmltodict
- html2text
- matplotlib
- seaborn
- scikit-learn
- cmake
- pydantic
- Ppillow
- reportlab
- pytesseract
- fpdf
- tabula-py
- plotly
- prophet
- kaleido
- pyyaml
- lxml
- datetime
- statsmodels
- folium
- replicate
Max runtime memory: 10 GB
Max runtime duration: 15 minutes
Max runtime storage: 10 GB
Menu location
Environments can be created and or edited from the following menu:
Settings > Environments > Create
Create a environment
- Click on the
Create
button. - Fill in the code execution env. name and description. The name must be unique and the description meaningful for the agent to understand the purpose of the environment and when to use/
- Remote environment name (optional) - this will allow the agent to use a custom execution environment with the enterprise customer libraries and setup.
- Code execution instructions (optional) - this will guide the agent on how to generate and execute the code.
- Predefined code snippet (optional) - this will allow the agent to use a predefined code snippet to steer the generation of the code towards a predefined implementation.
- Click on the
Save
button to create the environment.
The code environments are available only for Enterprise plans. Please contact us for more information.
In order for the code environment to be used, it needs to be assigned to the agent. This can be done from the agent execution environments settings once code execution is enabled.
Additional options
Secrets to inject in execution environments: When enabled, the agent associated to the environment will be able to use secrets in the code. This is useful for environments where the code needs to interact with external services that require authentication or 3rd party libraries that require a license. Secrets can be created in the Authorisation
section of the Settings
menu. See more details here
Execute as static script: When enabled the agent associated to the environment will execute the code as a static script. This means that the agent will not be able to modify the code after it has been generated. This is useful for environments where the code needs to be exactly the same regardless of the nuances of the instructions. If you are dealing with files you can assume that all files used as input can be accessed under the folder /tmp/input
while all the generated files are inside the /tmp/output
folder.
Execute as python function: When enabled, the code execution selected can be encapsulated inside a Python function
that can be created in the Functions
settings. The idea behind this functionality is for the agent to execute a predefined function with the ability to inject parameters at runtime. When you want a parameter to be dynamic simpluy wrap the parameter with {{}}
and the agent will replace it with the value of the parameter at runtime.
Each dynamic parameter wrapped in {{}}
will be replaced with the value of the parameter at runtime. To do so, the Python function
encapsulating the code execution must have the same variable names inside the parameters field