A modular prompt-driven execution runtime for routing user intent to commands, tools, and permission-aware execution pipelines.
Designed as a deterministic runtime layer that analyzes user intent, routes execution requests to the most relevant commands and tools, enforces permission boundaries before execution, and returns fully traceable runtime sessions.
User Prompt
↓
PortRouter
↓
ExecutionEngine
↓
QueryEnginePort
↓
RuntimeSession
| Component | Responsibility |
|---|---|
| PortRouter | Tokenizes prompts, scores modules, and routes execution requests |
| ExecutionRegistry | Stores and resolves available commands and tools |
| ExecutionEngine | Executes matched components and enforces permission policies |
| QueryEnginePort | Aggregates execution results into structured runtime output |
| RuntimeSession | Stores prompt, routing decisions, execution logs, and final results |
from query_runtime import CleanRuntime
runtime = CleanRuntime()
session = runtime.run(
"Search how data processing using python?"
)
print(session.routed_matches)
print(session.command_execution_messages)
print(session.tool_execution_messages)[
RoutedMatch(
kind='command',
name='search',
score=1
),
RoutedMatch(
kind='tool',
name='python',
score=1
)
]
Prompt-to-module routing based on token scoring.
Execution permissions are validated before tool invocation.
Every execution produces a structured RuntimeSession.
New commands, tools, scoring strategies, and policies can be added without changing the core runtime.
- Prompt tokenization
- Command routing
- Tool routing
- Execution registry
- Permission enforcement
- Runtime session tracking
- Structured execution logging
- Semantic routing (Embeddings / BM25 / Hybrid retrieval)
- Role-based access control (RBAC)
- Async execution pipelines
- DAG-based dependency execution
- Adaptive confidence thresholds
- Multi-agent orchestration
Full source code:
https://github.com/Ahmad-Al-Dibo/execution-routing-engine
Architecture article:
Ahmad Al Dibo Student
This tool was inspired by the leaked Cloudcode code; I transformed it into a usable tool and used artificial intelligence to organize the code.