DEV Community

兆鹏 于
兆鹏 于

Posted on

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

4-Phase Orchestration: How 5 Universal Agent Skills Achieve YAML-Driven Rules + Composable Components + Graceful Degradation

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?

The Problem: Why Do Agent Skills Keep Reinventing the Wheel?

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

  • Scoring: Extract features → Match rules → Calculate score → Generate report
  • Complaints: Extract ticket → Cross-validate → Pinpoint root cause → Archive
  • Querying: Understand intent → Build SQL → Execute query → Render chart

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

teleagent-skills offers an answer: freeze the skeleton into 5 universal Skills with 4-Phase orchestration, and let business changes live in YAML config only.

Architecture Overview: 4-Phase Pipeline + 5 Universal Skills

2.1 4-Phase Orchestration Diagram

┌─────────────────────────────────────────────────────────────┐
│                    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 → ...  │
    └─────────────────────────────────────────────────┘
Enter fullscreen mode Exit fullscreen mode

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

  • Any Phase can be replaced (want a more powerful Analyzer? Swap it out)
  • Any Phase can be skipped (degradation mode)
  • Any Phase can be reused (5 Skills share the same Extract component)

2.2 JSON Contract Example

{
  "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"
}
Enter fullscreen mode Exit fullscreen mode

Three Design Principles, Deep Dive

Principle 1: YAML-Driven, Parameterized Rules

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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

Principle 2: Composable Components — 4-Phase Orchestration + JSON Contracts

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)
Enter fullscreen mode Exit fullscreen mode

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

Principle 3: Graceful Degradation — When Sub-Components Fail

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    │
  └──────────┘       └──────────┘       └──────────┘       └──────────┘
Enter fullscreen mode Exit fullscreen mode

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

The 5 Skills, One by One

4.1 Scoring Engine

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专网+云网融合方案"
}
Enter fullscreen mode Exit fullscreen mode

4.2 Evidence Chain

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│
                          └───────────────────────┘
Enter fullscreen mode Exit fullscreen mode

4.3 Data Aggregator

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              │
└──────────────┘         └──────────────────────────────┘
Enter fullscreen mode Exit fullscreen mode

4.4 Visualization Renderer

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.

4.5 NL2Query

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
Enter fullscreen mode Exit fullscreen mode

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

Industry Use-Case Matrix

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.

How This Fundamentally Differs from Existing Frameworks

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

Quick Start

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
Enter fullscreen mode Exit fullscreen mode

License: Apache 2.0


Agent Skills Open-Source Ecosystem

Repo What It Does GitHub
financial-ai-skills Financial AI skill library: 104 scenarios, pure Python https://github.com/yuzhaopeng-up/financial-ai-skills
teleagent-skills 5 universal business Skills: 4-Phase orchestration + YAML-driven rules https://github.com/yuzhaopeng-up/teleagent-skills
agent-cluster-comm Multi-Agent cluster 5-layer communication architecture https://github.com/yuzhaopeng-up/agent-cluster-comm
skill-framework Skill governance framework: L0-L4 classification + YAML templates + Python tools https://github.com/yuzhaopeng-up/skill-framework
fintech-h5-demos 12 zero-dependency financial H5 dashboard demos https://github.com/yuzhaopeng-up/fintech-h5-demos

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

Star teleagent-skills and let's standardize Agent Skills together.

Top comments (0)