# 4-Phase Orchestration: 5 Universal Agent Skills with YAML-Driven Rules, Composable Components, and Graceful Degradation

> Source: <https://dev.to/__b01666abd57fb7bb91f9/4-phase-orchestration-5-universal-agent-skills-with-yaml-driven-rules-composable-components-and-370b>
> Published: 2026-07-01 12:34:54+00:00

When you're hard-coding your 3rd scoring if-else, maybe it's time to ask: can I move the rules into YAML and let the business change config instead of code?

Every Agent developer faces the same dilemma — **every business scenario rewrites a similar pipeline**:

**The skeleton is identical.** What changes is only the "content" at each step. Yet every team builds pipelines from scratch.

[ teleagent-skills](https://github.com/yuzhaopeng-up/teleagent-skills) offers an answer:

```
┌─────────────────────────────────────────────────────────────┐
│                    Upper Business Skill                      │
│  (Scoring Engine / Evidence Chain / Data Aggregator / ...)  │
└──────────┬──────────┬──────────┬──────────┬────────────────┘
           │          │          │          │
           ▼          ▼          ▼          ▼
    ┌──────────┐┌──────────┐┌──────────┐┌──────────┐
    │ Phase 1  ││ Phase 2  ││ Phase 3  ││ Phase 4  │
    │ Extract  ││ Analyze  ││ Generate ││ Archive  │
    │          ││          ││          ││          │
    │Info-     ││Data-     ││Report-   ││Archive-  │
    │Extractor ││Analyst   ││Generator ││Manager   │
    └────┬─────┘└────┬─────┘└────┬─────┘└────┬─────┘
         │           │           │           │
         ▼           ▼           ▼           ▼
    ┌─────────────────────────────────────────────────┐
    │          JSON Contract (Structured Data Contract) │
    │   phase1_output.json → phase2_input.json → ...  │
    └─────────────────────────────────────────────────┘
```

Core idea: **each Phase is an independent component, and Phases pass data only through JSON contracts**.

```
{
  "phase": "extract",
  "skill": "scoring-engine",
  "output": {
    "entities": [
      {
        "name": "客户A",
        "type": "enterprise_customer",
        "attributes": {
          "annual_revenue": 50000000,
          "employee_count": 320,
          "industry": "制造"
        }
      }
    ],
    "metadata": {
      "extraction_time": "2026-07-01T10:30:00Z",
      "source": "CRM_API",
      "confidence": 0.92
    }
  },
  "next_phase": "analyze"
}
```

The traditional approach hard-codes scoring rules:

```
# Hard-coded — every business change means a code change
if customer.revenue > 10000000:
    score += 30
elif customer.revenue > 5000000:
    score += 20
```

teleagent-skills does it differently — **all rules are externalized to YAML**:

```
# scoring_rules.yaml
scoring_engine:
  name: "政企客户商机评分"
  version: "2.1"
  dimensions:
    - id: revenue
      name: "营收规模"
      weight: 0.30
      rules:
        - condition: "attributes.annual_revenue >= 100000000"
          score: 30
          label: "超大型"
        - condition: "attributes.annual_revenue >= 50000000"
          score: 20
          label: "大型"
        - condition: "attributes.annual_revenue >= 10000000"
          score: 10
          label: "中型"
    - id: industry
      name: "行业属性"
      weight: 0.25
      rules:
        - condition: "attributes.industry in ['金融','医疗']"
          score: 25
          label: "高价值行业"
    - id: growth
      name: "增长潜力"
      weight: 0.20
    - id: connectivity
      name: "接入成熟度"
      weight: 0.15
    - id: decision_chain
      name: "决策链清晰度"
      weight: 0.10
  thresholds:
    high: 70
    medium: 40
    low: 0
```

Business changed? Edit YAML. Need a new dimension? Add YAML. **Zero code changes.**

All 5 Skills share the same 4-Phase skeleton, but each Skill's Phase behavior differs:

| Skill | Phase 1 Extract | Phase 2 Analyze | Phase 3 Generate | Phase 4 Archive |
|---|---|---|---|---|
Scoring Engine |
Extract scoring object attributes | Load YAML rules & match scores | Generate scoring report + recommendations | Archive scoring records |
Evidence Chain |
Extract evidence from multiple sources | Cross-validate + conflict detection | Generate evidence chain report | Archive validation records |
Data Aggregator |
Validate & clean raw data | Aggregation + YoY/MoM calculation | Output statistical report | Archive aggregated results |
Visualization Renderer |
Analyze data characteristics | Generate ECharts config | Render HTML/Dashboard | Cache chart assets |
NL2Query |
Extract query intent + entities | Build SQL + confidence assessment | Format query results | Record query logs |

**The power of composability**: upper-level Skills can chain lower-level Skills on demand. For example, the data query gateway pipeline:

```
NL2Query(Phase1-2) → Data Aggregator(Phase1-2) → Visualization Renderer(Phase1-3)
```

One natural language query automatically flows through "understand → query → aggregate → visualize" end to end.

The 4-Phase architecture has built-in 3-tier degradation:

```
┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Phase 1   │────▶│   Phase 2   │────▶│   Phase 3   │────▶│   Phase 4   │
│   Extract   │     │   Analyze   │     │   Generate  │     │   Archive   │
└──────┬──────┘     └──────┬──────┘     └──────┬──────┘     └──────┬──────┘
       │                   │                   │                   │
       ▼                   ▼                   ▼                   ▼
  ┌──────────┐       ┌──────────┐       ┌──────────┐       ┌──────────┐
  │ Return   │       │ Skip     │       │ Simplify │       │ Local    │
  │ raw      │       │ analysis │       │ template │       │ cache +  │
  │ input +  │       │ mark low │       │ raw data │       │ deferred │
  │ conf=0   │       │ confidence│      │ passthrough│      │ retry    │
  └──────────┘       └──────────┘       └──────────┘       └──────────┘
```

**The core principle of degradation**: I'd rather give the user a low-confidence result than crash with an error.

**What it is**: A multi-dimensional weighted scoring component driven by YAML rule configs.

**Typical scenarios**: enterprise opportunity scoring, vendor evaluation, customer churn prediction, partner tiering.

Input → Rule matching → Scoring output flow:

```
{
  "customer": "客户A",
  "total_score": 78,
  "grade": "A级-重点跟进",
  "dimension_breakdown": {
    "revenue": { "score": 20, "max": 30, "label": "大型" },
    "industry": { "score": 15, "max": 25, "label": "中价值行业" },
    "growth": { "score": 20, "max": 20 },
    "connectivity": { "score": 15, "max": 15 },
    "decision_chain": { "score": 8, "max": 10 }
  },
  "recommendation": "建议安排专属客户经理，优先推荐5G专网+云网融合方案"
}
```

**What it is**: A multi-source evidence cross-validation component that detects conflicts, evaluates confidence, and pinpoints root causes.

```
Data Source 1: Customer complaints    ──┐
                                         │     ┌──────────────────┐
Data Source 2: System alert logs      ──┼────▶│  Evidence Chain  │
                                         │     │  Phase2: Analyze │
Data Source 3: SLA monitoring data    ──┘     └────────┬─────────┘
                                                  │
                          ┌───────────────────────┐│
                          │ Cross-validation:      │
                          │ • Complaint: "2hr outage"
                          │ • Alert: "optical attenuation"│
                          │ • SLA: "99.1% availability" │
                          │ Conflict detected:      │
                          │ Complaint vs SLA surface contradiction│
                          │ Root cause="optical attenuation": 0.87│
                          └───────────────────────┘
```

**What it is**: A raw data re-processing component supporting validation/cleaning, aggregation, YoY/MoM, and TOP rankings.

```
Raw query results           Aggregator output
┌──────────────┐         ┌──────────────────────────────┐
│ 300 rows of  │───────▶ │ Monthly summary + YoY/MoM    │
│ detail data  │         │ TOP10 ranking                │
│ (region x    │         │ Anomaly flags (>2σ)          │
│  month)      │         │ Trend direction              │
└──────────────┘         └──────────────────────────────┘
```

**What it is**: An automated rendering component that turns structured data into ECharts charts and Dashboards.

Chart type selection is automatic: time-series → line chart, categorical → bar/pie, multi-dimensional → radar.

**What it is**: A smart natural-language-to-structured-query conversion component.

```
User input: "华东区上月5G专网新增客户数"

Phase1 Extract:  intent="query", entities=[region="华东", time="上月", metric="5G专网"]
Phase2 Analyze:  Generate SQL + confidence 0.88
Phase3 Generate: Format results
Phase4 Archive:  Record query log
```

**Confidence scoring**: When confidence drops below a threshold, the output gets a "low confidence" warning and shows the SQL for human review.

| Industry | Scoring Engine | Evidence Chain | Data Aggregator | Viz Renderer | NL2Query |
|---|---|---|---|---|---|
Finance |
Customer credit rating | Anti-money-laundering multi-source verification | Transaction volume YoY/MoM | Risk control dashboard | "Check a customer's last 3 months of transactions" |
Manufacturing |
Supplier evaluation | QA vs. production line verification | Line OEE statistics | Capacity dashboard | "Check line A's yield this month" |
Retail |
Member value scoring | Data conflict detection | SKU sales aggregation | Sales heatmap | "Top sellers in East China" |
Healthcare |
Patient risk stratification | Diagnosis vs. lab verification | Department admission stats | Bed occupancy dashboard | "Available beds in cardiology" |

**Key insight**: All 5 Skills adapt to different industries purely through YAML rule configs. The scoring engine code logic is identical — only the YAML files differ.

| Dimension | LangChain/LlamaIndex | AutoGen/CrewAI | teleagent-skills |
|---|---|---|---|
| Orchestration | Code-level Chain | Multi-Agent dialogue | 4-Phase declarative orchestration |
| Rule management | Hard-coded in code | Described in prompts | YAML parameterized config |
| Degradation strategy | try-catch | Retry dialogue | Declarative degradation config |
| Business adaptation | Change code | Change prompts | Change YAML |

```
git clone https://github.com/yuzhaopeng-up/teleagent-skills.git
cd teleagent-skills

# Scoring engine example
cp skills/scoring-engine/config/scoring_rules.yaml my_rules.yaml
# Edit my_rules.yaml to customize your scoring dimensions
# Copy the Skill directory into your Agent platform's skills directory
```

License: **Apache 2.0**

| Repo | What It Does | GitHub |
|---|---|---|
financial-ai-skills |
Financial AI skill library: 104 scenarios, pure Python |
|

**Stop building pipelines from scratch. The 4-Phase skeleton is ready — you just need to write YAML.**

Star [teleagent-skills](https://github.com/yuzhaopeng-up/teleagent-skills) and let's standardize Agent Skills together.
