Lumalabs

LumaLabTools enables an Agent to generate media using the Lumalabs platform.

Prerequisites

1export LUMAAI_API_KEY=***

The following example requires the lumaai library. To install the Lumalabs client, run the following command:

1uv pip install -U lumaai

Example

The following agent will use Lumalabs to generate any video requested by the user.

1from kern.agent import Agent
2from kern.models.openai import OpenAIResponses
3from kern.tools.lumalab import LumaLabTools
4
5luma_agent = Agent(
6 name="Luma Video Agent",
7 model=OpenAIResponses(id="gpt-5.2"),
8 tools=[LumaLabTools()], # Using the LumaLab tool we created
9 markdown=True,
10 debug_mode=True,
11 instructions=[
12 "You are an agent designed to generate videos using the Luma AI API.",
13 "You can generate videos in two ways:",
14 "1. Text-to-Video Generation:",
15 "2. Image-to-Video Generation:",
16 "Choose the appropriate function based on whether the user provides image URLs or just a text prompt.",
17 "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.",
18 ],
19 system_message=(
20 "Use generate_video for text-to-video requests and image_to_video for image-based "
21 "generation. Don't modify default parameters unless specifically requested. "
22 "Always provide clear feedback about the video generation status."
23 ),
24)
25
26luma_agent.run("Generate a video of a car in a sky")

Toolkit Params

ParameterTypeDefaultDescription
api_keystrNoneIf you want to manually supply the Lumalabs API key.
enable_generate_videoboolTrueEnable the generate_video functionality.
enable_image_to_videoboolTrueEnable the image_to_video functionality.
allboolFalseEnable all functionality.

Toolkit Functions

FunctionDescription
generate_videoGenerate a video from a prompt.
image_to_videoGenerate a video from a prompt, a starting image and an ending image.

Developer Resources