PitchHut logo
A protocol for parallel AI execution with automatic conflict resolution.
Pitch

OSWP revolutionizes the way AI agents collaborate by allowing parallel execution and automatic conflict resolution. By extending traditional three-way merge algorithms, OSWP enhances performance, making workflows 2-4x faster and ensuring consistent results. Embrace a more efficient approach to managing AI outputs with OSWP.

Description

OSWP - Open Shadow Workspace Protocol

OSWP is a versatile, platform-agnostic protocol designed to facilitate the parallel execution of AI agents with automatic conflict resolution capabilities. It builds upon the foundations of traditional three-way merge algorithms, commonly utilized in version control systems like Git and Mercurial, to address complex challenges in AI output handling, including:

  • Semantic conflicts in AI-generated outputs
  • Confidence-weighted merging strategies
  • N-way parallel execution of tasks
  • Policy-driven resolution mechanisms

Key Advantages of OSWP

OSWP significantly enhances performance over traditional sequential processing methods. Consider the following performance comparison:

Traditional sequential approach:

Query → Agent A (200ms) → Agent B (300ms) → Agent C (500ms)
Total: 1000ms + coordination overhead

OSWP parallel approach:

Query → [Agent A || Agent B || Agent C] → Merge (50ms)
Total: 550ms with automatic conflict resolution

This innovative approach offers a potential performance improvement of 2 to 4 times faster operations while ensuring guaranteed consistency across results.

Features

  • Platform Agnostic: Compatible with Node.js, Deno, Bun, Cloudflare Workers, and browsers.
  • Multiple Merge Strategies: Options include first-wins, highest-confidence, consensus, and semantic similarity.
  • Automatic Conflict Detection: Identify structural, semantic, and value conflicts seamlessly.
  • Policy-Driven Resolution: Implement customizable fallback strategies for conflict management.
  • Resource Tracking: Monitor token usage, API calls, and latency effectively.
  • Type Safety: Comprehensive support for TypeScript, ensuring type safety throughout development.
  • Production Ready: Incorporates robust algorithms refined over 40 years in version control systems.

Core Concepts

The OSWP framework revolves around a systematic workspace lifecycle, encompassing steps such as:

  1. CREATE: Establish a workspace with a base context.
  2. FORK: Generate multiple shadow workspaces for concurrent processing.
  3. EXECUTE: Run agents in parallel to gather results efficiently.
  4. MERGE: Compile the outcomes while detecting any conflicts.
  5. RESOLVE: Manage conflicts through automatic or manual processes.
  6. COMMIT: Return the final resolved result.

Example Usage

A basic implementation may look like this:

import { OSWPWorkspaceManager } from '@oswp/core';
import { SQLiteStorage } from '@oswp/adapters-storage-sqlite';

// Setup the storage and workspace manager
const storage = new SQLiteStorage('./oswp.db');
const manager = new OSWPWorkspaceManager(storage);

// Register an agent to execute logic
manager.registerExecutor({
  id: 'agent-a',
  type: 'search',
  version: '1.0.0',
  async execute(context) {
    const result = await yourAgentLogic(context.input);
    return {
      output: result,
      confidence: 0.8,
      resources: []
    };
  }
});

// Execute in parallel
const workspace = await manager.createWorkspace(
  { query: 'Your query here' },
  {},
  { strategy: 'highest-confidence' }
);

await manager.forkShadows(workspace.id, ['agent-a', 'agent-b', 'agent-c']);
const result = await manager.mergeShadows(workspace.id);

console.log(result.resolved);  // Merged output
console.log(result.conflicts);  // Detected conflicts

Performance Insights

OSWP efficiently reduces execution time, as highlighted by benchmark results:

ScenarioSequentialOSWP ParallelImprovement
3 agents, simple600ms250ms2.4x
3 agents, complex1500ms550ms2.7x
5 agents, simple1000ms300ms3.3x
5 agents, complex2500ms650ms3.8x

Integrations and Extensibility

OSWP is designed with extensibility in mind, providing various storage and executor adapters, alongside seamless integration with frameworks like ARDF (Agent Resource Discovery Framework) and MCP (Model Context Protocol).

Explore the full specification and the API documentation to discover the capabilities and usage of OSWP.

0 comments

No comments yet.

Sign in to be the first to comment.