{"id":2440,"library":"comfyui-workflow-templates-core","title":"ComfyUI Workflow Templates Core","description":"ComfyUI Workflow Templates Core provides fundamental utilities and helper functions for managing and loading ComfyUI workflow templates. It's a core component of the broader ComfyUI workflow template system, facilitating programmatic interaction with template manifests and their associated files. The library is actively developed as part of the Comfy-Org/workflow_templates repository, with releases tied to ComfyUI updates. The current PyPI version is 0.3.194. [1, 7, 9]","status":"active","version":"0.3.194","language":"en","source_language":"en","source_url":"https://github.com/Comfy-Org/workflow_templates","tags":["ComfyUI","workflow","templates","AI","generative-AI","utilities","machine-learning"],"install":[{"cmd":"pip install comfyui-workflow-templates-core","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"This library provides core helpers for ComfyUI's native workflow template system and is intended to be used within or alongside a ComfyUI installation. It's often updated alongside ComfyUI's core and other related frontend/documentation packages.","package":"ComfyUI","optional":false}],"imports":[{"note":"Used for defining and validating the structure of a workflow template's metadata.","symbol":"WorkflowTemplateManifest","correct":"from workflow_templates_core.manifest import WorkflowTemplateManifest"},{"note":"Used for loading and resolving workflow template files and their manifests from disk.","symbol":"WorkflowTemplateLoader","correct":"from workflow_templates_core.loader import WorkflowTemplateLoader"}],"quickstart":{"code":"import json\nfrom pathlib import Path\nfrom workflow_templates_core.loader import WorkflowTemplateLoader\n\n# Create a dummy workflow template manifest JSON file\ndummy_manifest_content = {\n    \"id\": \"my_first_template\",\n    \"name\": \"My First ComfyUI Template\",\n    \"description\": \"A simple example template.\",\n    \"version\": \"1.0.0\",\n    \"tags\": [\"example\", \"basic\"],\n    \"dependencies\": [],\n    \"workflow\": \"path/to/my_first_template.json\"\n}\n\ndummy_dir = Path('./my_templates')\ndummy_dir.mkdir(exist_ok=True)\n\nmanifest_path = dummy_dir / 'my_first_template.manifest.json'\nworkflow_path = dummy_dir / 'my_first_template.json'\n\nwith open(manifest_path, 'w') as f:\n    json.dump(dummy_manifest_content, f, indent=2)\n\nwith open(workflow_path, 'w') as f:\n    # A minimal dummy ComfyUI workflow JSON\n    json.dump({\"nodes\": [], \"links\": []}, f, indent=2)\n\nprint(f\"Created dummy manifest: {manifest_path}\")\nprint(f\"Created dummy workflow: {workflow_path}\")\n\n# Initialize the loader with the base path where templates are stored\n# The loader expects manifests in a 'manifests' sub-directory or directly in the templates_path\n# For this example, we'll point it to the directory containing our manifest.\nloader = WorkflowTemplateLoader(templates_path=dummy_dir)\n\n# Load the manifest (usually done by scanning the templates_path)\n# In a real scenario, you'd iterate through discovered manifests.\n# For this quickstart, we'll simulate loading a specific manifest file directly.\n# Note: The loader's `load` method typically expects the manifest file itself, not its containing directory.\n# A more typical usage would involve the loader *finding* manifests.\n# As a direct example, we can parse the content into a Manifest object:\n\nprint(\"\\nAttempting to parse manifest content...\")\ntry:\n    with open(manifest_path, 'r') as f:\n        raw_manifest = json.load(f)\n    manifest = WorkflowTemplateManifest(**raw_manifest)\n    print(f\"Successfully parsed manifest: {manifest.name} (ID: {manifest.id})\")\n    print(f\"Workflow file referenced: {manifest.workflow}\")\nexcept Exception as e:\n    print(f\"Error parsing manifest: {e}\")\n\n# Clean up dummy files\nmanifest_path.unlink()\nworkflow_path.unlink()\ndummy_dir.rmdir()\nprint(\"\\nCleaned up dummy files.\")","lang":"python","description":"This quickstart demonstrates how to programmatically interact with `workflow_templates_core` by creating a mock workflow template manifest and then using the library's `WorkflowTemplateManifest` model to parse and validate it. It simulates the core functionality of loading template metadata, which is essential for ComfyUI's template browsing system. [1]"},"warnings":[{"fix":"Always update ComfyUI and its core dependencies together. If using `git pull`, ensure all associated sub-modules or `requirements.txt` dependencies are also updated, typically via the official update scripts or ComfyUI Manager.","message":"Incomplete ComfyUI updates can lead to missing or broken workflow templates. This library is a core dependency of ComfyUI's template system and must be updated alongside ComfyUI's main code and other related packages (like `comfyui-frontend-package` and `comfyui-embedded-docs`) to ensure compatibility and access to the latest templates. [7]","severity":"breaking","affected_versions":"All versions"},{"fix":"Refer to the ComfyUI documentation on embedding models within workflow templates. Use safe model formats like `.safetensors` or `.sft` for embedded models, as unsafe formats (e.g., `.gguf`) may be flagged and not offer download links. [4]","message":"When creating or modifying workflow templates, ensure the JSON structure conforms to the `WorkflowTemplateManifest` schema. Crucially, any models required by the workflow must be correctly embedded with `name`, `url` (direct download link), and `directory` (relative to `ComfyUI/models`) fields. Incorrectly formatted model information can prevent templates from being fully functional or models from being auto-downloaded. [4]","severity":"gotcha","affected_versions":"All versions"},{"fix":"Organize custom node example workflow JSONs and their corresponding `.jpg` thumbnails within one of the recognized example workflow directories in your custom node's repository.","message":"For developers creating custom nodes that include example workflow templates, these templates must be placed in a specific folder structure (e.g., `example_workflows`, `workflow`, `workflows`, `example`, or `examples`) within the custom node's directory for ComfyUI's template browser to discover and display them. [5]","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}