What are agents ?
Python agents are tasks that allow you to execute any Python or R code snippets on the fly. You can write custom code that modifies a Table
, generate a chart or call an external library directly in a task. Agents can be easily developed, modified and shared. In their config they include some parameters and a light version of a IDE to code directly in your lab.
Here is a simple python agent that transpose a Table
.
Types
There 2 type of agents that can answer different problematics.
Basic python agent
This is the simplest agent that allows you to write python code that takes resources as input and return resources. It only supports python code and already installed package. It can be useful to manipulate an existing resource.
See the following link for more information : Python agent
Virtual env agent
Virtual en agent allows you to execute agent code in virtual environment. With this you can use a Pip
, Conda
, Conda R
Mamba
or Mamba R
environment. Virtual env agents take a mandatory parameter that define the virtual environment.
As they use virtual environment to be executed, theses agents can only take File
or Folder
as input/output. Theses live task are not run in the context of a normal Task
.
See the following link for more information : Virtual env agent
Parameters
You can define parameter in the agent so it is more re-usable and theses can be modified by a person not used to code. Here is a example of parameters.
This will be directly added to you agent code automatically. It must respect the syntax of the agent language (Python or R).
Managing inputs and outputs
The inputs and outputs of the agents are dynamic, which means you can add or remove them manually. The task takes in a list of resources as input and gives back another list of resources as output.
To add an input or output, go to the Dashboard of the task and click the '+' button under the inputs or outputs list. You can also remove them by clicking the 'x' button.
Troubleshoot
To many resources in output target, expected X got Y
This error tells you that the targets
array size is bigger than the number of output created in the interface. Please follow the Managing inputs and outputs section above to see how to create new output. The length of the targets
array must be equals to the number of output in the agent.