Lumalabs
LumaLabTools let an agent generate text-to-video and image-to-video content using the Luma AI Dream Machine API.
LumaLabTools enables an Agent to generate media using the Lumalabs platform.
Prerequisites
export LUMAAI_API_KEY=***The following example requires the lumaai library. To install the Lumalabs client, run the following command:
uv pip install -U agno lumaai openaiExample
The following agent will use Lumalabs to generate any video requested by the user.
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.lumalab import LumaLabTools
luma_agent = Agent(
name="Luma Video Agent",
model=OpenAIResponses(id="gpt-5.2"),
tools=[LumaLabTools()], # Using the LumaLab tool we created
markdown=True,
debug_mode=True,
instructions=[
"You are an agent designed to generate videos using the Luma AI API.",
"You can generate videos in two ways:",
"1. Text-to-Video Generation: use the generate_video function for creating videos from text prompts",
"2. Image-to-Video Generation: use the image_to_video function when starting from one or two images",
"Choose the appropriate function based on whether the user provides image URLs or just a text prompt.",
"The video will be displayed in the UI automatically below your response, so you don't need to show the video URL in your response.",
],
system_message=(
"Use generate_video for text-to-video requests and image_to_video for image-based "
"generation. Don't modify default parameters unless specifically requested. "
"Always provide clear feedback about the video generation status."
),
)
luma_agent.run("Generate a video of a car in a sky")Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | None | If you want to manually supply the Lumalabs API key. |
wait_for_completion | bool | True | Whether to poll until video generation completes. |
poll_interval | int | 3 | Seconds between polling attempts. |
max_wait_time | int | 300 | Maximum seconds to wait for generation before timing out. |
enable_generate_video | bool | True | Enable the generate_video functionality. |
enable_image_to_video | bool | True | Enable the image_to_video functionality. |
all | bool | False | Enable all functionality. |
Toolkit Functions
| Function | Description |
|---|---|
generate_video | Generate a video from a prompt. |
image_to_video | Generate a video from a prompt, a starting image and an optional ending image. |
Run with the current Luma SDK
The cookbook calls an SDK method that now requires a model. Until the Agno adapter exposes it, supply that argument through an explicit local adaptation:
from functools import partial
from agno.agent import Agent
from agno.tools.lumalab import LumaLabTools
tools = LumaLabTools(wait_for_completion=True)
tools.client.generations.create = partial(tools.client.generations.create, model="ray-2")
agent = Agent(tools=[tools])
response = agent.run("Generate a short video of a car floating in the sky.")
if response.videos:
for video in response.videos:
if video.url:
print(video.url)
else:
print(response.content)Save this as luma_demo.py and run python luma_demo.py. It prints returned video URLs; a Python run() call does not create a UI or display video automatically. The adapter's wait_for_completion=False path currently returns Async generation unsupported without exposing a job ID. Keep waiting enabled, or manage asynchronous jobs directly through the Luma SDK.