Human-in-the-Loop AI Self-Improvement Framework
Loopai is a program synthesis and execution framework that transforms natural language specifications into executable programs. It provides infrastructure for building adaptive AI-powered applications with multi-language support and complete data sovereignty.
Instead of making repeated calls to language models, Loopai generates programs once and executes them locally. This approach offers:
- Cost Efficiency: Programs run locally instead of calling remote LLM APIs
- Low Latency: Local execution eliminates network round-trips
- Data Privacy: All execution data stays on your infrastructure
- Continuous Improvement: Programs can be refined based on collected data
┌─────────────────────────────────────┐
│ Consumer Applications │ (Your End-User Apps)
│ (E-commerce, Email, Support, etc.) │
└──────────────┬──────────────────────┘
│ Uses multiple Loop Apps
▼
┌─────────────────────────────────────┐
│ Loop Apps │ (Individual Task Instances)
│ spam-detector, sentiment-analyzer │
│ email-categorizer, etc. │
└──────────────┬──────────────────────┘
│ Built on & Managed by
▼
┌─────────────────────────────────────┐
│ Loopai Framework │ (Infrastructure Middleware)
├─────────────────────────────────────┤
│ Cloud Platform │ → Generate & Improve Programs
│ Edge Runtime │ → Execute & Store Data
│ Client SDKs │ → .NET, Python, TypeScript
│ CodeBeaker │ → Multi-Language Execution
└─────────────────────────────────────┘
Loopai Framework: Infrastructure middleware for program synthesis and execution Loop Apps: Individual task instances (e.g., spam-detector-001, sentiment-analyzer-001) Consumer Apps: Your applications that use multiple Loop Apps CodeBeaker: Multi-language execution engine (Python, JavaScript, Go, C#)
New to Loopai? Read CONCEPTS.md for a clear explanation of Loop Apps and how they relate to the framework.
.NET:
dotnet add package Loopai.ClientPython:
pip install loopaiTypeScript:
npm install @loopai/sdkcd src/Loopai.CloudApi
dotnet runEach Loop App has its own execution endpoint. Here's how to execute programs:
.NET:
builder.Services.AddLoopaiClient(options =>
{
options.BaseUrl = "http://localhost:8080";
});
// Execute spam detector Loop App
var result = await _loopai.ExecuteAsync("spam-detector-001", new { text = "Buy now!" });
// Result: { "output": "spam", "latency_ms": 3.2 }Python:
from loopai import LoopaiClient
async with LoopaiClient("http://localhost:8080") as client:
# Execute sentiment analyzer Loop App
result = await client.execute("sentiment-analyzer-001",
{"feedback": "Great product!"})
# Result: { "output": "positive", "latency_ms": 4.1 }TypeScript:
import { LoopaiClient } from '@loopai/sdk';
const client = new LoopaiClient({ baseUrl: 'http://localhost:8080' });
// Execute email categorizer Loop App
const result = await client.execute({
loopAppId: 'email-categorizer-001',
input: { subject: 'Meeting tomorrow', body: '...' }
});
// Result: { output: 'inbox', latency_ms: 2.8 }Note: Loop App IDs follow the pattern
{task-name}-{instance}(e.g.,spam-detector-001). See CONCEPTS.md for details.
Production-ready client SDKs for .NET, Python, and TypeScript with:
- Async/await support
- Automatic retry with exponential backoff
- Batch operations with concurrency control
- Type safety and comprehensive error handling
Extensible architecture for custom validation, sampling, and event handling:
public class MyValidatorPlugin : IValidatorPlugin
{
public string Name => "my-validator";
public Task<ValidationResult> ValidateAsync(
ExecutionRecord execution,
ValidationContext context,
CancellationToken ct)
{
// Custom validation logic
}
}
registry.Register<IValidatorPlugin>(new MyValidatorPlugin());Plugin types:
- Validators: Custom execution result validation
- Samplers: Custom sampling strategies
- Webhook Handlers: Event-driven integrations
Efficient bulk processing with concurrency control:
var request = new BatchExecuteRequest
{
TaskId = taskId,
Items = items,
MaxConcurrency = 10
};
var response = await client.BatchExecuteAsync(request);CodeBeaker provides isolated execution environments for multiple languages:
- Python
- JavaScript (Deno runtime)
- Go
- C#
Programs execute in sandboxed environments with resource limits and timeout control.
- Text Classification: Spam detection, content moderation, topic categorization
- Pattern Recognition: Email categorization, log parsing, data validation
- High Volume Processing: Applications with 10K+ requests/day
- Low Latency Requirements: Tasks requiring <50ms response time
- Creative Generation: Novel content creation, story writing
- Complex Reasoning: Multi-step inference, mathematical proofs
- High-Stakes Decisions: Applications requiring >98% accuracy (medical, legal)
Loopai/
├── sdk/
│ ├── dotnet/ # .NET Client SDK
│ ├── python/ # Python Client SDK
│ └── typescript/ # TypeScript SDK
├── src/
│ ├── Loopai.CloudApi/ # C# Cloud API
│ ├── Loopai.Core/ # Core library
│ └── Loopai.Client/ # .NET SDK
├── tests/
│ ├── integration/ # SDK integration tests
│ └── Loopai.Core.Tests/ # Unit tests
├── docs/
│ ├── ARCHITECTURE.md # Architecture overview
│ ├── GETTING_STARTED.md # Quick start guide
│ ├── DEPLOYMENT.md # Deployment guide
│ └── PLUGIN_DEVELOPMENT_GUIDE.md
└── README.md
# Clone repository
git clone https://github.com/iyulab/loopai.git
cd loopai
# Start API server
cd src/Loopai.CloudApi
dotnet run
# Run tests
dotnet testContributions are welcome! Areas for contribution:
- SDK enhancements and new language support
- Custom plugins (validators, samplers, webhooks)
- Documentation and examples
- Testing and performance benchmarks
Please read CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
- GitHub Issues: github.com/iyulab/loopai/issues
- Discussions: github.com/iyulab/loopai/discussions
Built on research in program synthesis, knowledge distillation, and human-in-the-loop AI.