Skip to content

YAML_RULES.md¶

🎯 Objectif¶

Ce fichier documente les rĂšgles de validation et la structure attendue des fichiers YAML de workflow utilisĂ©s dans la plateforme MFO. Il constitue la source de vĂ©ritĂ© pour l’assistant GPT gĂ©nĂ©rant ces workflows, en complĂ©ment du SYSTEM PROMPT.


✅ RĂšgles de validation¶

1. workflows[].input_mapping¶

  • Doit rĂ©fĂ©rencer uniquement des clĂ©s dĂ©finies dans schemas[].properties ou dans TRIGGER.payload.xxx
  • Syntaxe obligatoire : TRIGGER.payload.xxx

2. triggers[]¶

  • Champs obligatoires :
  • id (unique)
  • type ∈ {webhook, schedule, manual}
  • enabled: boolĂ©en
  • config: dĂ©pend du type
  • target_taskflow: doit correspondre Ă  un taskflow_id existant
  • Si type == webhook :
  • config doit contenir http_path et http_method
  • input_mapping doit suivre TRIGGER.payload.xxx
  • Si type == schedule :
  • config.cron_expression est requis

3. taskflows[]¶

  • Champs obligatoires :
  • taskflow_id : identifiant unique
  • description : description concise du but mĂ©tier de ce taskflow
  • tasks[] : liste de tĂąches conformes aux rĂšgles ci-dessous

4. taskflows[].tasks[]¶

Chaque tĂąche doit avoir :

Champ Obligation RĂšgle
id ✅ Unique dans son taskflow
description ✅ Doit dĂ©crire le rĂŽle mĂ©tier ou technique de la tĂąche
type ✅ Doit ĂȘtre dans le set dĂ©fini (voir ci-dessous)
config.tool_id ⚠ Si type = tool Requis pour mfo_api_tool_execute
config.prompt_template_id ⚠ Si type = chat Requis pour mfo_api_chat_send
prompt_context ⚠ Si prompt Doit rĂ©fĂ©rencer uniquement INPUT.xxx ou task_id.tool_call_results.xxx
arguments ✅ si present Chaque clĂ© doit pointer vers INPUT.xxx ou task_id.result.xxx

5. Types de tùches autorisés (type)¶

  • mfo_api_tool_execute
  • mfo_api_chat_send
  • mfo_api_resource_get
  • mfo_api_memory_get
  • mfo_api_memory_store

6. error_handling.on_error[]¶

  • Type attendu : liste d’objets avec :
  • type: retry_with_prompt, fail_fast, etc.
  • max_retries si retry_with_prompt
  • append_to_system_prompt si applicable
  • error_message pour fail_fast

7. validation[] (si LLM)¶

  • RĂšgles LLM Ă  appliquer Ă  la sortie :
  • type: require_tool_call
  • tool_name: nom du tool attendu
  • error_message: message en cas d’échec

8. Consistance entre blocs¶

  • Chaque target_taskflow rĂ©fĂ©rencĂ© dans un trigger doit exister
  • Chaque variable INPUT.xxx ou task_id.result.xxx utilisĂ©e doit ĂȘtre dĂ©finie en amont
  • DĂ©pendances implicites entre tĂąches doivent respecter l’ordre d’apparition

📩 Structure type d’un fichier workflow.yml¶

workflow_name: "ExampleWorkflow"
version: "1.0"

workflows:
  - id: "my_workflow"
    taskflow_id: "main_taskflow"
    description: "short description of the taskflow"
    input_mapping:
      email_id: "TRIGGER.payload.email_id"
    triggers:
      - id: "trigger_email"
        type: "webhook"
        enabled: true
        config:
          http_path: "/webhook/email"
          http_method: "POST"
        input_mapping:
          email_id: "TRIGGER.payload.email_id"
        target_taskflow: "main_taskflow"

schemas:
  - name: MyPayload
    type: object
    properties:
      email_id:
        type: string


taskflows:
  - taskflow_id: "main_taskflow"
    description: "short description of the taskflow"
    tasks:
      - id: "fetch_email"
        description: "short description of the task"
        type: "mfo_api_tool_execute"
        config:
          tool_id: "unipile_email_fetch"
          arguments:
            email_id: "INPUT.email_id"

      - id: "analyze_email"
        description: "short description of the task"
        type: "mfo_api_chat_send"
        config:
          prompt_template_id: "email_analysis"
          prompt_context:
            content: "fetch_email.result.content"
        error_handling:
          on_error:
            - type: retry_with_prompt
              append_to_system_prompt: "retry analysis"
              max_retries: 2

🔁 À valider automatiquement cĂŽtĂ© assistant¶

  • Chaque taskflow_id rĂ©fĂ©rencĂ© doit exister
  • Les INPUT.xxx doivent venir soit du input_mapping, soit d’un TRIGGER.payload.xxx
  • Les task_id.result.xxx doivent rĂ©fĂ©rencer des tĂąches antĂ©rieures dans le mĂȘme taskflow
  • Chaque task et taskflow doit comporter un champ description clair