YAML 구문 참조
변수 참조, 조건식, 에이전트 사전 설정, code_preamble - Braidrun YAML에 대한 완전하고 권위 있는 참조입니다.
Braidrun의 웹 DTO는 YAML 바이트 수준 왕복을 수행하지만 다른 필드 명명 스타일을 사용합니다. camelCase vs snake_case. 이 페이지에서는 알아야 할 매핑, 변수, 조건 및 사전 설정 규칙을 명확하게 설명합니다.
확인 및 YAML 왕복 모두 플랫폼 구문 분석 인터페이스를 사용합니다. /api/workflows/parse , 브라우저 측에서 또 다른 규칙 세트를 작성하는 것을 방지합니다.
이름 지정: camelCase ← snake_case
웹 JSON은 camelCase를 사용합니다. 실행 YAML은 snake_case를 사용합니다.
| 웹 DTO | YAML |
|---|---|
groupChat | group_chat |
agentBased | agent_based |
stateMachine | state_machine |
repeatUntil | repeat_until |
iterateOver | iterate_over |
manualApproval | manual_approval |
onSuccess / onFailure | on_success / on_failure |
에이전트 사전 설정 및 재정의
에이전트를 선언하려면 사전 설정을 사용하고 필요한 경우 재정의를 사용하여 모든 필드를 포함하는 것이 좋습니다.
agents:
planner:
preset: universal
coder:
preset: coder
overrides:
max_iterations: 2000변수 참조
- 워크플로 변수:
{{var:name}} - 단계 출력:
{{steps.step_name.output}}
variables:
topic: workflow
workflow:
- step: plan
agent: planner
input: "Plan for {{var:topic}}"
- step: implement
agent: coder
input: "Implement based on {{steps.plan.output}}"
depends_on: [plan]조건식(조건)
기본 형태는 「좌변 연산자 우변」이며, 연산자 양쪽에는 반드시 공백을 두어야 합니다. 지원하는 연산자:
==/!=— 문자열 정확 비교, 대소문자 구분><>=<=— 수치 비교. 어느 한쪽이 숫자가 아니면 해당 조건은 false로 처리됩니다contains/contains_cs— 포함 판정, 대소문자 구분contains_ci— 포함 판정, 대소문자 구분 안 함
여러 비교는 최상위에서 &&(그리고)와 ||(또는)로 조합할 수 있으며, && 의 우선순위가 더 높아 먼저 결합됩니다. 예시:
condition: route == coding
condition: score >= 8
condition: status == done && score >= 8
# && binds tighter — reads as (a == 1 && b != done) || retry == true
condition: a == 1 && b != done || retry == true쓰지 마세요:
condition: "{{var:route}} == coding" # don't — write the variable name directly
condition: (a == 1 || b == 2) && c == 3 # don't — parentheses are not supported괄호 그룹화는 지원하지 않습니다 — 더 복잡한 그룹화 로직이 필요하면 classifier 로 라우팅 변수를 생성하거나 여러 단계로 나눕니다. 변수명은 그대로 쓰면 되며, condition 안에서 템플릿 변수 문법을 사용하지 마십시오. 파싱할 수 없는 조건은 false로 처리되어 해당 단계는 건너뜁니다.
code_preamble — 공유 코드 프리앰블
여러 code 단계가 import나 도구 함수를 공유해야 할 때는 최상위의 code_preamble을 사용합니다. 프로그래밍 언어별로 그룹화되며, 실행 시 같은 언어의 code 단계 스크립트 앞부분에 자동으로 붙습니다:
code_preamble:
python:
ref: ./lib/shared_utils.py또는 인라인 양식을 사용하십시오.
code_preamble:
python:
inline: |
import json, os
def log(msg):
print(f"[workflow] {msg}")Transition Action(on_success / on_failure)
문자열 배열 대신 작업 개체 형식을 사용합니다.
on_success:
- next: publish
on_failure:
- notify: slack
message: implementation failed
stop: true웹 DTO로 내보낼 경우 다음과 같습니다.
{
"onSuccess": [{"next": "publish"}],
"onFailure": [
{
"notify": "slack",
"message": "implementation failed",
"stop": true
}
]
}조항 목록 확인
- 변수 참조 사용법
{{var:name}} - 내보낸 YAML은 여전히 통과합니다.
/api/workflows/parse다시 읽어봐 - condition에는 템플릿 변수를 쓰지 않았고, && / || 조합에는 괄호를 사용하지 않았습니다
manualApproval/onFailure/repeatUntilDTO 필드를 내보낸 후 snake_case로 변환되었습니다.