Skip to main content

Declarative MILP runtimes: .telos manifests, safe linear/memory expression parsers, PuLP/CBC, actuators

Project description

Telos Framework / Telos OS

CI

Telos OS is a Python framework for declarative optimization runtimes: .telos YAML manifests, MILP solving with PuLP/CBC, 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

  1. Author or generate a .telos file (YAML → TelosSchema).
  2. telos validate / telos run / telos test — or embed TelosParser + TelosRuntime in Python.
  3. Optionally attach actuators so numeric solutions drive Docker, Kubernetes, or custom side effects.

Expression handling: objectives and invariants use telos.linear_milpevery 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
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], [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

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: CBC via PuLP; linear expression parser for manifest strings.
  • TIR: continuous SLSQP only; 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

telos_os-1.2.0.tar.gz (44.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

telos_os-1.2.0-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file telos_os-1.2.0.tar.gz.

File metadata

  • Download URL: telos_os-1.2.0.tar.gz
  • Upload date:
  • Size: 44.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for telos_os-1.2.0.tar.gz
Algorithm Hash digest
SHA256 a3b4ba27659732cc9a5fc8ab90d8cc29da73677e9f2ee8ad78c163750fc121b1
MD5 8d1025f2a874e86e4458b91af29cb1eb
BLAKE2b-256 a9f8512ddfd3d3868ac27bf0419846a77213203150877ec87048bc95456bd367

See more details on using hashes here.

Provenance

The following attestation bundles were made for telos_os-1.2.0.tar.gz:

Publisher: publish.yml on MatthewEngman/telos-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file telos_os-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: telos_os-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for telos_os-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cd504fd7327f8b6b4565eccbefe94f4c5633205b4720eed19978626f3b74ac5
MD5 5f531ac0ba8154b18a8fd59f0961ff2e
BLAKE2b-256 8be01f900fc58ec973402fb4378db2c64d234e1a548bfa48e52da8c7cf1308dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for telos_os-1.2.0-py3-none-any.whl:

Publisher: publish.yml on MatthewEngman/telos-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page