composio-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.
- composio_videogen-2.5.3/.gitignore +8 -0
- composio_videogen-2.5.3/LICENSE +9 -0
- composio_videogen-2.5.3/PKG-INFO +125 -0
- composio_videogen-2.5.3/README.md +107 -0
- composio_videogen-2.5.3/pyproject.toml +45 -0
- composio_videogen-2.5.3/src/composio_videogen/__init__.py +20 -0
- composio_videogen-2.5.3/src/composio_videogen/client.py +47 -0
- composio_videogen-2.5.3/src/composio_videogen/operations.py +88 -0
- composio_videogen-2.5.3/src/composio_videogen/toolkit.py +89 -0
- composio_videogen-2.5.3/src/composio_videogen/tools.py +1098 -0
- composio_videogen-2.5.3/tests/test_native_toolkit.py +56 -0
- composio_videogen-2.5.3/tests/test_polling.py +38 -0
- composio_videogen-2.5.3/tests/test_toolkit.py +86 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VideoGen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: composio-videogen
|
|
3
|
+
Version: 2.5.3
|
|
4
|
+
Summary: Official Composio custom toolkit for the VideoGen API. Generate videos, images, voiceovers, sound effects, music, and avatars from any Composio agent.
|
|
5
|
+
Project-URL: Homepage, https://videogen.io
|
|
6
|
+
Project-URL: Documentation, https://github.com/video-gen/video-workflow-recipes/tree/main/integrations/composio-videogen#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/video-gen/video-workflow-recipes
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agents,ai,ai-video-generation,composio,image-generation,text-to-speech,text-to-video,tools,videogen
|
|
11
|
+
Requires-Python: <3.16,>=3.11
|
|
12
|
+
Requires-Dist: composio<0.31,>=0.30.0
|
|
13
|
+
Requires-Dist: pydantic>=2.0.0
|
|
14
|
+
Requires-Dist: videogen>=2.5.3
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# composio-videogen
|
|
20
|
+
|
|
21
|
+
Official [Composio](https://composio.dev) custom toolkit for the [VideoGen API](https://docs.videogen.io). Give any Composio agent 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.
|
|
22
|
+
|
|
23
|
+
Every tool wraps the official [`videogen`](https://pypi.org/project/videogen/) SDK and runs as the team that owns your API key.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
Requires Python 3.11–3.15 and Composio 0.30.x.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install composio-videogen
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Setup
|
|
34
|
+
|
|
35
|
+
Get an API key from [app.videogen.io/api](https://app.videogen.io/api) and set it as `VIDEOGEN_API_KEY`:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
export VIDEOGEN_API_KEY="your_api_key"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
`create_videogen_toolkit()` returns a Composio custom toolkit. Pass it to a session via `experimental={"custom_toolkits": [...]}`, and `session.tools()` returns your VideoGen tools alongside any other Composio tools.
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from composio import Composio
|
|
47
|
+
from composio_videogen import create_videogen_toolkit
|
|
48
|
+
|
|
49
|
+
composio = Composio()
|
|
50
|
+
videogen = create_videogen_toolkit(composio, include=["get_me", "list_files"])
|
|
51
|
+
|
|
52
|
+
session = composio.create(
|
|
53
|
+
user_id="default",
|
|
54
|
+
experimental={"custom_toolkits": [videogen]},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
tools = session.tools()
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
By default each tool blocks until the workflow or tool execution finishes and returns the completed result.
|
|
61
|
+
|
|
62
|
+
## Options
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from videogen import VideoGen
|
|
66
|
+
from composio_videogen import create_videogen_toolkit
|
|
67
|
+
|
|
68
|
+
videogen = create_videogen_toolkit(
|
|
69
|
+
composio,
|
|
70
|
+
|
|
71
|
+
# Provide a pre-configured client, or pass api_key / base_url, or rely on env.
|
|
72
|
+
client=VideoGen(api_key="your_api_key"),
|
|
73
|
+
|
|
74
|
+
# Return the run/execution id immediately instead of waiting.
|
|
75
|
+
wait=False,
|
|
76
|
+
|
|
77
|
+
# Only register a subset of tools.
|
|
78
|
+
include=["script_to_video", "generate_image", "text_to_speech"],
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
| Option | Default | Description |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| `composio` | — | A `Composio` client. When provided, the toolkit is created via `composio.experimental.Toolkit`; otherwise the toolkit class is used directly. |
|
|
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 registered tools to these tool names. |
|
|
92
|
+
| `slug` | `VIDEOGEN` | Toolkit slug (final tool slugs are `LOCAL_<slug>_<TOOL>`). |
|
|
93
|
+
| `name` | `VideoGen` | Human-readable toolkit name. |
|
|
94
|
+
| `description` | VideoGen summary | Toolkit description shown to the agent. |
|
|
95
|
+
| `preload` | `None` | When `True`, expose the toolkit's tools directly instead of via search. |
|
|
96
|
+
|
|
97
|
+
## Tools
|
|
98
|
+
|
|
99
|
+
<!-- BEGIN GENERATED PYTHON AGENT TOOLS -->
|
|
100
|
+
- 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`.
|
|
101
|
+
- 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`.
|
|
102
|
+
- Projects: `export_project`, `get_project`, `list_project_remix_actions`, `list_projects`, `remix_project`.
|
|
103
|
+
- Files: `get_file`, `list_files`, `upload_file`.
|
|
104
|
+
- Resources and account: `get_me`, `list_languages`, `list_tts_voices`.
|
|
105
|
+
|
|
106
|
+
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.
|
|
107
|
+
<!-- END GENERATED PYTHON AGENT TOOLS -->
|
|
108
|
+
|
|
109
|
+
## Documentation
|
|
110
|
+
|
|
111
|
+
- [Use with AI agents](https://docs.videogen.io/use-with-ai-agents)
|
|
112
|
+
- [MCP server](https://docs.videogen.io/libraries/mcp)
|
|
113
|
+
- [API reference](https://docs.videogen.io)
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT
|
|
118
|
+
|
|
119
|
+
## Account and permissions
|
|
120
|
+
|
|
121
|
+
Generation and editing use VideoGen credits. Obtain user approval before credit-consuming operations and expose only the tools the agent needs with `include`. The example above exposes only account and file-list tools. API keys belong in server-side environment variables. Upload tools send the selected local file to VideoGen; Composio receives tool definitions when you attach the toolkit to a session.
|
|
122
|
+
|
|
123
|
+
Tested with Composio 0.30.0 and VideoGen SDK 2.5.3 using offline discovery and in-memory HTTP routing/polling checks. A real hosted Composio session and paid media generation are not part of these checks.
|
|
124
|
+
|
|
125
|
+
[VideoGen](https://videogen.io/) · [MCP setup](https://videogen.io/videogen-mcp) · [Source](https://github.com/video-gen/video-workflow-recipes/tree/main/integrations/composio-videogen)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# composio-videogen
|
|
2
|
+
|
|
3
|
+
Official [Composio](https://composio.dev) custom toolkit for the [VideoGen API](https://docs.videogen.io). Give any Composio agent 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
|
+
Requires Python 3.11–3.15 and Composio 0.30.x.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install composio-videogen
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
Get an API key from [app.videogen.io/api](https://app.videogen.io/api) and set it as `VIDEOGEN_API_KEY`:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
export VIDEOGEN_API_KEY="your_api_key"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
`create_videogen_toolkit()` returns a Composio custom toolkit. Pass it to a session via `experimental={"custom_toolkits": [...]}`, and `session.tools()` returns your VideoGen tools alongside any other Composio tools.
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from composio import Composio
|
|
29
|
+
from composio_videogen import create_videogen_toolkit
|
|
30
|
+
|
|
31
|
+
composio = Composio()
|
|
32
|
+
videogen = create_videogen_toolkit(composio, include=["get_me", "list_files"])
|
|
33
|
+
|
|
34
|
+
session = composio.create(
|
|
35
|
+
user_id="default",
|
|
36
|
+
experimental={"custom_toolkits": [videogen]},
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
tools = session.tools()
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
By default each tool blocks until the workflow or tool execution finishes and returns the completed result.
|
|
43
|
+
|
|
44
|
+
## Options
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from videogen import VideoGen
|
|
48
|
+
from composio_videogen import create_videogen_toolkit
|
|
49
|
+
|
|
50
|
+
videogen = create_videogen_toolkit(
|
|
51
|
+
composio,
|
|
52
|
+
|
|
53
|
+
# Provide a pre-configured client, or pass api_key / base_url, or rely on env.
|
|
54
|
+
client=VideoGen(api_key="your_api_key"),
|
|
55
|
+
|
|
56
|
+
# Return the run/execution id immediately instead of waiting.
|
|
57
|
+
wait=False,
|
|
58
|
+
|
|
59
|
+
# Only register a subset of tools.
|
|
60
|
+
include=["script_to_video", "generate_image", "text_to_speech"],
|
|
61
|
+
)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
| Option | Default | Description |
|
|
65
|
+
| --- | --- | --- |
|
|
66
|
+
| `composio` | — | A `Composio` client. When provided, the toolkit is created via `composio.experimental.Toolkit`; otherwise the toolkit class is used directly. |
|
|
67
|
+
| `client` | — | A pre-configured `VideoGen` client. |
|
|
68
|
+
| `api_key` | `VIDEOGEN_API_KEY` | API key used to build a client when `client` is omitted. |
|
|
69
|
+
| `base_url` | `VIDEOGEN_BASE_URL` or production | Override the API base URL. |
|
|
70
|
+
| `wait` | `True` | Block until the operation finishes and return the result. |
|
|
71
|
+
| `poll_interval_ms` | SDK default | Poll interval while waiting. |
|
|
72
|
+
| `timeout_ms` | SDK default | Maximum time to wait before giving up. |
|
|
73
|
+
| `include` | all tools | Restrict the registered tools to these tool names. |
|
|
74
|
+
| `slug` | `VIDEOGEN` | Toolkit slug (final tool slugs are `LOCAL_<slug>_<TOOL>`). |
|
|
75
|
+
| `name` | `VideoGen` | Human-readable toolkit name. |
|
|
76
|
+
| `description` | VideoGen summary | Toolkit description shown to the agent. |
|
|
77
|
+
| `preload` | `None` | When `True`, expose the toolkit's tools directly instead of via search. |
|
|
78
|
+
|
|
79
|
+
## Tools
|
|
80
|
+
|
|
81
|
+
<!-- BEGIN GENERATED PYTHON AGENT TOOLS -->
|
|
82
|
+
- 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`.
|
|
83
|
+
- 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`.
|
|
84
|
+
- Projects: `export_project`, `get_project`, `list_project_remix_actions`, `list_projects`, `remix_project`.
|
|
85
|
+
- Files: `get_file`, `list_files`, `upload_file`.
|
|
86
|
+
- Resources and account: `get_me`, `list_languages`, `list_tts_voices`.
|
|
87
|
+
|
|
88
|
+
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.
|
|
89
|
+
<!-- END GENERATED PYTHON AGENT TOOLS -->
|
|
90
|
+
|
|
91
|
+
## Documentation
|
|
92
|
+
|
|
93
|
+
- [Use with AI agents](https://docs.videogen.io/use-with-ai-agents)
|
|
94
|
+
- [MCP server](https://docs.videogen.io/libraries/mcp)
|
|
95
|
+
- [API reference](https://docs.videogen.io)
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT
|
|
100
|
+
|
|
101
|
+
## Account and permissions
|
|
102
|
+
|
|
103
|
+
Generation and editing use VideoGen credits. Obtain user approval before credit-consuming operations and expose only the tools the agent needs with `include`. The example above exposes only account and file-list tools. API keys belong in server-side environment variables. Upload tools send the selected local file to VideoGen; Composio receives tool definitions when you attach the toolkit to a session.
|
|
104
|
+
|
|
105
|
+
Tested with Composio 0.30.0 and VideoGen SDK 2.5.3 using offline discovery and in-memory HTTP routing/polling checks. A real hosted Composio session and paid media generation are not part of these checks.
|
|
106
|
+
|
|
107
|
+
[VideoGen](https://videogen.io/) · [MCP setup](https://videogen.io/videogen-mcp) · [Source](https://github.com/video-gen/video-workflow-recipes/tree/main/integrations/composio-videogen)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "composio-videogen"
|
|
7
|
+
version = "2.5.3"
|
|
8
|
+
description = "Official Composio custom toolkit for the VideoGen API. Generate videos, images, voiceovers, sound effects, music, and avatars from any Composio agent."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.11,<3.16"
|
|
12
|
+
keywords = [
|
|
13
|
+
"videogen",
|
|
14
|
+
"composio",
|
|
15
|
+
"ai",
|
|
16
|
+
"agents",
|
|
17
|
+
"tools",
|
|
18
|
+
"text-to-video",
|
|
19
|
+
"ai-video-generation",
|
|
20
|
+
"text-to-speech",
|
|
21
|
+
"image-generation",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
dependencies = [
|
|
25
|
+
"videogen>=2.5.3",
|
|
26
|
+
"composio>=0.30.0,<0.31",
|
|
27
|
+
"pydantic>=2.0.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://videogen.io"
|
|
32
|
+
Documentation = "https://github.com/video-gen/video-workflow-recipes/tree/main/integrations/composio-videogen#readme"
|
|
33
|
+
Repository = "https://github.com/video-gen/video-workflow-recipes"
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.wheel]
|
|
36
|
+
packages = ["src/composio_videogen"]
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
dev = ["pytest>=8.0.0"]
|
|
40
|
+
|
|
41
|
+
[tool.pytest.ini_options]
|
|
42
|
+
markers = [
|
|
43
|
+
"integration: live tests that call the VideoGen API (require VIDEOGEN_API_KEY)",
|
|
44
|
+
]
|
|
45
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Official Composio custom toolkit 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_toolkit
|
|
8
|
+
from .tools import register_videogen_tools
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"Controls",
|
|
12
|
+
"create_videogen_toolkit",
|
|
13
|
+
"register_videogen_tools",
|
|
14
|
+
"resolve_client",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
__version__ = version("composio-videogen")
|
|
19
|
+
except PackageNotFoundError:
|
|
20
|
+
__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 Composio 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="composio",
|
|
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["workflow_run_id"], **_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["tool_execution_id"], **_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["export_id"], **_poll_kwargs(controls)
|
|
87
|
+
)
|
|
88
|
+
return to_dict(project_export)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""Factory for the VideoGen Composio custom toolkit."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Iterable, Optional
|
|
6
|
+
|
|
7
|
+
from videogen import VideoGen
|
|
8
|
+
|
|
9
|
+
from .client import resolve_client
|
|
10
|
+
from .operations import Controls
|
|
11
|
+
from .tools import register_videogen_tools
|
|
12
|
+
|
|
13
|
+
DEFAULT_TOOLKIT_SLUG = "VIDEOGEN"
|
|
14
|
+
DEFAULT_TOOLKIT_NAME = "VideoGen"
|
|
15
|
+
DEFAULT_TOOLKIT_DESCRIPTION = (
|
|
16
|
+
"Generate videos, images, voiceovers, sound effects, music, and talking-head "
|
|
17
|
+
"avatars with the VideoGen API."
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _new_toolkit(
|
|
22
|
+
composio: Optional[Any],
|
|
23
|
+
*,
|
|
24
|
+
slug: str,
|
|
25
|
+
name: str,
|
|
26
|
+
description: str,
|
|
27
|
+
preload: Optional[bool],
|
|
28
|
+
) -> Any:
|
|
29
|
+
"""Construct an empty Composio custom toolkit.
|
|
30
|
+
|
|
31
|
+
Uses ``composio.experimental.Toolkit`` when a client is provided, otherwise
|
|
32
|
+
falls back to the toolkit class directly so the package is usable without
|
|
33
|
+
first constructing a ``Composio`` client.
|
|
34
|
+
"""
|
|
35
|
+
if composio is not None:
|
|
36
|
+
return composio.experimental.Toolkit(
|
|
37
|
+
slug=slug, name=name, description=description, preload=preload
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
from composio.core.models.custom_tool import ExperimentalToolkit
|
|
41
|
+
|
|
42
|
+
return ExperimentalToolkit(slug=slug, name=name, description=description, preload=preload)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def create_videogen_toolkit(
|
|
46
|
+
composio: Optional[Any] = None,
|
|
47
|
+
*,
|
|
48
|
+
client: Optional[VideoGen] = None,
|
|
49
|
+
api_key: Optional[str] = None,
|
|
50
|
+
base_url: Optional[str] = None,
|
|
51
|
+
wait: bool = True,
|
|
52
|
+
poll_interval_ms: Optional[int] = None,
|
|
53
|
+
timeout_ms: Optional[int] = None,
|
|
54
|
+
include: Optional[Iterable[str]] = None,
|
|
55
|
+
slug: str = DEFAULT_TOOLKIT_SLUG,
|
|
56
|
+
name: str = DEFAULT_TOOLKIT_NAME,
|
|
57
|
+
description: str = DEFAULT_TOOLKIT_DESCRIPTION,
|
|
58
|
+
preload: Optional[bool] = None,
|
|
59
|
+
) -> Any:
|
|
60
|
+
"""Build a Composio custom toolkit exposing the full VideoGen tool set.
|
|
61
|
+
|
|
62
|
+
Pass the returned toolkit to ``composio.create(experimental={"custom_toolkits": [toolkit]})``.
|
|
63
|
+
``session.tools()`` then includes every VideoGen tool alongside your other Composio tools.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
composio: A ``Composio`` client. When provided, the toolkit is created via
|
|
67
|
+
``composio.experimental.Toolkit``; otherwise the toolkit class is used directly.
|
|
68
|
+
client: A pre-configured ``VideoGen`` client. When omitted, one is built from
|
|
69
|
+
``api_key`` / ``base_url`` or the ``VIDEOGEN_API_KEY`` environment variable.
|
|
70
|
+
wait: When True (default), tools block until the workflow run or tool execution
|
|
71
|
+
finishes and return the completed result. Set False to return immediately
|
|
72
|
+
with the run/execution id for the caller to poll.
|
|
73
|
+
poll_interval_ms: Poll interval while waiting. Defaults to the SDK's default.
|
|
74
|
+
timeout_ms: Maximum time to wait before giving up. Defaults to the SDK's default.
|
|
75
|
+
include: Restrict the registered tools to these tool names. Defaults to all tools.
|
|
76
|
+
slug: Toolkit slug (final tool slugs are ``LOCAL_<slug>_<TOOL>``).
|
|
77
|
+
name: Human-readable toolkit name.
|
|
78
|
+
description: Toolkit description shown to the agent.
|
|
79
|
+
preload: When True, expose the toolkit's tools directly instead of via search.
|
|
80
|
+
"""
|
|
81
|
+
resolved_client = resolve_client(client, api_key=api_key, base_url=base_url)
|
|
82
|
+
controls = Controls(wait=wait, poll_interval_ms=poll_interval_ms, timeout_ms=timeout_ms)
|
|
83
|
+
|
|
84
|
+
toolkit = _new_toolkit(
|
|
85
|
+
composio, slug=slug, name=name, description=description, preload=preload
|
|
86
|
+
)
|
|
87
|
+
register_videogen_tools(toolkit, resolved_client, controls, include=include)
|
|
88
|
+
|
|
89
|
+
return toolkit
|