Python processor
Along with the pre-made agents, you can provide your own processor agent as a Python application.
The Python application needs to follow a specific directory structure for this agent to successfully run.
Within the “application” directory create a directory named “python”.
Within that directory place the .py file with the class that will be the entry point.
The directory will look something like this:
For more on developing custom Python processor agents, see the Agent Developer Guide.
Example
Example python class located at ./application/python/example.py:
Configure the agent to use the python class:
The python application can optionally take in parameters from the application environment. The following is an example python application that is given a “config” object in its init
method.
The config object is a map that is built from the agent's pipeline.yaml:
Topics
Input
None, the message and configuration will be provided as input to the python function.
Implicit topic ?
Output
Structured as a langstream SimpleRecord
Implicit topic ?
Configuration
className
String (required)
A combination of the file name and the class name.
Example: For the file my-python-app.py that has class MyProcessor, the value would be my-python-app.MyProcessor
<any>
Additional configuration properties specific to the application.
Last updated