Files
hatchet/examples/python/quickstart/workflows/first_task.py
matt 4a50e454a6 Fix: Python docs examples (#2255)
* feat: client example

* fix: batch i

* fix: batch ii

* fix: batch iii

* fix: batch iv
2025-09-05 15:08:23 -04:00

25 lines
491 B
Python

from pydantic import BaseModel
from hatchet_sdk import Context
from ..hatchet_client import hatchet
# > Simple task
class SimpleInput(BaseModel):
message: str
class SimpleOutput(BaseModel):
transformed_message: str
# Declare the task to run
@hatchet.task(name="first-task", input_validator=SimpleInput)
def first_task(input: SimpleInput, ctx: Context) -> SimpleOutput:
print("first-task task called")
return SimpleOutput(transformed_message=input.message.lower())