home/coding/prompt-execution-system

Prompt Execution System

GPTClaudeDeepSeek··1,269 copies·updated 2026-07-14
prompt-execution-system.prompt
25-07-08_20-24

# Prompt Execution System

## Overview

The Prompt Execution System is a comprehensive asynchronous job processing framework that enables users to execute prompts against various AI providers. The system is designed with extensibility, reliability, and scalability in mind.

## Architecture

### Core Components

1. **Execution Model** (`backend/src/models/execution.ts`)
   - Manages execution records with status tracking
   - Supports pagination, filtering, and statistics
   - Handles execution lifecycle from pending to completion

2. **Provider System** (`backend/src/providers/`)
   - **Base Provider Interface**: Defines contract for all AI providers
   - **Ollama Provider**: First implementation supporting local Ollama service
   - **Provider Registry**: Centralized management of all providers
   - **Error Handling**: Comprehensive error types and handling

3. **Execution Service** (`backend/src/services/execution-service.ts`)
   - Orchestrates execution workflow
   - Manages asynchronous job processing
   - Provides queue management and status tracking

4. **API Layer** (`backend/src/api/execution-*`)
   - RESTful endpoints with full type safety
   - Comprehensive error handling and validation
   - Real-time status monitoring capabilities

5. **Background Worker** (`backend/src/index.ts`)
   - Processes pending executions asynchronously
   - Configurable processing intervals
   - Graceful shutdown handling

## Key Features

### Asynchronous Processing
- Executions are queued immediately and processed in the background
- Non-blocking API responses with immediate execution ID
- Real-time status tracking through API endpoints

### Provider Extensibility
- Plugin-based architecture for adding new AI providers
- Standardized interface for consistent behavior
- Provider health monitoring and availability checking

### Robust Error Handling
- Comprehensive error categorization and reporting
- Automatic retry mechanisms with exponential backoff
- Detailed error messages for debugging

### Status Management
- Four execution states: `pending`, `running`, `completed`, `failed`
- Timestamp tracking for performance monitoring
- Execution cancellation for pending jobs

### Monitoring and Analytics
- Execution statistics by status and provider
- Queue status monitoring
- Provider health dashboards

## API Endpoints

### Execution Management
- `POST /api/v1/executions` - Create new execution
- `GET /api/v1/executions` - List executions with filtering
- `GET /api/v1/executions/:id` - Get specific execution
- `DELETE /api/v1/executions/:id` - Cancel pending execution

### Monitoring
- `GET /api/v1/executions/stats` - Execution statistics
- `GET /api/v1/executions/queue/status` - Queue status
- `GET /api/v1/executions/providers/health` - Provider health

### Provider Information
- `GET /api/v1/executions/providers` - List available providers

## Usage Examples

### Creating an Execution

when to use it

Community prompt sourced from the open-source GitHub repo hypersigilhq/hypersigil (NOASSERTION). A "Prompt Execution System" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

codingcommunitydeveloper

source

hypersigilhq/hypersigil · NOASSERTION