cuddly-jelly-27016
05/28/2025, 12:09 AMclick types input.
### Expected behavior
it should work.
### Additional context to reproduce
env:
python 3.12, flytekit master branch
flyte backend: master branch
from textwrap import shorten
from flytekit import task, workflow
from dataclasses import dataclass
from typing import Any, Dict, Optional, List
from flytekit.core.type_engine import TypeEngine
from dataclasses_json import dataclass_json
from flyteidl.core.execution_pb2 import TaskExecution
from flytekit.core.context_manager import FlyteContextManager
from flytekit.configuration import SerializationSettings
from flytekit.core.base_task import PythonTask
from flytekit.core.interface import Interface
from flytekit.extend.backend.base_agent import (
AgentRegistry,
Resource,
SyncAgentBase,
SyncAgentExecutorMixin,
)
from flytekit.models.literals import LiteralMap
from flytekit.models.task import TaskTemplate
@dataclass_json
@dataclass
class Foo:
val: str
class FooAgent(SyncAgentBase):
def __init__(self) -> None:
super().__init__(task_type_name="foo")
def do(
self,
task_template: TaskTemplate,
inputs: Optional[LiteralMap] = None,
**kwargs: Any,
) -> Resource:
return Resource(
phase=TaskExecution.SUCCEEDED, outputs={"foos": [Foo(val="a"), Foo(val="b")], "has_foos": True}
)
AgentRegistry.register(FooAgent())
class FooTask(SyncAgentExecutorMixin, PythonTask): # type: ignore
_TASK_TYPE = "foo"
def __init__(self, name: str, **kwargs: Any) -> None:
task_config: dict[str, Any] = {}
outputs = {"has_foos": bool, "foos": Optional[List[Foo]]}
super().__init__(
task_type=self._TASK_TYPE,
name=name,
task_config=task_config,
interface=Interface(outputs=outputs),
**kwargs,
)
def get_custom(self, settings: SerializationSettings) -> Dict[str, Any]:
return {}
foo_task = FooTask(name="foo_task")
@task
def foos_task(foos: list[Foo]) -> None:
print(f"hi {foos}")
@workflow
def dc_wf(foos: list[Foo] = [Foo(val="a"), Foo(val="b")]) -> None:
has_foos, foos = foo_task()
foos_task(foos=foos)
if name == "__main__":
dc_wf([Foo(val="a"), Foo(val="b")])
### Screenshots
[image](https://private-user-images.githubusercontent.com/76461262/384775293-2a0918de-3782-4121-b964-f8d10eea0ed7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDgzOTEyOTQsIm5iZiI6MTc0ODM5MDk5NCwicGF0aCI6Ii83NjQ2MTI2Mi8zODQ3NzUyOTMtMmEwOTE4ZGUtMzc4Mi00MTIxLWI5NjQtZjhkMTBlZWEwZWQ3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTI4VDAwMDk1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM4YzEwMDM4NTI3YTk5Njc2OWY1ODAyOGE0YjM4NzI4ZjE0ZjQyM2VkYTQ5ZmUwMmJkMmMwZmYxMTNmNTExMzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.1pcPoe7UW53zbTCmFri28lG3o7Amx4tGBi_8aMrVWjY)
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flytecuddly-jelly-27016
05/28/2025, 12:10 AM