Add generated Flow Definition authoring skill (#6393)

* Add generated Flow Definition authoring skill

Generate a portable skill from the Flow Definition schema so agents can
author valid declarative flows with the same reference CrewAI uses to
validate them. New declarative flow projects now write this skill.

```python
from crewai.flow.flow_definition import FlowDefinition
skill = FlowDefinition.skill(skips=(), examples_format="yaml")
```

* `examples_format` accepts `"yaml"` or `"json"`.
* Supported skips: `conversational`, `non_linear_flows`, `each`, `hitl`, `persistence`, `config`, `expression_action`, `script_action`, `tool_action`

The generated skill includes authoring rules, a routed crew example, and
an API reference extracted from the Flow, action, state, agent, crew,
and task Pydantic schemas.

* Fix declarative flow scaffold without framework import

* Fix skipped expression action guidance

* Fix markdown links in skill
This commit is contained in:
Vinicius Brasil
2026-06-30 09:13:33 -07:00
committed by GitHub
parent e8dced8a2d
commit 1556dbea3e
9 changed files with 1430 additions and 47 deletions

View File

@@ -126,10 +126,7 @@ def _create_declarative_flow(
package_dir = Path(__file__).parent
templates_dir = package_dir / "templates" / "declarative_flow"
agents_md_src = package_dir / "templates" / "AGENTS.md"
if agents_md_src.exists():
shutil.copy2(agents_md_src, project_root / "AGENTS.md")
root_template_files = {".gitignore", "AGENTS.md", "README.md", "pyproject.toml"}
for src_file in templates_dir.rglob("*"):
if not src_file.is_file():
@@ -138,7 +135,7 @@ def _create_declarative_flow(
relative_path = src_file.relative_to(templates_dir)
dst_file = (
project_root / relative_path
if relative_path.name in {".gitignore", "README.md", "pyproject.toml"}
if relative_path.name in root_template_files
else package_root / relative_path
)
dst_file.parent.mkdir(parents=True, exist_ok=True)