Declarative MILP runtimes: .telos manifests, safe linear/memory expression parsers, PuLP (CBC/HiGHS), actuators
Project description
Telos Framework / Telos OS
Telos OS is a Python framework for declarative optimization runtimes: .telos YAML manifests, MILP solving with PuLP (CBC or HiGHS), a temporal TelosRuntime (memory, chained matrices), and optional actuators. Infrastructure-as-Physics is a tagline for describing goals and constraints as math—not a second product line.
New here? docs/START_HERE.md — glossary, telos validate / telos run / telos test, how to read a manifest.
Canonical path: .telos + MILP + runtime
- Author or generate a
.telosfile (YAML →TelosSchema). telos validate/telos run/telos test— or embedTelosParser+TelosRuntimein Python.- Optionally attach actuators so numeric solutions drive Docker, Kubernetes, or custom side effects.
Expression handling: objectives and invariants use telos.linear_milp—every accepted expression is linear in decision variables; / only when the denominator is decision-free. Memory update strings use telos.memory_expr. Checked-in manifests are covered by corpus tests; dev CI runs Hypothesis fuzz on the parsers (bounded time per sample). Still treat .telos, canvas JSON, and LLM output as trusted configuration. See docs/SDK.md and ../SECURITY.md.
Architecture (MILP-first)
| Layer | Module | Role |
|---|---|---|
| Manifests | telos/parser.py |
TelosParser.load / loads — YAML → validated dict |
| MILP schema | telos/models.py |
TelosSchema, Variable, Memory, etc. |
| MILP compiler | telos/compiler.py |
PuLP TelosCompiler.compile (CBC / HiGHS; see MILP solver below) |
| Linear expressions | telos/linear_milp.py |
Safe parser for objectives / invariants |
| Memory expressions | telos/memory_expr.py |
Safe scalar update evaluator (max/min) |
| Runtime | telos/runtime.py |
TelosRuntime.tick — memory, router→hardware order, actuators |
| Actuators | telos/actuators/ |
DockerActuator, KubernetesActuator, FinTechActuator |
| Debugger | telos/debugger.py |
LatentDebugger — Monte Carlo parameters |
| Generator (optional) | telos/generator.py |
LLM → draft .telos |
| CLI | telos/cli.py |
telos run, validate, test, generate; install is stub |
Experimental — continuous mode (TIR)
| Module | Role |
|---|---|
telos/schema.py |
TIRSchema — string variable lists, SymPy-oriented (fractional variables) |
telos/tir_compiler.py |
SciPy SLSQP for TIRSchema |
telos/agent.py |
Natural language → TIR (not the primary .telos workflow) |
main.py |
Demos: intent → TIR → SciPy, or hand-authored finance TIR |
TIR does not provide mixed-integer guarantees. Prefer .telos + PuLP for production-style discrete decisions.
Project layout
telos-framework/
├── telos/
│ ├── __init__.py # exports; package story
│ ├── linear_milp.py # safe linear parser (objectives / invariants)
│ ├── memory_expr.py # safe scalar memory updates
│ ├── models.py # MILP TelosSchema
│ ├── compiler.py # PuLP
│ ├── parser.py # .telos YAML
│ ├── runtime.py # TelosRuntime
│ ├── debugger.py
│ ├── generator.py
│ ├── cli.py
│ ├── schema.py # experimental TIR models
│ ├── tir_compiler.py # experimental SciPy path
│ ├── agent.py # experimental NL → TIR
│ └── actuators/
├── main.py # TIR / SciPy demos (experimental)
├── headless.py # .telos + timeline (MILP)
├── server.py # optional canvas (FastAPI + WebSocket)
├── examples/ # MILP .telos + params/
├── docs/
│ ├── START_HERE.md
│ ├── SDK.md
│ └── ACTUATORS.md
└── pyproject.toml
| Doc | Audience |
|---|---|
| docs/START_HERE.md | Beginners |
| docs/SDK.md | Python API, security |
| docs/ACTUATORS.md | Actuator guide |
| examples/README.md | Learning progression + CLI |
Requirements
Python 3.10+ (3.13 works in development).
Install
Editable (registers telos CLI):
cd telos-framework
python -m pip install -e ".[all]" # + docker, k8s, server
# or minimal MILP SDK:
python -m pip install -e .
PyPI: pip install telos-os — extras [docker], [kubernetes], [server], [milp-highs] (HiGHS / highspy for native ARM64 solves), [all].
Legacy: python -m pip install -r requirements.txt
License: MIT (LICENSE).
First commands (MILP)
telos validate examples/router_minimal.telos
telos run examples/router_minimal.telos --actuator none --params examples/params/router_minimal.json
telos test vulnerable.telos --iters 500
MILP backend: telos validate and telos run accept --solver {auto,cbc,highs} (sets TELOS_PULP_SOLVER for that process). On Apple Silicon (arm64), the default auto uses HiGHS when highspy is installed (recommended: pip install "telos-os[milp-highs]"); otherwise install that extra or pass --solver cbc only if your Python runs under Rosetta (x86_64).
| Variable | Purpose |
|---|---|
TELOS_PULP_SOLVER |
auto (default), cbc, or highs — selects the PuLP MILP backend (see docs/SDK.md). |
Optional LLM draft (review output before running):
telos generate "Describe routing, costs, caps..." --out app.telos
Experimental stub (not a registry):
telos install vendor/my-actuator
Backends for generate / agent: OPENAI_API_KEY, or TELOS_LLM_BACKEND=ollama with ollama serve. See Environment variables below.
Optional canvas
python server.py
Open http://127.0.0.1:8000 (not file://). Port: TELOS_PORT. TELOS_RELOAD=1 for uvicorn reload (WebSockets can be flaky on Windows).
Headless MILP demo
python headless.py
Loads infrastructure.telos and a parameter timeline; uses DockerActuator when Docker is available.
Experimental TIR demos (main.py)
python main.py # intent → agent → TIR → SciPy (optional LLM)
python main.py finance # hand-authored TIR, no LLM
These illustrate the continuous track only.
SDK usage (MILP)
from pathlib import Path
from telos import TelosRuntime, TelosParser, DockerActuator
rt = TelosRuntime()
rt.attach_actuator(DockerActuator())
result = rt.tick(
{"router": router_dict, "hardware": hardware_dict},
{"cap_s1": 1.0, "cost_s1": 20.0},
)
schema = TelosParser.load(Path("infrastructure.telos"))
result = rt.tick({"main": schema}, {"us_cap": 1.0, "eu_cost": 20.0})
See docs/SDK.md for the full tick contract.
Configuring the agent (TIR / experimental)
TelosAgent backend order when auto: OpenAI if OPENAI_API_KEY, else Ollama if reachable, else mock.
| Variable | Purpose |
|---|---|
OPENAI_API_KEY |
OpenAI |
TELOS_LLM_BACKEND |
auto · openai · ollama · mock |
OLLAMA_HOST |
Ollama base URL |
TELOS_OLLAMA_MODEL |
Model name |
TELOS_GENERATOR_MODEL |
Chat model for TelosGenerator (default gpt-4o) |
TELOS_PORT |
Canvas port |
TELOS_RELOAD |
1 for uvicorn autoreload |
TIR JSON shape (reference only — experimental)
Expressions must be valid for SymPy (sympify). eq → == 0, ineq → ≥ 0.
{
"ontology": {
"variables": ["x", "y"],
"bounds": [[0.0, 1.0], [0.0, 1.0]]
},
"teleology": {
"direction": "minimize",
"objective": "x + 2*y"
},
"invariants": [
{ "type": "eq", "expression": "x + y - 1.0" },
{ "type": "ineq", "expression": "0.5 - x" }
]
}
Limitations
- MILP: PuLP with CBC (default on most platforms) or HiGHS (via
highspy, used automatically on Darwin arm64 when available); linear expression parser for manifest strings. - TIR: continuous
SLSQPonly; experimental / demo-oriented. - Executable “matrix” is a dict of numbers, not a binary tensor format.
Contributing
CONTRIBUTING.md — pytest, CI, PRs.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file telos_os-1.3.1.tar.gz.
File metadata
- Download URL: telos_os-1.3.1.tar.gz
- Upload date:
- Size: 49.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07b9050ca7f99b8a6b7be9f6fbb7a69f1bb66495fd1e0215b3dbe429cdd28731
|
|
| MD5 |
5fe4903c6b20394acbf25c82f42c6406
|
|
| BLAKE2b-256 |
3ed64e3703c759aea282fac5c8694689c954d1938a4a654c3bb7723bbffd38c6
|
Provenance
The following attestation bundles were made for telos_os-1.3.1.tar.gz:
Publisher:
publish.yml on MatthewEngman/telos-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telos_os-1.3.1.tar.gz -
Subject digest:
07b9050ca7f99b8a6b7be9f6fbb7a69f1bb66495fd1e0215b3dbe429cdd28731 - Sigstore transparency entry: 1220031971
- Sigstore integration time:
-
Permalink:
MatthewEngman/telos-framework@8a23bcfb1b0935c07a993f9167009574d8e81f5d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MatthewEngman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8a23bcfb1b0935c07a993f9167009574d8e81f5d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file telos_os-1.3.1-py3-none-any.whl.
File metadata
- Download URL: telos_os-1.3.1-py3-none-any.whl
- Upload date:
- Size: 34.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4ef670ae93aabf6fa28baa825c3c509d16081d4afc12ae6ad1e8c852832cf96
|
|
| MD5 |
13abe1f124b4e639c459afbc2fb26099
|
|
| BLAKE2b-256 |
e071166e0d428e26661422b275fd0d0fb0eaa9e05c14aa77521ee32c37d22074
|
Provenance
The following attestation bundles were made for telos_os-1.3.1-py3-none-any.whl:
Publisher:
publish.yml on MatthewEngman/telos-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telos_os-1.3.1-py3-none-any.whl -
Subject digest:
b4ef670ae93aabf6fa28baa825c3c509d16081d4afc12ae6ad1e8c852832cf96 - Sigstore transparency entry: 1220031972
- Sigstore integration time:
-
Permalink:
MatthewEngman/telos-framework@8a23bcfb1b0935c07a993f9167009574d8e81f5d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MatthewEngman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8a23bcfb1b0935c07a993f9167009574d8e81f5d -
Trigger Event:
workflow_dispatch
-
Statement type: