Free SKILL.md scraped from GitHub. Clone the repo or copy the file directly into your Claude Code skills directory.
npx versuz@latest install hiyenwong-ai-collection-collection-skills-agentic-human-in-the-loop-cpsgit clone https://github.com/hiyenwong/ai_collection.gitcp ai_collection/SKILL.MD ~/.claude/skills/hiyenwong-ai-collection-collection-skills-agentic-human-in-the-loop-cps/SKILL.md---
name: agentic-human-in-the-loop-cps
description: "Reactor model-of-computation based framework for robustness and determinism in agentic AI-powered human-in-the-loop cyber-physical systems. Uses Lingua Franca framework to address nondeterminism from unpredictable human users, AI agents, and dynamic physical environments. Use for: agentic CPS design, human-in-the-loop systems, Lingua Franca implementation, reactor MoC, AI-powered CPS. Activation: agentic CPS, human-in-the-loop, Lingua Franca, reactor model, AI-powered CPS."
---
# Agentic Human-in-the-Loop CPS
Reactor model-of-computation (MoC) based approach for enabling robustness and determinism in agentic AI-powered human-in-the-loop cyber-physical systems.
## Overview
This framework addresses the challenge of uncontrollable nondeterminism in HITL CPS by:
- Leveraging reactor MoC for deterministic execution
- Using Lingua Franca framework for implementation
- Managing unpredictability from humans, AI agents, and physical environments
- Providing pathways to reintroduce determinism
## Core Concepts
### Sources of Nondeterminism
```
HITL CPS Nondeterminism Sources:
├── Human Users (unpredictable behavior)
├── AI Agents (foundation model uncertainty)
└── Physical Environment (dynamic changes)
↓
Uncontrollable
Nondeterminism
↓
Reactor MoC Solution
```
### Reactor Model-of-Computation
```
Reactor Components:
├── Reactions (sequential execution)
├── Ports (typed communication)
├── Connections (deterministic data flow)
└── Hierarchical composition
```
Key Properties:
- **Deterministic**: Same inputs → same outputs
- **Composable**: Reactors can be nested
- **Timed**: Logical time for coordination
- **Reactive**: Response to inputs
## Architecture
### Agentic HITL CPS Design
```
┌─────────────────────────────────────────┐
│ Agentic HITL CPS System │
├─────────────────────────────────────────┤
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Human │ │ AI │ │Physical │ │
│ │ User │←→│ Agent │←→│ System │ │
│ │ Reactor │ │ Reactor │ │ Reactor │ │
│ └────┬────┘ └────┬────┘ └────┬────┘ │
│ └─────────────┴─────────────┘ │
│ Coordination │
│ Reactor │
└─────────────────────────────────────────┘
```
### Lingua Franca Implementation
```lf
target Python
reactor HumanInterface {
input user_action: {action: str, params: dict}
output interpreted_command: Command
reaction(user_action) {=
# Process unpredictable human input
cmd = interpret_user_action(user_action)
interpreted_command.set(cmd)
=}
}
reactor AIAgent {
input context: Context
input human_input: Command
output decision: Decision
reaction(context, human_input) {=
# Foundation model inference
# (nondeterministic but managed)
decision.set(llm_decide(context, human_input))
=}
}
reactor PhysicalSystem {
input command: Decision
output state: State
reaction(command) {=
# Execute on physical system
new_state = execute(command)
state.set(new_state)
=}
}
federated reactor AgenticCPS {
human = new HumanInterface()
agent = new AIAgent()
physical = new PhysicalSystem()
human.interpreted_command -> agent.human_input
agent.decision -> physical.command
physical.state -> agent.context
}
```
## Implementation Patterns
### Pattern 1: Input Normalization
```python
class HumanInputReactor:
"""Normalize unpredictable human input."""
def reaction(self, raw_input):
# Constraint: Handle within time budget
with timeout(max_response_time):
# Semantic parsing
intent = parse_intent(raw_input)
# Validation
if self.is_valid(intent):
return normalize(intent)
else:
return self.request_clarification()
```
### Pattern 2: AI Agent Determinism
```python
class AIAgentReactor:
"""Manage foundation model nondeterminism."""
def __init__(self):
self.temperature = 0.0 # Minimize randomness
self.seed = deterministic_seed()
self.cache = ResponseCache()
def reaction(self, context, human_input):
# Cache check for determinism
cache_key = hash((context, human_input))
if cache_key in self.cache:
return self.cache[cache_key]
# Controlled LLM call
response = self.llm.generate(
context=context,
prompt=human_input,
temperature=self.temperature,
seed=self.seed
)
self.cache[cache_key] = response
return response
```
### Pattern 3: Physical System Safety
```python
class PhysicalSystemReactor:
"""Safe execution on physical system."""
def reaction(self, command):
# Safety check
if not self.is_safe(command):
self.emergency_stop()
return self.safe_state()
# Execute with monitoring
try:
result = self.execute(command)
return result
except PhysicalException as e:
self.handle_fault(e)
return self.recovery_state()
```
## Determinism Strategies
### 1. Temporal Determinism
```
Logical Time Management:
- Assign logical timestamps to events
- Reactions execute at specific logical times
- Physical time is separate from logical time
```
### 2. Semantic Determinism
```
Input Standardization:
- Normalize human commands to canonical forms
- Discretize continuous physical measurements
- Standardize AI agent outputs
```
### 3. Fallback Determinism
```
Graceful Degradation:
- Timeout-based fallbacks for unresponsive components
- Safe defaults when AI is uncertain
- Predefined behaviors for physical faults
```
## Case Study: Agentic Driving Coach
### System Overview
```
Application: AI-powered driving assistance
Components:
├── In-car sensors (physical)
├── Driving coach AI (agent)
└── Driver interaction (human)
```
### Challenges Addressed
1. **Unpredictable Driver Behavior**
- Reaction: Input normalization reactor
- Approach: Intent recognition with fallback
2. **AI Agent Uncertainty**
- Reaction: Cached responses with low temperature
- Approach: Consistent decision-making
3. **Dynamic Traffic Environment**
- Reaction: Real-time sensor fusion
- Approach: Time-triggered updates
## Tools and Commands
| Command | Purpose |
|---------|---------|
| `lfc` | Compile Lingua Franca code |
| `lfd` | Run federated execution |
| `trace` | Analyze deterministic execution |
## Activation Keywords
- agentic CPS
- human-in-the-loop
- Lingua Franca
- reactor model
- AI-powered CPS
- deterministic HITL
- foundation model CPS
## Related Skills
- `automated-cps-testing-act`: Testing framework for CPS
- `lingua-franca`: General LF programming
- `cyber-physical-systems`: General CPS patterns
## References
- Paper: arXiv:2604.11705 (April 2026)
- Authors: Prahlad, Fan, Kim
- Framework: Lingua Franca (reactor MoC)
- Application: Agentic driving coach
## Example Usage
```
"Design agentic HITL CPS with reactor MoC"
"Implement Lingua Franca for human-AI-robot interaction"
"Manage nondeterminism in foundation model CPS"
"Create deterministic AI agent for physical systems"
```
## Best Practices
1. **Time Management**: Use logical time for coordination
2. **Fallback Design**: Always have safe defaults
3. **Input Validation**: Normalize all human inputs
4. **AI Control**: Minimize temperature, use caching
5. **Safety First**: Physical safety over performance
## Notes
- Reactor MoC provides deterministic semantics
- Lingua Franca enables distributed execution
- Foundation model uncertainty requires management
- Human input needs semantic normalization
- Physical environment requires safety monitoring