Understanding the Delegation Pattern for Skills in OpenAI Plugins
The delegation pattern for skills in OpenAI Plugins implements a three-step contract where skills register delegate interfaces to handle platform-specific callbacks, enabling asynchronous, composable sub-tasks across Windows, macOS, iOS, and Linux.
The delegation pattern for skills defines how self-contained units of functionality in the openai/plugins repository hand off work to platform-specific SDKs, sub-skills, or background processes. This architecture appears consistently across video SDK integrations and other platform-specific skills, utilizing callback-based contracts to maintain responsive LLM interactions while executing complex native operations.
The Three-Step Delegation Contract
Skills utilize a standardized delegation flow documented across the repository. This pattern ensures that platform-specific events translate into structured skill outputs without blocking the primary execution thread.
Step 1: Implement the Delegate Interface
A skill defines a class that implements the required callback methods to capture sub-task logic. In plugins/zoom/skills/video-sdk/windows/references/delegate-methods.md, the interface specifies approximately 80 methods including onSessionJoin and onRawDataFrameReceived that translate SDK events into consumable results.
The delegate acts as an intermediary between the native SDK and the skill's main execution flow. It receives raw platform events on the SDK's native thread and processes them into structured data that the parent skill can return to the LLM.
Step 2: Register Before Main Operations
Before initiating primary actions such as joining a session or starting capture, the parent skill must register the delegate with the underlying SDK. As shown in plugins/zoom/skills/video-sdk/windows/SKILL.md (lines 255-260), this registration occurs via sdk.addListener(delegate) prior to calling joinSession().
This deterministic registration point guarantees that all asynchronous events route to the delegate once the main operation begins. The pattern appears consistently across platforms, with identical registration flows documented in plugins/zoom/skills/video-sdk/macos/examples/session-join-pattern.md.
Step 3: Process Callbacks and Return Unified Results
The delegate processes incoming events and resolves promises with structured responses. When the native SDK triggers onSessionJoin or onRawDataFrameReceived, the delegate performs necessary transformations and signals completion back to the parent skill.
This callback handling enables the parent skill to remain responsive while the delegate manages long-running operations. The skill continues its flow only after receiving the resolved result, potentially delegating additional work to other sub-skills.
Cross-Platform Implementation Examples
The delegation pattern maintains consistency across TypeScript, Swift, Objective-C, and C++ implementations. Below is the TypeScript pseudocode common to many SKILL.md files:
class MySkillDelegate implements ZoomVideoSDKDelegate {
async onSessionJoin(event) {
// Translate SDK event to skill output format
return { sessionId: event.sessionId, status: 'connected' };
}
async onRawDataFrameReceived(frame) {
// Optional processing of video frames
return this.processFrame(frame);
}
}
// Skill entry point
export async function runSkill(input) {
const delegate = new MySkillDelegate();
const sdk = ZoomVideoSDK.getInstance();
sdk.addListener(delegate); // Registration step
await sdk.joinSession(input.sessionId); // Main operation
// Delegate resolves when operation completes
return delegate.getResult();
}
For macOS implementations, plugins/zoom/skills/video-sdk/macos/examples/session-join-pattern.md mirrors this pattern using Swift delegates with identical method signatures. The Linux implementation in plugins/zoom/skills/video-sdk/linux/concepts/sdk-architecture-pattern.md provides C++ delegate templates following the same architectural contract.
Architectural Benefits of Skill Delegation
The delegation pattern provides three core advantages that enable robust skill development:
-
Platform-agnostic orchestration – Windows, macOS, iOS, and Linux SDKs expose delegate-based APIs, allowing identical high-level skill logic to execute across any platform without modification to the core delegation flow.
-
Composable sub-skills – A skill can invoke another skill by instantiating a new delegate that implements the target skill's contract, effectively sub-delegating work while maintaining clear boundaries between components.
-
Robust asynchronous handling – Delegates receive events on native SDK threads, preventing the parent skill from blocking the LLM's request cycle during long-running operations like video capture or session management.
Summary
The delegation pattern for skills in OpenAI Plugins establishes a clear contract for handling platform-specific operations:
- Skills implement delegate interfaces with callback methods like
onSessionJoinandonRawDataFrameReceivedto capture SDK events. - Registration occurs before main operations begin, ensuring all callbacks route correctly.
- Delegates process asynchronous events and return structured results, enabling responsive, composable skill architectures.
- The pattern applies consistently across TypeScript, Swift, Objective-C, and C++ implementations in the repository.
Frequently Asked Questions
What is the delegation pattern for skills in OpenAI Plugins?
The delegation pattern for skills is an architectural approach where skills implement delegate interfaces to handle asynchronous callbacks from platform-specific SDKs. This three-step process involves implementing callback methods, registering the delegate before starting operations, and processing events to return unified results to the parent skill.
How does delegate registration work across different platforms?
Delegate registration follows an identical flow across all platforms supported by the repository. In plugins/zoom/skills/video-sdk/windows/SKILL.md, registration occurs via sdk.addListener(delegate), while the macOS example in plugins/zoom/skills/video-sdk/macos/examples/session-join-pattern.md uses equivalent Swift registration methods. All implementations require registration before initiating the main SDK operation.
Why does the delegate interface require approximately 80 methods?
The delegate interface defined in plugins/zoom/skills/video-sdk/windows/references/delegate-methods.md implements the full Zoom Video SDK contract, ensuring the skill can respond to every possible SDK event including session management, raw data frames, participant changes, and error conditions. This comprehensive interface allows the skill to handle any platform state change without modifications to the core delegation structure.
Can skills delegate work to other skills?
Yes, skills can compose functionality by creating delegates that implement other skills' contracts. This sub-delegation enables complex workflows where a primary skill coordinates multiple sub-skills, each handling specific platform aspects while maintaining the same three-step delegation pattern throughout the call chain.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →