File sensor agent example

# %% [markdown]
# # File Sensor
#
# This example shows how to use the `FileSensor` to detect files appearing in your local or remote filesystem.
#
# First, import the required libraries.

# %%
import union
from flytekit.sensor.file_sensor import FileSensor

# %% [markdown]
# Next, create a FileSensor task.

# %%
sensor = FileSensor(name="test_file_sensor")

# %% [markdown]
# To use the FileSensor created in the previous step, you must specify the path parameter. In the sandbox, you can use the S3 path.


# %%
@union.task()
def t1():
    print("SUCCEEDED")


@union.workflow()
def wf():
    sensor(path="s3://my-s3-bucket/file.txt") >> t1()