Back to bricks list
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version

Getting started

What are agents ?


Python agents are tasks that allow you to execute any Python or R code snippets on the fly. For example 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. 


Here is a simple python agent that transpose a Table.


Text editor image

How to create an agent ?


To create a agent, create a new scenario in your data lab. Search for process with name agent and add it to your scenario. (How to add a process to a scenario ?). It will show you all the different agent types. you can select the Python agent (which is the basic one) to test. 


Text editor image

Agent types


There 3 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


Streamlit agent


Streamlit agent allows you to execute python code (in a virtual environment or not) to generate a streamlit dashboard. 


You can refer to python agent documentation or virtual env agent documentation. The only difference is that streamlit agent have only 1 output which is the streamlit dashboard.


Manage parameters


Agents have dynamic parameters which allows you to configure the available parameters for this task. It might be useful if you want to share this agent with your team or with Community. 


Create a parameter


To add a parameter to your agent, follow these steps:


  1. Open the Agent Dashboard in the playground.
    1. Click on Edit Parameters at the top.
      1. A dialog will appear where you can manage agent parameters.
        1. Click Add a Parameter.
          1. Choose the type of parameter (e.g., string, number, code, etc.).
            1. Fill in details such as the name and a short description.
              1. Click Save.
                1. Your new parameter is now added to the agent. You can configure it and use it in your code like this: column_name = params['Column name']

                  Text editor image

                  Update a parameter


                  To modify an existing parameter, follow these steps:


                  1. Open the Agent Dashboard in the playground.
                    1. Click on Edit Parameters at the top.
                      1. A dialog will appear where you can manage agent parameters.
                        1. Find your parameter in the list and click the three-dot button next to it.
                          1. Select Edit.
                            1. Update the necessary information.
                              1. Click Save.

                                Your parameter is now updated.


                                Delete a parameter


                                To remove a parameter from your agent, follow these steps:


                                1. Open the Agent Dashboard in the playground.
                                  1. Click on Edit Parameters at the top.
                                    1. A dialog will appear where you can manage agent parameters.
                                      1. Find your parameter in the list and click the three-dot button next to it.
                                        1. Select Delete.

                                          Once deleted, the parameter can no longer be used in your code.


                                          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.


                                          Text editor image

                                          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.