crewai-videogen 2.5.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ build/
5
+ dist/
6
+ .venv/
7
+ .venv-test/
8
+ .pytest_cache/
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.5
2
+ Name: crewai-videogen
3
+ Version: 2.5.3
4
+ Summary: Official CrewAI tools for the VideoGen API. Generate videos, images, voiceovers, sound effects, music, and avatars from any CrewAI agent or crew.
5
+ Project-URL: Homepage, https://videogen.io
6
+ Project-URL: Documentation, https://github.com/video-gen/video-workflow-recipes/tree/main/integrations/crewai-videogen#readme
7
+ Project-URL: Repository, https://github.com/video-gen/video-workflow-recipes
8
+ License: MIT
9
+ Keywords: agents,ai,ai-video-generation,crew,crewai,image-generation,text-to-speech,text-to-video,tools,videogen
10
+ Requires-Python: >=3.10
11
+ Requires-Dist: crewai>=0.60.0
12
+ Requires-Dist: pydantic>=2.0.0
13
+ Requires-Dist: videogen>=2.5.3
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
16
+ Description-Content-Type: text/markdown
17
+
18
+ # crewai-videogen
19
+
20
+ Official [CrewAI](https://www.crewai.com) tools for the [VideoGen API](https://docs.videogen.io). Give any CrewAI agent or crew the ability to turn a script into a finished narrated video, plus generate standalone images, video clips, voiceovers, sound effects, music, and talking-head avatars.
21
+
22
+ Every tool wraps the official [`videogen`](https://pypi.org/project/videogen/) SDK and runs as the team that owns your API key.
23
+
24
+ ## Install
25
+
26
+ ```bash
27
+ pip install crewai-videogen
28
+ ```
29
+
30
+ ## Setup
31
+
32
+ Get an API key from [app.videogen.io/api](https://app.videogen.io/api) and set it as `VIDEOGEN_API_KEY`:
33
+
34
+ ```bash
35
+ export VIDEOGEN_API_KEY="your_api_key"
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```python
41
+ from crewai import Agent, Crew, Task
42
+ from crewai_videogen import create_videogen_tools
43
+
44
+ tools = create_videogen_tools()
45
+
46
+ producer = Agent(
47
+ role="Video Producer",
48
+ goal="Produce short narrated videos on request",
49
+ backstory="An expert at turning briefs into finished videos with VideoGen.",
50
+ tools=tools,
51
+ )
52
+
53
+ task = Task(
54
+ description="Make a short narrated video about why hydration matters.",
55
+ expected_output="A link to the finished video.",
56
+ agent=producer,
57
+ )
58
+
59
+ crew = Crew(agents=[producer], tasks=[task])
60
+ print(crew.kickoff())
61
+ ```
62
+
63
+ By default each tool blocks until the workflow or tool execution finishes and returns the completed result.
64
+
65
+ ## Options
66
+
67
+ ```python
68
+ from videogen import VideoGen
69
+ from crewai_videogen import create_videogen_tools
70
+
71
+ tools = create_videogen_tools(
72
+ # Provide a pre-configured client, or pass api_key / base_url, or rely on env.
73
+ client=VideoGen(api_key="your_api_key"),
74
+
75
+ # Return the run/execution id immediately instead of waiting.
76
+ wait=False,
77
+
78
+ # Only expose a subset of tools to the agent.
79
+ include=["script_to_video", "generate_image", "text_to_speech"],
80
+ )
81
+ ```
82
+
83
+ | Option | Default | Description |
84
+ | --- | --- | --- |
85
+ | `client` | — | A pre-configured `VideoGen` client. |
86
+ | `api_key` | `VIDEOGEN_API_KEY` | API key used to build a client when `client` is omitted. |
87
+ | `base_url` | `VIDEOGEN_BASE_URL` or production | Override the API base URL. |
88
+ | `wait` | `True` | Block until the operation finishes and return the result. |
89
+ | `poll_interval_ms` | SDK default | Poll interval while waiting. |
90
+ | `timeout_ms` | SDK default | Maximum time to wait before giving up. |
91
+ | `include` | all tools | Restrict the returned tool set to these tool names. |
92
+
93
+ ## Tools
94
+
95
+ <!-- BEGIN GENERATED PYTHON AGENT TOOLS -->
96
+ - Workflows: `cancel_workflow_run`, `get_workflow_run`, `list_workflow_runs`, `prompt_to_video_clip`, `script_to_video`, `slideshow_to_video`, `storyboard_to_video`, `video_to_video`, `voiceover_to_video`.
97
+ - Media generation: `cancel_tool_execution`, `generate_avatar`, `generate_image`, `generate_motion_graphic`, `generate_music`, `generate_sound_effect`, `generate_video_clip`, `get_tool_execution`, `image_3d_effect`, `list_tool_executions`, `remove_image_background`, `remove_video_background`, `text_to_speech`, `upscale_image`, `upscale_video`, `vectorize_image`.
98
+ - Projects: `export_project`, `get_project`, `list_project_remix_actions`, `list_projects`, `remix_project`.
99
+ - Files: `get_file`, `list_files`, `upload_file`.
100
+ - Resources and account: `get_me`, `list_languages`, `list_tts_voices`.
101
+
102
+ Avatar generation and supported video workflows use reusable actor entities. Pass `actor_entity_id` and set `avatar_quality` to `LOW`, `STANDARD`, `HIGH`, or `MAX`. Narrator changes are passed in `remix_actions` as `CHANGE_NARRATOR` action dictionaries.
103
+ <!-- END GENERATED PYTHON AGENT TOOLS -->
104
+
105
+ ## Documentation
106
+
107
+ - [Use with AI agents](https://docs.videogen.io/use-with-ai-agents)
108
+ - [MCP server](https://docs.videogen.io/libraries/mcp)
109
+ - [API reference](https://docs.videogen.io)
110
+
111
+ ## License
112
+
113
+ MIT
114
+
115
+ ## Account and permissions
116
+
117
+ Generation and editing use your VideoGen account credits. Obtain user approval before invoking credit-consuming tools. Restrict the `include` list when an agent only needs read access. Keep API keys in server-side environment variables and out of shared transcripts.
118
+
119
+ [VideoGen](https://videogen.io/) · [MCP setup](https://videogen.io/videogen-mcp) · [Source](https://github.com/video-gen/video-workflow-recipes/tree/main/integrations/crewai-videogen)
@@ -0,0 +1,102 @@
1
+ # crewai-videogen
2
+
3
+ Official [CrewAI](https://www.crewai.com) tools for the [VideoGen API](https://docs.videogen.io). Give any CrewAI agent or crew the ability to turn a script into a finished narrated video, plus generate standalone images, video clips, voiceovers, sound effects, music, and talking-head avatars.
4
+
5
+ Every tool wraps the official [`videogen`](https://pypi.org/project/videogen/) SDK and runs as the team that owns your API key.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install crewai-videogen
11
+ ```
12
+
13
+ ## Setup
14
+
15
+ Get an API key from [app.videogen.io/api](https://app.videogen.io/api) and set it as `VIDEOGEN_API_KEY`:
16
+
17
+ ```bash
18
+ export VIDEOGEN_API_KEY="your_api_key"
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```python
24
+ from crewai import Agent, Crew, Task
25
+ from crewai_videogen import create_videogen_tools
26
+
27
+ tools = create_videogen_tools()
28
+
29
+ producer = Agent(
30
+ role="Video Producer",
31
+ goal="Produce short narrated videos on request",
32
+ backstory="An expert at turning briefs into finished videos with VideoGen.",
33
+ tools=tools,
34
+ )
35
+
36
+ task = Task(
37
+ description="Make a short narrated video about why hydration matters.",
38
+ expected_output="A link to the finished video.",
39
+ agent=producer,
40
+ )
41
+
42
+ crew = Crew(agents=[producer], tasks=[task])
43
+ print(crew.kickoff())
44
+ ```
45
+
46
+ By default each tool blocks until the workflow or tool execution finishes and returns the completed result.
47
+
48
+ ## Options
49
+
50
+ ```python
51
+ from videogen import VideoGen
52
+ from crewai_videogen import create_videogen_tools
53
+
54
+ tools = create_videogen_tools(
55
+ # Provide a pre-configured client, or pass api_key / base_url, or rely on env.
56
+ client=VideoGen(api_key="your_api_key"),
57
+
58
+ # Return the run/execution id immediately instead of waiting.
59
+ wait=False,
60
+
61
+ # Only expose a subset of tools to the agent.
62
+ include=["script_to_video", "generate_image", "text_to_speech"],
63
+ )
64
+ ```
65
+
66
+ | Option | Default | Description |
67
+ | --- | --- | --- |
68
+ | `client` | — | A pre-configured `VideoGen` client. |
69
+ | `api_key` | `VIDEOGEN_API_KEY` | API key used to build a client when `client` is omitted. |
70
+ | `base_url` | `VIDEOGEN_BASE_URL` or production | Override the API base URL. |
71
+ | `wait` | `True` | Block until the operation finishes and return the result. |
72
+ | `poll_interval_ms` | SDK default | Poll interval while waiting. |
73
+ | `timeout_ms` | SDK default | Maximum time to wait before giving up. |
74
+ | `include` | all tools | Restrict the returned tool set to these tool names. |
75
+
76
+ ## Tools
77
+
78
+ <!-- BEGIN GENERATED PYTHON AGENT TOOLS -->
79
+ - Workflows: `cancel_workflow_run`, `get_workflow_run`, `list_workflow_runs`, `prompt_to_video_clip`, `script_to_video`, `slideshow_to_video`, `storyboard_to_video`, `video_to_video`, `voiceover_to_video`.
80
+ - Media generation: `cancel_tool_execution`, `generate_avatar`, `generate_image`, `generate_motion_graphic`, `generate_music`, `generate_sound_effect`, `generate_video_clip`, `get_tool_execution`, `image_3d_effect`, `list_tool_executions`, `remove_image_background`, `remove_video_background`, `text_to_speech`, `upscale_image`, `upscale_video`, `vectorize_image`.
81
+ - Projects: `export_project`, `get_project`, `list_project_remix_actions`, `list_projects`, `remix_project`.
82
+ - Files: `get_file`, `list_files`, `upload_file`.
83
+ - Resources and account: `get_me`, `list_languages`, `list_tts_voices`.
84
+
85
+ Avatar generation and supported video workflows use reusable actor entities. Pass `actor_entity_id` and set `avatar_quality` to `LOW`, `STANDARD`, `HIGH`, or `MAX`. Narrator changes are passed in `remix_actions` as `CHANGE_NARRATOR` action dictionaries.
86
+ <!-- END GENERATED PYTHON AGENT TOOLS -->
87
+
88
+ ## Documentation
89
+
90
+ - [Use with AI agents](https://docs.videogen.io/use-with-ai-agents)
91
+ - [MCP server](https://docs.videogen.io/libraries/mcp)
92
+ - [API reference](https://docs.videogen.io)
93
+
94
+ ## License
95
+
96
+ MIT
97
+
98
+ ## Account and permissions
99
+
100
+ Generation and editing use your VideoGen account credits. Obtain user approval before invoking credit-consuming tools. Restrict the `include` list when an agent only needs read access. Keep API keys in server-side environment variables and out of shared transcripts.
101
+
102
+ [VideoGen](https://videogen.io/) · [MCP setup](https://videogen.io/videogen-mcp) · [Source](https://github.com/video-gen/video-workflow-recipes/tree/main/integrations/crewai-videogen)
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "crewai-videogen"
7
+ version = "2.5.3"
8
+ description = "Official CrewAI tools for the VideoGen API. Generate videos, images, voiceovers, sound effects, music, and avatars from any CrewAI agent or crew."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.10"
12
+ keywords = [
13
+ "videogen",
14
+ "crewai",
15
+ "ai",
16
+ "agents",
17
+ "crew",
18
+ "tools",
19
+ "text-to-video",
20
+ "ai-video-generation",
21
+ "text-to-speech",
22
+ "image-generation",
23
+ ]
24
+
25
+ dependencies = [
26
+ "videogen>=2.5.3",
27
+ "crewai>=0.60.0",
28
+ "pydantic>=2.0.0",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://videogen.io"
33
+ Documentation = "https://github.com/video-gen/video-workflow-recipes/tree/main/integrations/crewai-videogen#readme"
34
+ Repository = "https://github.com/video-gen/video-workflow-recipes"
35
+
36
+ [tool.hatch.build.targets.wheel]
37
+ packages = ["src/crewai_videogen"]
38
+
39
+ [project.optional-dependencies]
40
+ dev = ["pytest>=8.0.0"]
41
+
42
+ [tool.pytest.ini_options]
43
+ markers = [
44
+ "integration: live tests that call the VideoGen API (require VIDEOGEN_API_KEY)",
45
+ ]
46
+ testpaths = ["tests"]
@@ -0,0 +1,18 @@
1
+ """Official CrewAI tools for the VideoGen API."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ from .client import resolve_client
6
+ from .operations import Controls
7
+ from .toolkit import create_videogen_tools
8
+
9
+ __all__ = [
10
+ "Controls",
11
+ "create_videogen_tools",
12
+ "resolve_client",
13
+ ]
14
+
15
+ try:
16
+ __version__ = version("crewai-videogen")
17
+ except PackageNotFoundError:
18
+ __version__ = "0.0.0"
@@ -0,0 +1,47 @@
1
+ # AUTO-GENERATED from api/integrations/python-agent-templates/client.py. DO NOT EDIT.
2
+ """Client resolution for the VideoGen CrewAI integration."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import os
7
+ from typing import Optional
8
+
9
+ from videogen import VideoGen
10
+
11
+ _DEFAULT_BASE_URL = "https://api.videogen.io"
12
+
13
+
14
+ def resolve_client(
15
+ client: Optional[VideoGen] = None,
16
+ *,
17
+ api_key: Optional[str] = None,
18
+ base_url: Optional[str] = None,
19
+ ) -> VideoGen:
20
+ """Resolve a VideoGen client from an explicit client, an explicit key, or the environment.
21
+
22
+ Every tool call is authenticated as the team that owns the key.
23
+
24
+ Args:
25
+ client: A pre-configured ``VideoGen`` client. Used as-is when provided.
26
+ api_key: API key. Falls back to the ``VIDEOGEN_API_KEY`` environment variable.
27
+ base_url: API base URL. Falls back to ``VIDEOGEN_BASE_URL``, then production.
28
+ """
29
+ if client is not None:
30
+ return client
31
+
32
+ resolved_key = api_key or os.environ.get("VIDEOGEN_API_KEY")
33
+
34
+ if resolved_key is None or resolved_key.strip() == "":
35
+ raise ValueError(
36
+ "No VideoGen API key found. Pass `client` or `api_key`, or set the "
37
+ "VIDEOGEN_API_KEY environment variable. Create a key at "
38
+ "https://app.videogen.io/api."
39
+ )
40
+
41
+ resolved_base_url = base_url or os.environ.get("VIDEOGEN_BASE_URL") or _DEFAULT_BASE_URL
42
+
43
+ return VideoGen(
44
+ api_key=resolved_key.strip(),
45
+ base_url=resolved_base_url,
46
+ client_id="crewai",
47
+ )
@@ -0,0 +1,88 @@
1
+ # AUTO-GENERATED from api/integrations/python-agent-templates/operations.py. DO NOT EDIT.
2
+ """Shared helpers for starting and polling VideoGen operations."""
3
+
4
+ from __future__ import annotations
5
+
6
+ from dataclasses import dataclass
7
+ from typing import Any, Callable, Dict, Optional
8
+
9
+ from videogen import VideoGen
10
+ from videogen.poll_executed_tool import poll_executed_tool
11
+ from videogen.poll_project_export import poll_project_export
12
+ from videogen.poll_workflow_run import poll_workflow_run
13
+
14
+
15
+ @dataclass
16
+ class Controls:
17
+ """How the tools handle asynchronous VideoGen operations."""
18
+
19
+ wait: bool = True
20
+ poll_interval_ms: Optional[int] = None
21
+ timeout_ms: Optional[int] = None
22
+
23
+
24
+ def to_dict(obj: Any) -> Any:
25
+ """Convert an SDK response model into a plain, JSON-serializable structure."""
26
+ model_dump = getattr(obj, "model_dump", None)
27
+ if callable(model_dump):
28
+ return model_dump(mode="json")
29
+ return obj
30
+
31
+
32
+ def drop_none(values: Dict[str, Any]) -> Dict[str, Any]:
33
+ """Drop ``None``-valued keys so the SDK applies its own defaults."""
34
+ return {key: value for key, value in values.items() if value is not None}
35
+
36
+
37
+ def _poll_kwargs(controls: Controls) -> Dict[str, int]:
38
+ kwargs: Dict[str, int] = {}
39
+ if controls.poll_interval_ms is not None:
40
+ kwargs["poll_interval_ms"] = controls.poll_interval_ms
41
+ if controls.timeout_ms is not None:
42
+ kwargs["timeout_ms"] = controls.timeout_ms
43
+ return kwargs
44
+
45
+
46
+ def run_workflow(
47
+ client: VideoGen,
48
+ controls: Controls,
49
+ start: Callable[[], Any],
50
+ ) -> Any:
51
+ """Start a workflow and, unless ``wait`` is False, poll it to a terminal state."""
52
+ started = start()
53
+ if not controls.wait:
54
+ return to_dict(started)
55
+
56
+ run = poll_workflow_run(client, started["workflowRunId"], **_poll_kwargs(controls))
57
+ return to_dict(run)
58
+
59
+
60
+ def run_tool(
61
+ client: VideoGen,
62
+ controls: Controls,
63
+ start: Callable[[], Any],
64
+ ) -> Any:
65
+ """Start a media tool execution and, unless ``wait`` is False, poll it to a terminal state."""
66
+ started = start()
67
+ if not controls.wait:
68
+ return to_dict(started)
69
+
70
+ execution = poll_executed_tool(client, started["toolExecutionId"], **_poll_kwargs(controls))
71
+ return to_dict(execution)
72
+
73
+
74
+ def run_export(
75
+ client: VideoGen,
76
+ controls: Controls,
77
+ project_id: str,
78
+ start: Callable[[], Any],
79
+ ) -> Any:
80
+ """Start a project export and, unless ``wait`` is False, poll until the download URL is ready."""
81
+ started = start()
82
+ if not controls.wait:
83
+ return to_dict(started)
84
+
85
+ project_export = poll_project_export(
86
+ client, project_id, started["exportId"], **_poll_kwargs(controls)
87
+ )
88
+ return to_dict(project_export)
@@ -0,0 +1,46 @@
1
+ """Factory for the VideoGen CrewAI integration."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Iterable, List, Optional
6
+
7
+ from crewai.tools import BaseTool
8
+ from videogen import VideoGen
9
+
10
+ from .client import resolve_client
11
+ from .operations import Controls
12
+ from .tools import build_videogen_tools
13
+
14
+
15
+ def create_videogen_tools(
16
+ client: Optional[VideoGen] = None,
17
+ *,
18
+ api_key: Optional[str] = None,
19
+ base_url: Optional[str] = None,
20
+ wait: bool = True,
21
+ poll_interval_ms: Optional[int] = None,
22
+ timeout_ms: Optional[int] = None,
23
+ include: Optional[Iterable[str]] = None,
24
+ ) -> List[BaseTool]:
25
+ """Build VideoGen tools in CrewAI format, ready to pass to an ``Agent`` or ``Crew``.
26
+
27
+ Args:
28
+ client: A pre-configured ``VideoGen`` client. When omitted, one is built
29
+ from ``api_key`` / ``base_url`` or the ``VIDEOGEN_API_KEY`` environment variable.
30
+ wait: When True (default), tools block until the workflow run or tool execution
31
+ finishes and return the completed result. Set False to return immediately
32
+ with the run/execution id for the caller to poll.
33
+ poll_interval_ms: Poll interval while waiting. Defaults to the SDK's default.
34
+ timeout_ms: Maximum time to wait before giving up. Defaults to the SDK's default.
35
+ include: Restrict the returned tool set to these tool names. Defaults to all tools.
36
+ """
37
+ resolved_client = resolve_client(client, api_key=api_key, base_url=base_url)
38
+ controls = Controls(wait=wait, poll_interval_ms=poll_interval_ms, timeout_ms=timeout_ms)
39
+
40
+ tools = build_videogen_tools(resolved_client, controls)
41
+
42
+ if include is None:
43
+ return tools
44
+
45
+ included = set(include)
46
+ return [tool for tool in tools if tool.name in included]