LangChain

VideoGen tools for LangChain and LangGraph agents.

langchain-videogen is the official LangChain tool package for VideoGen. One call returns the full set of VideoGen tools in LangChain format, ready to bind to any LangChain or LangGraph agent. Your agent can turn a script into a finished narrated video, plus generate standalone images, video clips, voiceovers, sound effects, music, and talking-head avatars.

Every tool wraps the official videogen SDK and runs as the team that owns your API key.

Install

$pip install langchain-videogen

Setup

Get an API key from app.videogen.io/developers and set it as VIDEOGEN_API_KEY:

$export VIDEOGEN_API_KEY="sk_videogen_live_..."

Usage

1from langchain.chat_models import init_chat_model
2from langgraph.prebuilt import create_react_agent
3from langchain_videogen import create_videogen_tools
4
5tools = create_videogen_tools()
6
7agent = create_react_agent(init_chat_model("openai:gpt-4o"), tools)
8
9result = agent.invoke(
10 {
11 "messages": [
12 {"role": "user", "content": "Make a short narrated video about why hydration matters."}
13 ]
14 }
15)
16print(result["messages"][-1].content)

By default each tool blocks until the workflow run or tool execution reaches a terminal state (succeeded, failed, or cancelled) and returns the finished result.

Options

create_videogen_tools reads VIDEOGEN_API_KEY from the environment by default. Pass options to override, or use the VideoGenToolkit:

1from videogen import VideoGen
2from langchain_videogen import create_videogen_tools, VideoGenToolkit
3
4tools = create_videogen_tools(
5 client=VideoGen(api_key="sk_videogen_live_..."),
6 wait=False,
7 include=["script_to_video", "generate_image", "text_to_speech"],
8)
9
10# Or use the toolkit:
11toolkit = VideoGenToolkit.from_client()
12tools = toolkit.get_tools()
OptionDefaultDescription
clientA pre-configured VideoGen client.
api_keyVIDEOGEN_API_KEYAPI key used to build a client when client is omitted.
base_urlVIDEOGEN_BASE_URL or https://api.videogen.ioOverride the API base URL.
waitTrueBlock until the operation finishes and return the result. Set False to return immediately with the run/execution id.
poll_interval_msHow often to poll while waiting, in milliseconds.
timeout_msMaximum time to wait for a terminal state before giving up, in milliseconds.
includeall toolsRestrict the returned tool set to these tool names.

When wait is False, use the matching get_* tool (e.g. get_workflow_run, get_tool_execution) to poll the returned id yourself.

Tools

The package returns 34 tools. Tool names are snake_case (e.g. script_to_video, generate_image); parameters match the corresponding VideoGen SDK method.

  • Workflows (end-to-end video): script_to_video, voiceover_to_video, slideshow_to_video, storyboard_to_video, list_workflow_runs, get_workflow_run, cancel_workflow_run
  • Media generation: generate_image, generate_video_clip, text_to_speech, generate_sound_effect, generate_music, generate_avatar, vectorize_image, remove_image_background, remove_video_background, upscale_image, upscale_video, image_3d_effect, list_tool_executions, get_tool_execution, cancel_tool_execution
  • Projects: list_projects, get_project, export_project, remix_project, list_project_remix_actions
  • Files: upload_file, get_file, list_files
  • Resources & account: list_avatar_presenters, list_tts_voices, list_languages, get_me

For the full parameter list of each tool, see the MCP server reference — the same tools are exposed there — and the REST API reference.