
lmstudio-orchestrator
Deterministic multi-agent orchestration system for LMStudio enabling constraint-driven agent composi
LMStudio Orchestrator Skill
A comprehensive multi-agent orchestration system for LMStudio that enables deterministic agent composition, constraint-driven validation, semantic field navigation, and thermodynamic resource allocation.
Overview
This skill transforms LMStudio into a powerful multi-agent platform by providing:
- Constraint-Driven Composition: Agent configurations that cannot fail through validation
- Semantic Navigation: Navigate solution spaces via resonance rather than hardcoded paths
- Resource Optimization: Thermodynamic scheduling for optimal VRAM/compute allocation
- Multiple Execution Strategies: 8 different strategies (parallel, consensus, hierarchical, etc.)
- Deterministic Discovery: Always introspect before configuration
Core Principles
- Discovery Before Configuration: Never hardcode - always discover available models first
- Constraints Enable Composition: Invalid states are unpresentable through validation
- Declarative Over Imperative: Users specify intent, system determines implementation
Installation
This skill is already installed in the semantic-mesh project. To use it:
# Ensure LMStudio is running locally
# Default endpoint: http://localhost:1234
# Load at least one model in LMStudio
# For optimal results, load multiple models of varying sizes
Directory Structure
lmstudio-orchestrator/
├── SKILL.md # Complete skill documentation
├── README.md # This file
├── references/
│ ├── api_reference.md # API documentation
│ └── constraints.yaml # Constraint definitions and templates
└── scripts/
├── orchestrator.py # Main orchestration engine
├── composer.py # Agent composition logic
├── discovery.py # Model discovery and introspection
├── constraints.py # Constraint validation
└── dynamic_prompts.py # Dynamic prompt generation
Quick Start
Basic Usage
import { SkillLoader } from '@terminals-tech/semantic-mesh/skills';
const loader = new SkillLoader();
await loader.initialize();
// Load the skill
const skill = loader.get('lmstudio-orchestrator');
// Use the discover_and_compose prompt
const prompt = skill.manifest.prompts.find(p => p.id === 'discover_and_compose');
Execution Strategies
The skill supports 8 different execution strategies:
- PARALLEL: Independent parallel execution (1-20 agents, 60s timeout)
- SEQUENTIAL: Chain with context passing (1-10 agents, 120s timeout)
- PIPELINE: Streaming data pipeline (2-8 agents, 90s timeout)
- CONSENSUS: Vote-based solution (3-15 agents, threshold 0.8)
- HIERARCHICAL: Coordinator delegates to specialists (2-12 agents)
- THERMODYNAMIC: Energy-minimizing resource allocation (2-20 agents)
- SEMANTIC: Resonance-based navigation (1-10 agents, threshold 0.7)
- COMBINATORIAL: Pairwise combinations (2-16 agents, 240s timeout)
Agent Roles
Six specialized agent roles with constrained parameters:
- Researcher (temp: 0.7-0.9) - Exploration, discovery, synthesis
- Analyst (temp: 0.3-0.5) - Decomposition, structure, quantification
- Critic (temp: 0.2-0.4) - Validation, challenge, verification
- Synthesizer (temp: 0.3-0.5) - Integration, summarization, unification
- Architect (temp: 0.5-0.8) - Design, planning, optimization
- Coder (temp: 0.2-0.4) - Implementation, debugging, optimization
Example Workflows
Research Task with Consensus
task: "Analyze quantum computing error correction approaches"
max_agents: 5
strategy: "consensus"
Uses 3-5 researcher/analyst agents to explore quantum error correction, then reaches consensus on the most promising approaches.
Code Architecture Review
task: "Design microservices architecture for e-commerce platform"
max_agents: 4
strategy: "hierarchical"
Architect agent coordinates specialist agents through a hierarchical workflow.
Semantic Solution Discovery
task: "Optimize database performance from 100 QPS to 1000 QPS"
strategy: "semantic"
start_concept: "current database architecture"
target_outcome: "10x query throughput"
Navigates solution space semantically through high-resonance transitions.
Resource-Optimized Parallel Execution
task: "Generate comprehensive product requirements document"
max_agents: 8
strategy: "thermodynamic"
max_vram: 48
Allocates tasks across models optimally while respecting VRAM constraints.
Python Scripts
The skill includes production-ready Python implementations:
orchestrator.py
Main orchestration engine that coordinates the entire multi-agent system.
Key Features:
- Discovery-first architecture
- Constraint validation
- Strategy selection
- Resource monitoring
- Error recovery
composer.py
Compositional agent builder using combinatorial logic.
Key Features:
- Template-based agent creation
- Role constraint validation
- Model assignment optimization
- Configuration validation
discovery.py
LMStudio endpoint introspection and model discovery.
Key Features:
- Endpoint health checking
- Model enumeration
- Capability detection
- Resource constraint discovery
constraints.py
Constraint validation and enforcement system.
Key Features:
- Schema validation
- Template constraint checking
- Strategy validation
- Resource constraint enforcement
dynamic_prompts.py
Dynamic prompt generation for different agent roles and contexts.
Key Features:
- Role-specific prompt templates
- Context injection
- Variable substitution
- Prompt optimization
Configuration
All configuration is defined in references/constraints.yaml:
agents:
min_count: 1
max_count: 20
temperature:
min: 0.0
max: 1.0
max_tokens:
default: 4096
max: 32768
timeout:
default: 60
max: 600
Dependencies
Required:
- LMStudio running locally (default: http://localhost:1234)
- At least one model loaded in LMStudio
Optional:
- Multiple models of varying sizes (for optimal resource allocation)
- Python 3.8+ (if using Python scripts directly)
Best Practices
- Always discover first - Never hardcode models or endpoints
- Compose declaratively - Let the system determine implementation
- Validate continuously - Check constraints at every step
- Monitor resources - Predict and prevent exhaustion
- Handle gracefully - Prefer partial success over total failure
- Start small - Begin with fewer agents and scale up
- Choose appropriate strategy - Match strategy to task type
Troubleshooting
Discovery Fails
Issue: Cannot connect to LMStudio endpoint
Solutions:
- Verify LMStudio is running
- Check default port (1234)
- Try manual discovery with custom endpoint
- Check firewall settings
Invalid Configuration
Issue: Constraint validation errors
Solutions:
- Review agent count against strategy limits
- Check temperature ranges for roles
- Verify models exist in discovered state
- Validate timeout within limits
Resource Exhaustion
Issue: Out of VRAM or system resources
Solutions:
- Reduce parallel agent count
- Use smaller models for non-critical tasks
- Enable thermodynamic strategy for automatic optimization
- Unload unused models from LMStudio
Low Consensus
Issue: Agents fail to reach consensus threshold
Solutions:
- Increase agent diversity (mix different models)
- Adjust temperature ranges
- Lower consensus threshold
- Use hierarchical strategy instead
Integration with Semantic Mesh
This skill integrates seamlessly with the semantic-mesh project:
import { Mesh } from '@terminals-tech/semantic-mesh';
import { SkillLoader } from '@terminals-tech/semantic-mesh/skills';
// Initialize mesh
const mesh = new Mesh(storage, embeddings);
await mesh.initialize();
// Load skill
const loader = new SkillLoader();
await loader.initialize();
const skill = loader.get('lmstudio-orchestrator');
// Use skill prompts with mesh agents
const agent = new Agent(mesh, {
capabilities: ['multi_agent_orchestration'],
metadata: {
skill: 'lmstudio-orchestrator',
strategy: 'semantic'
}
});
API Reference
See references/api_reference.md for complete API documentation.
Contributing
This is a community skill. Contributions welcome:
- Fork the semantic-mesh repository
- Modify files in
skills/community/lmstudio-orchestrator/ - Test with your LMStudio setup
- Submit pull request with examples
License
Part of the semantic-mesh project. See main project LICENSE.
Version History
- 1.0.0 (2025-11-01): Initial release
- 8 execution strategies
- 6 agent roles
- Constraint validation
- Resource optimization
- Semantic navigation
- Complete Python implementations
Support
For issues or questions:
- Open issue in semantic-mesh repository
- Tag with
skill:lmstudio-orchestrator - Include LMStudio version and model details
Related Skills
code-review-expert- Code review with security focusdata-analyst- Data analysis and visualizationcode-analyzer- Static code analysis