ข้ามไปยังเนื้อหา
Microsoft ปิด pattern 'Agent Skills' ใน Python — class-based + composable sources ครบทาง ทำให้สาม authoring style ทำงานร่วมกันใน Provider เดียว
AI Skills

Microsoft ปิด pattern 'Agent Skills' ใน Python — class-based + composable sources ครบทาง ทำให้สาม authoring style ทำงานร่วมกันใน Provider เดียว

อ่าน 6 นาที ที่มา: Microsoft DevBlogs (Agent Framework)

วันที่ 22 พฤษภาคม 2026 — Microsoft DevBlogs (Agent Framework) เผยแพร่บทความที่ 3 ของซีรีย์ Agent Skills สำหรับ Python — เขียนโดย Sergey Menshykh (Principal Software Engineer) — ชื่อ “Agent Skills for Python: File, Code, and Class – Composed in One Provider” ปิดภาพรวมของ skill architecture ที่ Microsoft Agent Framework รองรับ

บทความก่อนหน้าครอบคลุม file-based skills (เริ่มต้น) และ code-defined skills + script execution + approval (เพิ่ม Python decorator) — โพสต์นี้เพิ่มสองชิ้นที่ขาด: class-based skills และ multi-source composition

จุดสำคัญที่ทำให้ Python developer ทั่วโลกควรอ่าน — Microsoft กำลัง converge architecture ของ skill กับ Anthropic Claude ในระดับ implementation detail ทั้ง framework เริ่มไปทางเดียวกันโดยไม่ได้ตกลงกันก่อน

สถานการณ์ที่ทำให้ต้องมี 3 authoring style

บทความใช้ scenario ของ HR self-service agent ที่บริษัทใช้ภายใน:

  1. เริ่มต้น — มี file-based skill ตัวเดียว: onboarding-guide ที่อยู่ใน directory skills/onboarding-guide/ ตามรูปแบบ SKILL.md + scripts/ + references/
  2. หลายสัปดาห์ต่อมา — ทีม HR systems ปล่อย skill benefits-enrollment เป็น Python package บน internal package index ของบริษัท
  3. พร้อมกัน — ทีมเริ่มทำ skill time-off-balance แต่จะปล่อย package จริงต้องรอ sprint หน้า ระหว่างนั้น engineer เขียน inline skill ที่ wrap HrDatabase client ที่มีอยู่แล้ว

ปัญหาคือ — ใน framework เก่า ทุก skill ต้องอยู่ใน format เดียวกัน ถ้าจะใช้ file-based ก็ต้องเก็บใน directory เดียว ถ้าจะใช้ code-defined ก็ต้อง mix ใน application code

โพสต์ใหม่นี้แสดงว่า 3 รูปแบบใช้ร่วมกันได้ ผ่าน source composition

ส่วนใหม่ที่ 1: Class-based Skills

Class-based skill รวม metadata + instructions + resources + scripts ใน Python class เดียว — สืบทอดจาก ClassSkill และใช้ decorator @ClassSkill.resource กับ @ClassSkill.script เพื่อ discovery อัตโนมัติ:

from agent_framework import ClassSkill, SkillFrontmatter
from textwrap import dedent
import json

class BenefitsEnrollmentSkill(ClassSkill):
    """Enroll employees in health, dental, or vision plans."""

    def __init__(self) -> None:
        super().__init__(
            frontmatter=SkillFrontmatter(
                name="benefits-enrollment",
                description=(
                    "Enroll an employee in health, dental, or vision plans. "
                    "Use when asked about benefits sign-up, plan options, "
                    "or coverage changes."
                ),
            ),
        )

    @property
    def instructions(self) -> str:
        return dedent("""\
            Use this skill when an employee asks about enrolling
            in or changing their benefits.
            1. Read the available-plans resource.
            2. Confirm the plan the employee wants.
            3. Use the enroll script to complete enrollment.
        """)

    @property
    @ClassSkill.resource(
        description="Health, dental, and vision plan options with monthly pricing."
    )
    def available_plans(self) -> str:
        return dedent("""\
            ## Available Plans (2026)
            - Health: Basic HMO ($0/month), Premium PPO ($45/month)
            - Dental: Standard ($12/month), Enhanced ($25/month)
            - Vision: Basic ($8/month)
        """)

    @ClassSkill.script(
        description="Enrolls an employee in the specified benefit plan."
    )
    def enroll(self, employee_id: str, plan_code: str) -> str:
        success = HrClient.enroll_in_plan(employee_id, plan_code)
        return json.dumps({
            "success": success,
            "employee_id": employee_id,
            "plan_code": plan_code,
        })

จุดที่ developer ที่เขียน Python framework คนอื่นจะคุ้น — pattern แบบนี้คือเดียวกับ FastAPI, Django, หรือ pytest fixtures ที่ใช้ decorator-based discovery บอกตัวเองว่ามันคือ resource หรือ script อะไร ไม่ต้องลงทะเบียนทุก method ใน config

ส่วนใหม่ที่ 2: Composable Sources

แล้วจะรวม skill จาก 3 ที่ — directory, package, และ inline — ให้ agent มอง register เป็นชุดเดียวกันได้อย่างไร? Microsoft แนะนำ composable source classes:

from contoso_skills_hr_enrollment import BenefitsEnrollmentSkill
from agent_framework import (
    AggregatingSkillsSource,
    DeduplicatingSkillsSource,
    FileSkillsSource,
    InMemorySkillsSource,
    SkillsProvider,
)

skills_provider = SkillsProvider(
    DeduplicatingSkillsSource(
        AggregatingSkillsSource([
            FileSkillsSource(
                Path(__file__).parent / "skills",     # file-based
                script_runner=my_runner,
            ),
            InMemorySkillsSource([
                BenefitsEnrollmentSkill(),             # class-based
                time_off_skill,                        # inline
            ]),
        ])
    ),
    require_script_approval=True,  # human-in-the-loop เปิดในบรรทัดนี้
)

ที่น่าสนใจ:

  • AggregatingSkillsSource รวม source หลายตัวเป็น stream เดียว
  • DeduplicatingSkillsSource ถ้า 2 source มี skill ชื่อซ้ำ — ตัวแรกชนะ
  • FilteringSkillsSource (ไม่อยู่ในตัวอย่างนี้) ใช้ predicate กรอง skill ที่ agent ตัวนี้เข้าถึงได้ ตัวอย่าง — บริษัทมี central skill repo แต่ agent บางตัวเข้าถึงได้แค่ subset
  • require_script_approval=True — เปิด human-in-the-loop ทั้ง provider โดยไม่ต้องแก้ skill แต่ละตัว

InlineSkill — bridge ที่หาย ไม่ใช่ anti-pattern

InlineSkill เป็นตัวที่หลายคนคงคิดว่าเป็น “hack” — แต่ Microsoft อธิบายว่ามันมี role เฉพาะที่ครอบคลุมไม่ได้ด้วย file/class:

  • เมื่อต้องการ resource ที่ execute logic ตอน read ไม่ใช่ static file
  • เมื่อต้อง construct skill จาก runtime data เช่น personalized skill ตาม user session/role
  • เมื่อ skill ต้อง close over call-site state (local variables, closures) ที่ resolve ผ่าน **kwargs ไม่ได้
  • เมื่อต้องการ bridge ชั่วคราว ระหว่างรอ package ออก แล้ว swap ตัวจริงทีหลัง (1-line change)

ความหมายของ InlineSkill คือ — ไม่ต้องรอให้ skill เป็น “production-ready package” จึงจะ deploy ได้ skill ที่เขียนสด 10 นาทีก่อนใช้ปลั๊กอินกับของจริงได้ใน provider เดียวกัน

Approval — production safety เปิดในบรรทัดเดียว

โพสต์เน้นว่า scripts บางตัวมี side effect จริง — check-provisioning แตะ production infrastructure, enroll เขียนลง HR system พอเปิด require_script_approval=True:

  • agent จะ หยุด ทุกครั้งที่จะ run script
  • ส่ง approval request กลับมาให้ application
  • application present ต่อ reviewer (manager, ops engineer)
  • ถ้า approve — execution ต่อปกติ
  • ถ้า reject — agent ถูกบอก decline และปรับ response

นี่คือ pattern ที่จำเป็นมากใน enterprise ที่ใช้ agent หลาย ๆ ตัวพร้อมกัน

มุมมอง AI Curator

โพสต์นี้บอกอะไรหลายเรื่องเกี่ยวกับ state of agent frameworks ปี 2026

1. Convergence กับ Anthropic ชัดเจน — ถ้าจำได้ Anthropic ออกแบบ Claude ให้ใช้ CLAUDE.md (project context) + .claude/skills/ (task-level skill ผ่าน SKILL.md) และล่าสุดมี Agent SDK ที่ให้ user เขียน inline skill ใน TypeScript/Python ได้ Microsoft กำลัง implement architecture เดียวกัน — file + class + inline + composable provider — ใน Python SDK ของ Agent Framework การ converge นี้ ไม่ใช่ accident มันคือ pattern ที่ทำงานจริง

2. “Independent skill ownership” คือ trend ใหญ่ที่ enterprise ไทยควรรับรู้ — เมื่อ skill ของแต่ละ team ปล่อยใน schedule ของตัวเอง บริษัทใหญ่ที่มีหลาย team (HR + Finance + Engineering + Marketing) ไม่ต้องใช้ central platform team เป็น bottleneck อีกต่อไป HR team ปล่อย benefits-enrollment ใน Pypi internal ของบริษัท — engineer team อื่นพร้อมใช้ทันที architecture แบบนี้คือสิ่งที่ทำให้ Microsoft ขายต่อ enterprise ได้

3. Class-based skill ทำให้ test ง่ายขึ้นมาก — เพราะมันคือ Python class ปกติ unit test ใช้ pytest, mock dependency ผ่าน constructor, ทำ integration test ผ่าน fixture ได้ตามรูปแบบ Python community คุ้นเคย — เปรียบกับ file-based skill ที่ test ต้องผ่าน end-to-end workflow

4. สำหรับ developer ไทย ถ้าทีมพิจารณา agent framework — โพสต์นี้คือ อ้างอิงดี Agent Framework ของ Microsoft ฟรี (open source) ใช้ผ่าน Foundry, OpenAI, Anthropic, Bedrock, Gemini ได้ทั้งหมด ไม่ผูก vendor ใครสร้าง agent ใน production ใกล้ ๆ ที่จะ deploy ลอง pattern นี้ — เริ่มจาก file-based 1 skill ก่อน เพิ่ม class-based เมื่อ team อื่นเข้ามา ใส่ require_script_approval=True ก่อน go live

5. Pattern นี้กำลังกลายเป็นมาตรฐานของ “AI middleware” — ฝั่ง Microsoft Agent Framework + AGT, ฝั่ง Anthropic Agent SDK + Claude Skills, ฝั่ง Google ADK + Skills — ทั้งสามค่ายมี file/class/inline composition pattern คล้ายกัน developer ที่เรียน pattern หนึ่งจะย้ายไปอีกค่ายได้เร็ว — และ enterprise ที่ commit กับ Microsoft จะไม่กลัวว่า ecosystem จะ diverge เกินไป

ถ้าคุณเป็น dev lead ที่ต้อง pitch agent framework ให้ทีมในไทย — โพสต์นี้คือ reference document ที่ใช้ได้ทันที วาด diagram 3 source → 1 provider แล้วอธิบายให้ทีม การ implement ใน production จะดู mature และไม่ over-engineered

แหล่งข่าว

บทความนี้เรียบเรียงจากแหล่งข่าวต้นทาง — Microsoft DevBlogs (Agent Framework)

เนื้อหาบน blog นี้สร้างโดย AI โดยมีการกำกับบรรณาธิการจากมนุษย์

อ่านเพิ่มในหมวด AI Skills

Anthropic แนะ “ยุบ subagent กลับเข้า agent loop เดียว” พร้อมปล่อย single-agent-loop-kit เป็น skill ของ Claude Code ที่ช่วย audit ระบบ multi-agent แล้วพับทีละตัวโดยวัดด้วย eval ก่อน-หลัง
AI Skills

Anthropic แนะ “ยุบ subagent กลับเข้า agent loop เดียว” พร้อมปล่อย single-agent-loop-kit เป็น skill ของ Claude Code ที่ช่วย audit ระบบ multi-agent แล้วพับทีละตัวโดยวัดด้วย eval ก่อน-หลัง

บทความ 22 ต.ค. จากทีม Applied AI ของ Anthropic บอกว่า agent ตัวเดียวที่โหลด skill และ tool เมื่อจำเป็น มักให้คุณภาพดีกว่า ถูกกว่า และเร็วกว่าการแตก subagent ตามผังองค์กร ลูกค้ารายหนึ่งเร็วขึ้นราว 2 เท่า พร้อมปล่อย single-agent-loop-kit (Apache-2.0) เป็น skill ที่ audit ระบบเดิมแล้วพับ subagent ทีละตัว และเก็บไว้เฉพาะตัวที่ eval บอกว่ายังจำเป็น

· อ่าน 5 นาที
MCP TypeScript SDK 2.4.0 เป็น SDK ทางการตัวแรกที่ปล่อย Skills over MCP (SEP-2640) ใน release จริง — loadSkills() เสิร์ฟทั้งโฟลเดอร์ SKILL.md, SkillsClient ตรวจ digest ทุกไฟล์ ส่วน Python/C# merge แล้วแต่ยังไม่ออก release
AI Skills

MCP TypeScript SDK 2.4.0 เป็น SDK ทางการตัวแรกที่ปล่อย Skills over MCP (SEP-2640) ใน release จริง — loadSkills() เสิร์ฟทั้งโฟลเดอร์ SKILL.md, SkillsClient ตรวจ digest ทุกไฟล์ ส่วน Python/C# merge แล้วแต่ยังไม่ออก release

23 ต.ค. 2026 MCP TypeScript SDK 2.4.0 ปล่อยการรองรับ Skills extension (SEP-2640) ทั้งฝั่ง server และ client เป็น SDK อ้างอิงตัวแรกที่เอาฟีเจอร์นี้ขึ้น release จริง หลังสเปกขึ้นสถานะ Final มาตั้งแต่ 13 ก.ย. ทำงานได้ทั้งโปรโตคอล 2025-11-25 และ 2026-07-28 แต่ attach() ยังเป็น experimental

· อ่าน 5 นาที
Anthropic ยก Agent Skills (มาตรฐาน SKILL.md) ให้ Agentic AI Foundation ใต้ Linux Foundation ต่อจาก MCP — 70+ แพลตฟอร์มรองรับแล้ว ทั้ง ChatGPT, Cursor, Copilot และ VS Code
AI Skills

Anthropic ยก Agent Skills (มาตรฐาน SKILL.md) ให้ Agentic AI Foundation ใต้ Linux Foundation ต่อจาก MCP — 70+ แพลตฟอร์มรองรับแล้ว ทั้ง ChatGPT, Cursor, Copilot และ VS Code

เมื่อ 22 ต.ค. 2026 Anthropic มอบมาตรฐาน Agent Skills ให้ Agentic AI Foundation (AAIF) ใต้ Linux Foundation พร้อมชื่อ โลโก้ GitHub org และโดเมน agentskills.io มาตรฐานจะมี Technical Steering Committee จากหลายบริษัทดูแล และมี maintainer จาก Anthropic, Google, OpenAI ที่ทำงานในนามบุคคล roadmap แรกที่เสนอคือ versioned release, กระบวนการ proposal และแนวทาง security สำหรับคนเขียนและติดตั้ง skill

· อ่าน 4 นาที