square-agency-59624
02/18/2026, 8:32 PMancient-wolf-19325
02/18/2026, 8:32 PMimport flytekit as fl
from flytekitplugins.optuna import Optimizer, suggest
image = fl.ImageSpec(packages=["flytekitplugins.optuna"])
@fl.task(container_image=image)
async def objective(x: float, y: int, z: int, power: int) -> float:
import math
return math.log((((x - 5) ** 2) + (y + 4) ** 4 + (3 * z - 3) ** 2)) ** power
@fl.eager(container_image=image)
async def train(concurrency: int, n_trials: int) -> float:
optimizer = Optimizer(objective=objective, concurrency=concurrency, n_trials=n_trials)
await optimizer(
x=suggest.float(low=-10, high=10),
y=suggest.integer(low=-10, high=10),
z=suggest.category([-5, 0, 3, 6, 9]),
power=2,
)
print(optimizer.study.best_value)
You can register and run this workflow using Flyte's CLI. Would you like a step-by-step breakdown or more details on customizing the search space or integrating with other ML frameworks?
Sources:
- flytekit-optuna README
- Flyte HPO Tutorial 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.square-agency-59624
02/19/2026, 11:46 PMancient-wolf-19325
02/19/2026, 11:46 PMfl.eager is a decorator in Flyte that enables "eager workflows," allowing you to write async Python functions that execute Flyte tasks and subworkflows with immediate, materialized outputs, rather than Flyte Promises. This lets you use native Python constructs (like await, loops, and conditionals) for highly flexible workflow logic, leveraging Python's asyncio API for true parallelism and local development convenience. Eager workflows are not compiled into workflow specs but are executed as Flyte tasks using the FlyteRemote interface for orchestration and authentication, and are especially useful for rapid iteration and debugging.
Would you like more detail or examples of how to use fl.eager in practice?
Sources:
- flytekit-optuna README
- Eager workflows user guide
- Flyte 1.10 release blog 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.