ControlFlow icon indicating copy to clipboard operation
ControlFlow copied to clipboard

cf.task creating Prefect task but inputs not logged

Open mattijsdp opened this issue 11 months ago • 1 comments

Description

When creating a task with the task decorator and calling that task inside a flow, if Prefect is configured correctly then this will create a Prefect flow and task. The inputs to the task in question though are not logged correctly. On the task page under task inputs for the example below it simply gives:

{
  "topic": []
}

Whereas I would expect:

{
  "topic": "roses"
}

Example Code

# In the terminal run:
# `prefect server start`
# `prefect config set PREFECT_API_URL=http://127.0.0.1:4200/api`
import controlflow as cf


@cf.task()
def write_poem(topic: str) -> str:
    """Write a poem about the topic"""

@cf.flow
def demo_flow():
    return write_poem(topic="roses")

if __name__ == "__main__":
    result = demo_flow()

Version Information

ControlFlow version: 0.12.0
Prefect version: 3.1.14
LangChain Core version: 0.3.31
Python version: 3.11.11
Platform: macOS-15.2-arm64-arm-64bit

Additional Context

No response

mattijsdp avatar Feb 02 '25 10:02 mattijsdp

Turns out I just misunderstood the Prefect functionality side of things. Task inputs only show task keys, not values. I was expecting it to show values, similar to this feature request https://github.com/PrefectHQ/prefect/issues/11301

mattijsdp avatar Feb 02 '25 10:02 mattijsdp