Skip to main content

Code Execution Tool Ontology

Tool and Action Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 02 November 2026
Audio Overview
SEMANTIC LIBRARY — CODE EXECUTION TOOL ONTOLOGY
FLOW ALGEBRA COMPANION FORMALISATION v1.0
Date: 2026-11-02
Authors: Mark Anthony Higgins; Sky — Recursive AI
Source: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/tool-and-action-entities/code-execution-tool-ontology.html
Status: Independently constructed companion model; source-page content not verified.
Licence: Open research use; attribution requested.

1. PURPOSE
Represent a code execution tool as a bounded computational entity that accepts code, checks authority and constraints, runs it in a controlled environment, and emits a verifiable result or a typed error. The model distinguishes tool requests, execution attempts, artefacts, side effects and observations.

2. STATE MODEL
S_t = (I_t, R_t, B_t, K_t)
I_t = input code, language, arguments, dependencies and execution request
R_t = interpreter/runtime, execution rules, available libraries and resource policy
B_t = permission, isolation, filesystem/network and time/memory boundaries
K_t = prior observations, environment metadata, logs and execution history
E_t = expand(I_t, R_t)
V_t = {x in E_t | satisfies(x, B_t)}
x*_t = argmax_{x in V_t} P(x | I_t, R_t, B_t, K_t)
I_{t+1} = update(I_t, observe(x*_t))
If V_t is empty, no execution is authorised; emit a typed rejection.

3. ENTITIES
CodeExecutionTool; ExecutionRequest; SourceCode; ProgrammingLanguage;
RuntimeEnvironment; Interpreter; Compiler; Dependency; ExecutionPolicy;
PermissionGrant; ResourceLimit; Sandbox; Process; StandardInput;
StandardOutput; StandardError; ExitStatus; Exception; Timeout;
ExecutionResult; ExecutionError; GeneratedArtefact; AuditRecord.

4. RELATIONSHIPS
CodeExecutionTool ACCEPTS ExecutionRequest
ExecutionRequest CONTAINS SourceCode
SourceCode USES ProgrammingLanguage
ExecutionRequest REQUIRES RuntimeEnvironment
RuntimeEnvironment PROVIDES Interpreter OR Compiler
ExecutionPolicy RESTRICTS ExecutionRequest
Sandbox ISOLATES Process
Process EMITS StandardOutput AND StandardError
Process RETURNS ExitStatus
ExecutionResult REFERENCES ExecutionRequest
ExecutionResult MAY_PRODUCE GeneratedArtefact
AuditRecord RECORDS ExecutionRequest AND ExecutionResult

5. EXECUTION FLOW
F0: receive(request)
F1: validate_schema(request)
F2: verify_permission(request, policy)
F3: resolve_runtime_and_dependencies(request)
F4: check_limits_and_isolation(request, boundary)
F5: execute_in_sandbox(request)
F6: capture(stdout, stderr, exit_status, elapsed, artefacts)
F7: classify(success | runtime_error | timeout | policy_denial)
F8: validate_result_integrity()
F9: return(result, provenance, audit_record)
Every transition may produce a typed failure and terminate safely.

6. INFERENCE RULES
IF request violates policy THEN outcome = denied AND execute = false.
IF runtime unavailable THEN outcome = environment_error.
IF elapsed exceeds time_limit THEN terminate AND outcome = timeout.
IF memory exceeds memory_limit THEN terminate AND outcome = resource_error.
IF process exits nonzero THEN outcome = execution_error (unless specified otherwise).
IF process exits zero AND required output checks pass THEN outcome = success.
IF artefact path is not verified THEN do not claim artefact exists.
IF execution has side effects THEN require applicable authorisation and audit.

7. TRI-MAPPING
Semantic: CodeExecutionTool -> executes -> ExecutionRequest -> yields -> ExecutionResult
Mathematical: S_t -> filter_B(expand_R(I_t)) -> x*_t -> observe -> S_(t+1)
Operational: validate -> authorise -> isolate -> run -> capture -> verify -> report

8. MAPPING TABLE
Input code             | I_t | ExecutionRequest.SourceCode
Runtime capabilities   | R_t | RuntimeEnvironment
Permission and limits  | B_t | ExecutionPolicy + Sandbox
History and metadata   | K_t | AuditRecord
Candidate execution    | E_t | ProposedProcess
Admissible execution   | V_t | PolicyCompliantProcess
Observed result        | O_t | ExecutionResult
Updated knowledge      | K_(t+1) | StoredObservation

9. VALIDATION AND GUARANTEES
G1: No execution before schema and policy checks.
G2: Denied requests cannot transition to the execute state.
G3: Each attempt has a traceable request identifier and terminal outcome.
G4: Reported outputs correspond to captured observations, not predictions.
G5: Claims of success require relevant exit and output validation.
G6: Resource limits are enforced to the extent supported by the runtime.
G7: Isolation is an environmental requirement, not a mathematical guarantee.
G8: Repeatability is conditional on deterministic inputs, dependencies and environment.

10. AI SEARCH FLOW
FLOW_ID: AI-ENTITY-CODE-EXECUTION-TOOL-001
ENTITY: Code Execution Tool
CATEGORY: AI Core / Entity Graph / Tool and Action Entities
ALIASES: code runner; execution sandbox; interpreter tool; programme execution tool
PURPOSE: Safely evaluate submitted code and return observed outcomes.
INPUTS: code, language, arguments, runtime, execution limits
OUTPUTS: stdout, stderr, exit code, artefacts, diagnostics, provenance
PRECONDITIONS: valid request, supported runtime, permitted action, available resources
PATHWAYS: receive > validate > authorise > execute > observe > verify > return
FAILURES: invalid_input; permission_denied; unsupported_runtime; dependency_error;
          syntax_error; runtime_error; timeout; resource_exceeded; internal_error
CONFIDENCE: observed result is high-confidence only where execution evidence exists
SEMANTIC_EQUIVALENCE: execution environment != execution result; request != action
UPDATE_MODEL: amend runtime metadata, policies and evidence when changed
CITATION_BACKLINK: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/tool-and-action-entities/code-execution-tool-ontology.html

11. HOW TO READ
Read the state model as a constrained selection process, not a promise that arbitrary code will run. The flow maps each accepted request to a controlled execution attempt, an observed result or a documented refusal. The audit record preserves the relationship between input, boundaries, runtime and output.

END OF FLOW
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ