{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://github.com/petal-labs/petalflow/schemas/agent-workflow/v1.json", "title": "PetalFlow Agent Workflow v1", "type": "object", "additionalProperties": false, "required": [ "version", "schema_version", "kind", "id", "name", "agents", "tasks", "execution" ], "properties": { "version": { "type": "string", "description": "Workflow business version." }, "schema_version": { "type": "string", "description": "Schema contract version (SemVer).", "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$" }, "kind": { "type": "string", "enum": [ "agent_workflow", "agent-workflow" ], "description": "Canonical value is agent_workflow. agent-workflow is accepted for migration compatibility." }, "id": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1 }, "agents": { "type": "object", "minProperties": 1, "additionalProperties": { "$ref": "#/$defs/agent" } }, "tasks": { "type": "object", "minProperties": 1, "additionalProperties": { "$ref": "#/$defs/task" } }, "execution": { "$ref": "#/$defs/execution" } }, "$defs": { "agent": { "type": "object", "additionalProperties": false, "required": [ "role", "goal", "provider", "model" ], "properties": { "role": { "type": "string", "minLength": 1 }, "goal": { "type": "string", "minLength": 1 }, "backstory": { "type": "string" }, "provider": { "type": "string", "minLength": 1 }, "model": { "type": "string", "minLength": 1 }, "tools": { "type": "array", "items": { "type": "string", "minLength": 1 } }, "tool_config": { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": true } }, "config": { "type": "object", "additionalProperties": true } } }, "task": { "type": "object", "additionalProperties": false, "required": [ "description", "agent", "expected_output" ], "properties": { "description": { "type": "string", "minLength": 1 }, "agent": { "type": "string", "minLength": 1 }, "expected_output": { "type": "string", "minLength": 1 }, "output_key": { "type": "string" }, "inputs": { "type": "object", "additionalProperties": { "type": "string" } }, "review": { "type": "string" }, "context": { "type": "array", "items": { "type": "string" } } } }, "execution": { "type": "object", "additionalProperties": false, "required": [ "strategy" ], "properties": { "strategy": { "type": "string", "enum": [ "sequential", "parallel", "hierarchical", "custom" ] }, "task_order": { "type": "array", "items": { "type": "string" } }, "merge_strategy": { "type": "string" }, "manager_agent": { "type": "string" }, "tasks": { "type": "object", "additionalProperties": { "$ref": "#/$defs/task_dependencies" } } } }, "task_dependencies": { "type": "object", "additionalProperties": false, "required": [ "depends_on" ], "properties": { "depends_on": { "type": "array", "items": { "type": "string" } }, "condition": { "type": "string" } } } } }