World's first open-source, agentic video production system. 12 production pipelines, 100+ tools, 700+ agent skill and production-knowledge files. Turn your AI coding assistant into a full video production studio.
Python agentagentic-aiaiclaudecopilotcursorelevenlabsffmpegfluximage-generationopen-sourceopenaipythonremotionstable-diffusiontext-to-speechtext-to-videovideo-generationvideo-production
fix: complete Seedream provider integration
calesthio171866dbbf6c
diff --git a/docs/PROVIDERS.md b/docs/PROVIDERS.mdindex 497f78df..515af259 100644--- a/docs/PROVIDERS.md+++ b/docs/PROVIDERS.md@@ -145,7 +145,7 @@ The ASR tool (`qwen3-asr-flash-filetrans`) uses an async submit-poll pattern. Au> **Broad single-key coverage.** One API key unlocks image and video providers across multiple models.-**Tools unlocked:** `flux_image`, `recraft_image`, `kling_video`, `veo_video`, `minimax_video`+**Tools unlocked:** `flux_image`, `recraft_image`, `seedream_image`, `kling_video`, `veo_video`, `minimax_video`**Env var:** `FAL_KEY`#### Setup@@ -166,6 +166,8 @@ No subscription — pure pay-as-you-go, no minimum spend.| FLUX Pro v1.1 | $0.05/image | 20 images || FLUX Dev | $0.03/image | 33 images || Recraft v3 | ~$0.04/image | 25 images |+| Seedream 5 Pro (up to 1536x1536) | $0.0675/image | ~14 images |+| Seedream 5 Pro (up to 2048x2048) | $0.135/image | ~7 images |**Video generation:**diff --git a/tests/tools/test_seedream_image.py b/tests/tools/test_seedream_image.pyindex 9f95ca0d..4932a41d 100644--- a/tests/tools/test_seedream_image.py+++ b/tests/tools/test_seedream_image.py@@ -154,7 +154,7 @@ class TestCostEstimation:cost = seedream_tool.estimate_cost({"image_size": size, "num_images": 1})assert cost == pytest.approx(expected)- @pytest.mark.parametrize("n",[1, 2, 5, 10])+ @pytest.mark.parametrize("n", [1, 2, 3, 4])def test_cost_scales_with_num_images(self, seedream_tool, n):cost = seedream_tool.estimate_cost({"image_size": "auto_2K", "num_images": n})assert cost == pytest.approx(round(0.135 * n, 4))@@ -205,6 +205,16 @@ class TestAsyncPolling:# ========== Validation & Error Handling ==========class TestValidation:+ @pytest.mark.parametrize("value", [0, 5, 1.5, True])+ def test_num_images_rejects_invalid_values(+ self, seedream_tool, mock_requests, value+ ):+ mock_post, _ = mock_requests+ result = seedream_tool.execute({"prompt": "t", "num_images": value})+ assert not result.success+ assert "num_images" in (result.error or "")+ mock_post.assert_not_called()+def test_missing_api_key_returns_error(self, monkeypatch):monkeypatch.delenv("FAL_KEY", raising=False)monkeypatch.delenv("FAL_AI_API_KEY", raising=False)@@ -259,4 +269,31 @@ class TestMetadata:inputs = {"prompt": "c", "image_size": "square", "num_images": 2, "output_path": str(tmp_path / "c.jpeg")}result = seedream_tool.execute(inputs)- assert result.cost_usd == pytest.approx(seedream_tool.estimate_cost(inputs))\ No newline at end of file+ assert result.cost_usd == pytest.approx(seedream_tool.estimate_cost(inputs))++ def test_image_selector_routes_count_and_returns_distinct_artifacts(+ self, seedream_tool, tmp_path, mock_requests, monkeypatch+ ):+ from tools.graphics.image_selector import ImageSelector++ mock_post, mock_get = mock_requests+ _setup_mock_execution(mock_post, mock_get, num_images=2)+ selector = ImageSelector()+ monkeypatch.setattr(selector, "_providers", lambda: [seedream_tool])++ result = selector.execute(+ {+ "prompt": "campaign artwork",+ "preferred_provider": "bytedance",+ "n": 2,+ "output_path": str(tmp_path / "selected.png"),+ }+ )++ assert result.success, result.error+ assert result.data["selected_tool"] == "seedream_image"+ assert len(set(result.artifacts)) == 2+ assert {Path(path).name for path in result.artifacts} == {+ "selected_1.png",+ "selected_2.png",+ }diff --git a/tools/graphics/image_selector.py b/tools/graphics/image_selector.pyindex b106fbde..c3a3c716 100644--- a/tools/graphics/image_selector.py+++ b/tools/graphics/image_selector.py@@ -242,6 +242,8 @@ class ImageSelector(BaseTool):props = tool.input_schema.get("properties", {})if "query" in props and "query" not in adapted:adapted["query"] = adapted.get("prompt", "")+ if "n" in adapted and "num_images" in props and "num_images" not in adapted:+ adapted["num_images"] = adapted["n"]# Strip selector-only keys that downstream tools don't understandadapted.pop("preferred_provider", None)diff --git a/tools/graphics/seedream_image.py b/tools/graphics/seedream_image.pyindex a39b537c..64acc8d8 100644--- a/tools/graphics/seedream_image.py+++ b/tools/graphics/seedream_image.py@@ -31,24 +31,21 @@ class SeedreamImage(BaseTool):determinism = Determinism.STOCHASTICruntime = ToolRuntime.API- dependencies = []+ dependencies = ["env:FAL_KEY"]install_instructions = ("Set FAL_KEY to your fal.ai API key.\n"" Get one at https://fal.ai/dashboard/keys")- agent_skills = []+ agent_skills = ["visual-style"]capabilities = ["generate_image",- "generate_logo",- "generate_vector","text_to_image","structured_designs","dense_layouts","multi_language_text",]supports = {- "svg_output": True,"text_rendering": True,"color_palette": True,"custom_size": True,@@ -57,8 +54,7 @@ class SeedreamImage(BaseTool):"multi_language_text": True,}best_for = [- "logos and brand assets",- "SVG vector output",+ "raster brand and campaign assets","images with accurate text rendering","structured designs and dense layouts","multi-language text rendering (14 languages)",@@ -79,7 +75,9 @@ class SeedreamImage(BaseTool):"default": "auto_2K",},"num_images": {- "type": "number",+ "type": "integer",+ "minimum": 1,+ "maximum": 4,"default": 1,},"output_format": {@@ -99,7 +97,13 @@ class SeedreamImage(BaseTool):cpu_cores=1, ram_mb=512, vram_mb=0, disk_mb=100, network_required=True)retry_policy = RetryPolicy(max_retries=2, retryable_errors=["rate_limit", "timeout"])- idempotency_key_fields = ["image_size", "output_format"]+ idempotency_key_fields = [+ "prompt",+ "image_size",+ "output_format",+ "num_images",+ "enable_safety_checker",+ ]side_effects = ["writes image file to output_path", "calls fal.ai queue API"]user_visible_verification = ["Inspect generated image for brand accuracy and text readability"]@@ -127,6 +131,20 @@ class SeedreamImage(BaseTool):unit_price = size_price_map.get(image_size, 0.135)return round(unit_price * num_images, 4)+ @staticmethod+ def _output_paths(+ output_path: str | None, count: int, output_format: str+ ) -> list[Path]:+ path = Path(output_path or f"seedream_image.{output_format}")+ if not path.suffix:+ path = path.with_suffix(f".{output_format}")+ if count == 1:+ return [path]+ return [+ path.with_name(f"{path.stem}_{index}{path.suffix}")+ for index in range(1, count + 1)+ ]+def execute(self, inputs: dict[str, Any]) -> ToolResult:import requests@@ -139,12 +157,21 @@ class SeedreamImage(BaseTool):start = time.time()prompt = inputs["prompt"]+ num_images = inputs.get("num_images", 1)+ if isinstance(num_images, bool) or not isinstance(num_images, int):+ return ToolResult(+ success=False, error="num_images must be an integer from 1 to 4."+ )+ if not 1 <= num_images <= 4:+ return ToolResult(+ success=False, error="num_images must be between 1 and 4."+ )submit_url = "https://queue.fal.run/bytedance/seedream/v5/pro/text-to-image"payload: dict[str, Any] = {"prompt": prompt,"image_size": inputs.get("image_size", "auto_2K"),"output_format": inputs.get("output_format", "jpeg"),- "num_images": inputs.get("num_images", 1),+ "num_images": num_images,"enable_safety_checker": inputs.get("enable_safety_checker", True),}@@ -209,20 +236,18 @@ class SeedreamImage(BaseTool):if not images:raise RuntimeError("Seedream completed but no images returned")+ ext = inputs.get("output_format", "jpeg")+ expected_paths = self._output_paths(+ inputs.get("output_path"), len(images), ext+ )output_paths = []- for idx, img in enumerate(images):+ for img, output_path in zip(images, expected_paths):image_url = img.get("url")if not image_url:continueimage_resp = requests.get(image_url, timeout=60)image_resp.raise_for_status()- ext = inputs.get("output_format", "jpeg")- if len(images) > 1:- filename = f"seedream_image_{idx + 1}.{ext}"- else:- filename = f"seedream_image.{ext}"- output_path = Path(inputs.get("output_path", filename))output_path.parent.mkdir(parents=True, exist_ok=True)output_path.write_bytes(image_resp.content)output_paths.append(str(output_path))@@ -247,4 +272,4 @@ class SeedreamImage(BaseTool):cost_usd=self.estimate_cost(inputs),duration_seconds=round(time.time() - start, 2),model="fal-ai/bytedance/seedream/v5",- )\ No newline at end of file+ )