Agent to run Python snippets directly in the global environment. The input data and parameters are passed in memory to the snippet.
Python agents allow to execute any Python code snippets on the fly.
Agents are fast and efficient tools to develop, test, use and share code snippets.
Warning: It is recommended to use code snippets comming from trusted sources.
Here is the general documentation for agent (including how to use the parameters): https://constellab.community/bricks/gws_core/latest/doc/developer-guide/agent/getting-started/69820653-52e0-41ba-a5f3-4d9d54561779
Here is the documentation of the agent: https://constellab.community/bricks/gws_core/latest/doc/developer-guide/agent/env-agent/c6acb3c3-2a7c-44cd-8fb2-ea1beccdbdcc
Input
Output
Configuration
params
Please give one parameter definition per line (https://constellab.community/bricks/gws_core/latest/doc/developer-guide/agent/getting-started/69820653-52e0-41ba-a5f3-4d9d54561779#parameters)
list
code
Python code snippet to run
python_code_param
# This is a snippet template for a python agent.
# This code is executed in the same context as the run method of a Task.
# This mean you can import brick or packages and call method of the Task object.
# HOW TO?
# 2 variables are reserved in a python agent
# - sources: array containing the input resource
# - targets: array that must be filled with output resources
# Import modules
from gws_core import Table
# access task method to log a messages
self.log_info_message('Transposing table')
# Transpose the input table
table: Table = sources[0].transpose()
# set the new table a output or the agent
targets = [table]