thinkless 0.4.1__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. thinkless-0.6.0/CHANGELOG.md +295 -0
  2. {thinkless-0.4.1 → thinkless-0.6.0}/PKG-INFO +125 -16
  3. {thinkless-0.4.1 → thinkless-0.6.0}/README.md +116 -9
  4. thinkless-0.6.0/benchmarks/habits/README.md +48 -0
  5. {thinkless-0.4.1 → thinkless-0.6.0}/pyproject.toml +14 -3
  6. thinkless-0.6.0/src/thinkless/_version.py +1 -0
  7. thinkless-0.6.0/src/thinkless/cli/habits.py +389 -0
  8. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/cli/main.py +2 -0
  9. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/engine.py +12 -4
  10. thinkless-0.6.0/src/thinkless/habits/__init__.py +58 -0
  11. thinkless-0.6.0/src/thinkless/habits/apis.py +528 -0
  12. thinkless-0.6.0/src/thinkless/habits/calls.py +269 -0
  13. thinkless-0.6.0/src/thinkless/habits/demo.py +232 -0
  14. thinkless-0.6.0/src/thinkless/habits/features.py +58 -0
  15. thinkless-0.6.0/src/thinkless/habits/gate.py +187 -0
  16. thinkless-0.6.0/src/thinkless/habits/learn.py +556 -0
  17. thinkless-0.6.0/src/thinkless/habits/proxy.py +131 -0
  18. thinkless-0.6.0/src/thinkless/habits/report.py +289 -0
  19. thinkless-0.6.0/src/thinkless/habits/runtime.py +549 -0
  20. thinkless-0.6.0/src/thinkless/habits/sites.py +454 -0
  21. thinkless-0.6.0/src/thinkless/habits/student.py +389 -0
  22. thinkless-0.6.0/src/thinkless/habits/transport.py +391 -0
  23. thinkless-0.6.0/src/thinkless/habits/wire.py +592 -0
  24. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/integrations/langgraph.py +20 -4
  25. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/limits.py +2 -2
  26. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/llm/factory.py +3 -1
  27. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/providers/llm.py +3 -0
  28. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/providers/systemone.py +5 -2
  29. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/providers/wire.py +53 -45
  30. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/server/app.py +7 -4
  31. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/shadow/report.py +3 -2
  32. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/shadow/runner.py +5 -2
  33. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/tracing/summary.py +4 -1
  34. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_cli_and_viewer.py +2 -0
  35. thinkless-0.6.0/tests/unit/test_core_review.py +166 -0
  36. thinkless-0.6.0/tests/unit/test_habits.py +1541 -0
  37. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_integrations.py +68 -0
  38. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_openrouter.py +2 -0
  39. thinkless-0.4.1/CHANGELOG.md +0 -148
  40. thinkless-0.4.1/src/thinkless/_version.py +0 -1
  41. {thinkless-0.4.1 → thinkless-0.6.0}/.gitignore +0 -0
  42. {thinkless-0.4.1 → thinkless-0.6.0}/LICENSE +0 -0
  43. {thinkless-0.4.1 → thinkless-0.6.0}/benchmarks/decisions/README.md +0 -0
  44. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/__init__.py +0 -0
  45. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/__main__.py +0 -0
  46. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/_hub.py +0 -0
  47. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/_json.py +0 -0
  48. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/__init__.py +0 -0
  49. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/decisions/__init__.py +0 -0
  50. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/decisions/leaderboard.py +0 -0
  51. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/decisions/run.py +0 -0
  52. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/decisions/score.py +0 -0
  53. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/decisions/tasks.json +0 -0
  54. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/decisions/tasks.py +0 -0
  55. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/decisions/verify.py +0 -0
  56. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/intents.py +0 -0
  57. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/intents_report.py +0 -0
  58. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/metrics.py +0 -0
  59. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/report.py +0 -0
  60. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/bench/support.py +0 -0
  61. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/cli/__init__.py +0 -0
  62. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/cli/decisions.py +0 -0
  63. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/cli/serve.py +0 -0
  64. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/cli/shadow.py +0 -0
  65. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/cli/traces.py +0 -0
  66. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/confidence.py +0 -0
  67. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/data/pricing.toml +0 -0
  68. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/data/viewer.html +0 -0
  69. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/decision.py +0 -0
  70. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/demo/__init__.py +0 -0
  71. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/demo/support/__init__.py +0 -0
  72. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/demo/support/agent.py +0 -0
  73. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/demo/support/data/calibration.jsonl +0 -0
  74. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/demo/support/data/scenarios.jsonl +0 -0
  75. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/demo/support/data/world.json +0 -0
  76. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/demo/support/questions.py +0 -0
  77. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/demo/support/stack.py +0 -0
  78. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/demo/support/world.py +0 -0
  79. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/errors.py +0 -0
  80. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/integrations/__init__.py +0 -0
  81. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/integrations/_messages.py +0 -0
  82. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/integrations/core.py +0 -0
  83. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/integrations/openai_agents.py +0 -0
  84. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/llm/__init__.py +0 -0
  85. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/llm/anthropic.py +0 -0
  86. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/llm/base.py +0 -0
  87. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/llm/local.py +0 -0
  88. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/llm/openai_compat.py +0 -0
  89. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/llm/openrouter.py +0 -0
  90. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/llm/scripted.py +0 -0
  91. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/logs.py +0 -0
  92. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/pricing.py +0 -0
  93. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/providers/__init__.py +0 -0
  94. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/providers/base.py +0 -0
  95. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/providers/gliner.py +0 -0
  96. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/providers/hf.py +0 -0
  97. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/providers/laya.py +0 -0
  98. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/providers/rules.py +0 -0
  99. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/py.typed +0 -0
  100. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/questions.py +0 -0
  101. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/server/__init__.py +0 -0
  102. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/server/mcp.py +0 -0
  103. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/settings.py +0 -0
  104. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/shadow/__init__.py +0 -0
  105. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/shadow/compare.py +0 -0
  106. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/tracing/__init__.py +0 -0
  107. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/tracing/console.py +0 -0
  108. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/tracing/export.py +0 -0
  109. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/tracing/otel.py +0 -0
  110. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/tracing/sinks.py +0 -0
  111. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/tracing/span.py +0 -0
  112. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/tracing/tracer.py +0 -0
  113. {thinkless-0.4.1 → thinkless-0.6.0}/src/thinkless/tracing/viewer.py +0 -0
  114. {thinkless-0.4.1 → thinkless-0.6.0}/tests/__init__.py +0 -0
  115. {thinkless-0.4.1 → thinkless-0.6.0}/tests/conftest.py +0 -0
  116. {thinkless-0.4.1 → thinkless-0.6.0}/tests/local/__init__.py +0 -0
  117. {thinkless-0.4.1 → thinkless-0.6.0}/tests/local/test_local_models.py +0 -0
  118. {thinkless-0.4.1 → thinkless-0.6.0}/tests/network/__init__.py +0 -0
  119. {thinkless-0.4.1 → thinkless-0.6.0}/tests/network/test_openrouter_live.py +0 -0
  120. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/__init__.py +0 -0
  121. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_bench.py +0 -0
  122. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_confidence.py +0 -0
  123. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_decision_benchmark.py +0 -0
  124. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_engine.py +0 -0
  125. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_hf_classifier.py +0 -0
  126. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_limits.py +0 -0
  127. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_llm_decider.py +0 -0
  128. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_pricing_and_llm.py +0 -0
  129. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_questions.py +0 -0
  130. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_rules.py +0 -0
  131. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_server.py +0 -0
  132. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_shadow.py +0 -0
  133. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_support_demo.py +0 -0
  134. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_systemone.py +0 -0
  135. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_systemone_sdk_compat.py +0 -0
  136. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_trace_export.py +0 -0
  137. {thinkless-0.4.1 → thinkless-0.6.0}/tests/unit/test_tracing.py +0 -0
@@ -0,0 +1,295 @@
1
+ # Changelog
2
+
3
+ All notable changes are recorded here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
5
+ [semantic versioning](https://semver.org/).
6
+
7
+ ## 0.6.0 - 2026-11-22
8
+
9
+ A review of the whole package. Habits gets fixes for streams cut short,
10
+ several processes sharing one directory, and the Responses API's stored
11
+ state; typed decisions get fixes for rules that never fired, spend caps,
12
+ cost reporting and the System One wire. A demo anyone can run right after
13
+ `pip install thinkless`, and CI that holds every lower bound to its promise.
14
+
15
+ ### Added
16
+
17
+ - `thinkless habits demo`: a support agent's routing decision goes from
18
+ recording to probation to being answered locally, offline, with a stand-in
19
+ LLM, in about a second. It needs nothing beyond `pip install thinkless`,
20
+ and the README now starts with it.
21
+ - A Responses API call that continues a locally answered response
22
+ (`previous_response_id` naming a `resp_thinkless_` id) is sent on with the
23
+ earlier input and answer written out, since the provider never stored the
24
+ local answer. The process keeps the last 2,048 local answers for this.
25
+ - A logo, an architecture diagram of Habits and typed decisions (in the
26
+ README, the docs home page and the four planes page), and a social preview
27
+ image. The docs site uses the logo and gives every page a link preview.
28
+
29
+ ### Fixed
30
+
31
+ - A rule registered for a question never fired when the question had no
32
+ `name` and was asked through `decide_many({"intent": Choice(...)})`: rules
33
+ and Hugging Face classifiers looked it up by a name derived from its
34
+ instructions, so it went on to the next provider, often the paid LLM. An
35
+ unnamed question now takes the name it is given in the mapping, which
36
+ thresholds and traces already used. A LangGraph `router` also finds a
37
+ decision a `decision_node` stored under that name instead of asking again.
38
+ - A nested `engine.run()` without `max_cost_usd` lifted the spend cap of the
39
+ run around it. Every open run's cap now applies. `run(max_cost_usd=-1)`
40
+ also left a trace sink behind.
41
+ - `/v1/decide` and `/v1/systemone` counted a batched call's cost and tokens
42
+ once per question it answered, and left out paid attempts that were not
43
+ accepted. Both now report the run's total.
44
+ - `/v1/systemone` sent uncertain answers from providers without
45
+ probabilities at probability 1, so a ThinkLess client accepted answers the
46
+ server was not sure of. They are left out, like abstentions.
47
+ - Shadow mode counted only the cost of the accepted attempt, which
48
+ overstated savings and let spending pass `max_cost_usd`.
49
+ - One malformed entry in a System One reply, a `NaN` score from an LLM, or a
50
+ negative `Retry-After` header failed the whole call; each now spoils only
51
+ its own answer, or falls back to the normal backoff.
52
+ - `thinkless shadow report --min-calls 0` divided by zero when nothing had
53
+ been compared.
54
+ - Habits recorded a streamed answer the caller stopped reading, or that
55
+ broke off, as the LLM's complete answer. Truncated answers became training
56
+ data and, in an audit, counted as disagreement. A Chat Completions stream
57
+ now counts only with a finish reason or `[DONE]`, and a Messages stream
58
+ only with `message_stop`.
59
+ - A site suspended by one process could be switched back on by a learning
60
+ run in another process that had read the plan before the suspension. The
61
+ run now keeps a suspension written while it was busy. A process also stops
62
+ holding a suspension once another process has retrained the site and the
63
+ new student passed its own checks.
64
+ - Two writers saving the plan at once could leave a half-written
65
+ `plan.json`. Each write now uses its own temporary file, and the replace
66
+ is retried while a reader on Windows holds the file.
67
+ - The gate could stop one step short of testing every held-out answer, so a
68
+ student good enough to answer all of them kept up to about 9% of them
69
+ going to the LLM.
70
+ - Responses API calls in a stored `conversation` were treated as
71
+ answerable, although part of their context is on the provider's side.
72
+ - A tool-calling answer with malformed arguments raised inside Habits and
73
+ the call was not recorded.
74
+ - A forked worker kept writing into its parent's call log; each process now
75
+ writes its own file, as documented.
76
+ - `habits status` and `scan` counted audit and shadow agreement with a
77
+ slightly different rule from the one that drives suspension; all three now
78
+ share one.
79
+ - `Habits(target=1.0)` and other impossible settings were accepted and
80
+ failed later in every learning run; they are now rejected up front.
81
+ - The CLI failed to start with typer 0.12, which the requirements allowed
82
+ (it cannot read `str | None` options on Python 3.10). ThinkLess now needs
83
+ typer 0.13, and a new CI job runs the tests with every direct dependency
84
+ at its lowest allowed version.
85
+ - Older pydantic versions warned on import about the `model_input_tokens`
86
+ field of `TraceSummary`.
87
+ - Tests that need an optional extra (the OpenAI SDK, OpenTelemetry) now skip
88
+ when it is missing instead of failing.
89
+ - A Habits background learning test depended on thread timing and failed on
90
+ Windows; a mypy error in `llm/factory.py` under older mypy versions.
91
+ - A Habits student test compared a tuple holding a dict with
92
+ `pytest.approx`, which pytest 9.2 rejects; CI failed on every new run.
93
+
94
+ ### Changed
95
+
96
+ - The `laya` extra needs Laya 0.4.17 or newer (below 0.5). Laya releases
97
+ after 0.4.22 need transformers 5, which GLiNER2 does not support yet, so a
98
+ shared environment resolves to Laya 0.4.22.
99
+ - Dependabot opens a pull request only when a release falls outside the
100
+ supported range, instead of raising lower bounds, and CI runs weekly.
101
+
102
+ ## 0.5.0 - 2026-10-17
103
+
104
+ Habits: the decisions an agent keeps making become local habits, once
105
+ proven, with one line under the LLM client it already uses.
106
+
107
+ ### Added
108
+
109
+ - `thinkless.habits`: `wrap(client)` puts ThinkLess under an OpenAI or
110
+ Anthropic SDK client, LangChain's `ChatOpenAI`, or any `httpx` or `httpx2`
111
+ client, in place. It records every Chat Completions, Responses and
112
+ Messages call, groups calls into sites by model, output contract and prompt
113
+ template, and trains a local student per decision site from the LLM's own
114
+ answers (a logistic regression over hashed words and character n-grams for
115
+ closed answers, a learned value shape for values copied from the input).
116
+ - The gate: a site is answered locally only at confidence levels where
117
+ cross-fitted students agreed with the LLM at the target rate as a one-sided
118
+ Clopper-Pearson lower bound, with thresholds tested in fixed sequence.
119
+ - Probation: passing the gate only starts a trial. The student answers new
120
+ calls in shadow while the LLM keeps answering them, and it answers nothing
121
+ until it passes one more test, of a size fixed in advance, on those new
122
+ calls (`confirm_calls`, 394 at the defaults; `0` skips probation).
123
+ - Audits and suspension: a random share of local answers still goes to the
124
+ LLM; a site whose audited agreement falls below the target goes back to the
125
+ LLM until calls made after the suspension clear the gate again.
126
+ - A student that passed the gate keeps serving until a newer one passes or
127
+ audits suspend the site, so a site does not switch off and on as its
128
+ confident calls stop reaching the LLM. Students are versioned files; old
129
+ ones are removed.
130
+ - Predictability: the plan records how often a student matches the LLM's
131
+ next answers on all held-out calls, and `learn` warns about sites where
132
+ the LLM answers similar inputs differently.
133
+ - Fails open: an error inside ThinkLess sends the call to the LLM unchanged.
134
+ - Modes `auto`, `shadow`, `record` and `off`; site names through the
135
+ `x-thinkless-site` header; learning in a background thread, at most once a
136
+ minute, one process at a time per directory, over the most recent calls.
137
+ Calls answered locally are logged as compact records, so the log grows
138
+ with LLM calls only.
139
+ - Local answers keep the exact response shape: JSON schema and JSON mode
140
+ answers, forced tool calls, plain text and streamed Chat Completions.
141
+ - `thinkless habits scan`, `learn`, `status`, `proxy` and `reset`. The
142
+ scan reads Habits logs, chat fine-tuning files and request and response
143
+ pairs, and reports each site's share of calls and cost and whether its
144
+ answers are decisions.
145
+ - `thinkless habits proxy`: an OpenAI-compatible endpoint with Habits
146
+ in front of any upstream, for clients in any language.
147
+ - Replays in `benchmarks/habits/` measure Habits against a real LLM's
148
+ recorded answers.
149
+ - `examples/10_habits.py` runs the whole loop offline.
150
+ - Integration tests and examples for gated CrewAI and LlamaIndex tools.
151
+
152
+ ### Changed
153
+
154
+ - NumPy is a dependency (for the students).
155
+
156
+ ## 0.4.1 - 2026-09-25
157
+
158
+ Project and packaging updates; no change to the library's behavior.
159
+
160
+ ### Changed
161
+
162
+ - Package metadata: development status Beta, more keywords, and links to
163
+ Discussions, the decision benchmark leaderboard, release notes and funding.
164
+ - The README links to good first issues and Discussions and shows the docs,
165
+ leaderboard and OpenSSF Scorecard badges.
166
+ - The submission guide says submitters regenerate the leaderboard page in
167
+ their pull request; the release guide explains that release tags are
168
+ permanent.
169
+
170
+ ### Security
171
+
172
+ - Every GitHub Action in the workflows is pinned to a commit.
173
+ - An OpenSSF Scorecard workflow checks the repository's supply chain weekly.
174
+
175
+ ## 0.4.0 - 2026-09-25
176
+
177
+ The decision benchmark.
178
+
179
+ ### Added
180
+
181
+ - The decision benchmark 1.0 (`thinkless bench decisions`): eight public
182
+ tasks across the four question kinds (banking77, clinc150 with out of
183
+ scope, MASSIVE in five languages, MultiWOZ 2.2 conversations, jailbreaks,
184
+ Civil Comments toxicity, HelpSteer2 helpfulness ratings and WNUT 2017
185
+ entities), with frozen rows and published hashes, calibration rows from a
186
+ separate split, result files that hold every prediction, `verify` that
187
+ recomputes every metric, a generated leaderboard and open submissions.
188
+ Baselines for GLiNER 2.5, Laya, Qwen3-1.7B and Qwen 3.7 Flash.
189
+
190
+ ### Changed
191
+
192
+ - A list of chat messages now renders as `role: text` lines for providers
193
+ that read text, instead of one `key: value` line per field.
194
+ - README links to the documentation point at the documentation site.
195
+
196
+ ## 0.3.0 - 2026-09-25
197
+
198
+ Shadow mode, framework adapters, limits, a decision server and MCP tools.
199
+
200
+ ### Added
201
+
202
+ - Shadow mode (`thinkless.shadow`): run a candidate engine next to existing
203
+ decision code without changing what it returns, log both answers, and
204
+ report agreement with a 95% interval, the share settled without an LLM,
205
+ cost and latency on both sides, thresholds fitted on production traffic,
206
+ and a verdict per question (`thinkless shadow report`). Disagreements
207
+ export as labeling rows (`thinkless shadow export`). The same class audits
208
+ a live engine against an LLM.
209
+ - Framework adapters (`thinkless.integrations`): a LangGraph router, decision
210
+ node and async decision node; OpenAI Agents SDK input guardrails, tool input
211
+ guardrails and `route_agent`; and framework-neutral `Router`, `route` and
212
+ `gate`, tested with LangChain tools and Pydantic AI. Extras `langgraph` and
213
+ `openai-agents`.
214
+ - Engine deadlines (`deadline_ms` on the engine and per call), spend limits
215
+ (`SpendLimit`, lifetime or rolling window) and per-run caps
216
+ (`engine.run(..., max_cost_usd=...)`). Skipped providers are recorded with
217
+ reason `deadline` or `spend_limit`.
218
+ - A decision server (`thinkless serve`, `thinkless.server.app.create_app`)
219
+ with `/v1/decide` and a System One compatible `/v1/systemone`, so another
220
+ engine's `SystemOne` provider, or TypeSafe's SDK, can use it. Extra
221
+ `server`.
222
+ - MCP tools (`thinkless mcp`, `thinkless.server.mcp.create_mcp_server`): one
223
+ `decide_<question>` tool per registered question. Extra `mcp`.
224
+ - `thinkless trace export` turns traced decisions into labeling rows, and
225
+ `thinkless trace drift` compares two periods and exits with 1 when a
226
+ question drifted.
227
+ - `question_from_spec` rebuilds a question from its spec.
228
+ - Docs: an integrations section, a migration guide, shadow mode, serving,
229
+ a pilot playbook and a FAQ, published to GitHub Pages by a new workflow.
230
+
231
+ ## 0.2.0 - 2026-09-25
232
+
233
+ First release on PyPI.
234
+
235
+ ### Added
236
+
237
+ - `OpenRouterLLM` and the `openrouter:<slug>` spec: one key for models from
238
+ Anthropic, OpenAI, Google, Qwen, DeepSeek and others.
239
+ - Billed cost: `Completion.cost_usd` and `ProviderResult.cost_usd` carry the
240
+ cost a backend reports (OpenRouter does); the engine prefers it over the
241
+ price table and records `cost_source` on spans. Benchmark reports add a
242
+ billed cost row, and the intent benchmark reports cost per 1k per provider
243
+ and per cascade threshold.
244
+ - `--reasoning` for every CLI command that builds an LLM, and
245
+ `from_spec(..., reasoning=...)`, mapped to OpenRouter's `reasoning`,
246
+ Anthropic's `effort` and local thinking switches.
247
+ - `HFClassifier`: any Hugging Face text-classification model as a provider for
248
+ the questions it was trained for.
249
+ - `load_env()`, and the CLI reads `./.env` without overriding set variables.
250
+ - Escalation context: when a question escalates to the LLM decider, the
251
+ engine includes the decisions already settled in the same batch. It removed
252
+ false injection flags on requests for a human that appeared when an LLM saw
253
+ the injection question alone. On by default (`Engine(escalation_context=...)`).
254
+ - The System One wire format is tested against TypeSafe's official SDK models.
255
+
256
+ ### Fixed
257
+
258
+ - `LLMDecider` detects replies cut off at the token limit, logs why, and
259
+ retries once with a larger budget instead of abstaining silently.
260
+ - The OpenAI-compatible client retries once without `response_format` when an
261
+ endpoint rejects JSON mode.
262
+ - A redaction test that failed about one run in fifty when a random span id
263
+ contained its marker.
264
+
265
+ ## 0.1.0 - 2026-09-25
266
+
267
+ First public release.
268
+
269
+ ### Added
270
+
271
+ - Typed questions: `Choice`, `Score`, `YesNo` and `Extract`, following the
272
+ System One wire format.
273
+ - `Engine` with a confidence cascade across providers, batched provider calls,
274
+ `accepted`, `uncertain` and `abstained` statuses, per-question and
275
+ per-provider thresholds (`"question@provider"`), question-level provider
276
+ allowlists, and async variants of every call.
277
+ - Normalized confidence, `(k * p_max - 1) / (k - 1)`, applied uniformly across
278
+ providers.
279
+ - Decision providers: `Rules`, `GLiNER` (GLiNER 2.5), `Laya`, `SystemOne`
280
+ (TypeSafe Jev and compatible servers such as Kev and OpenJev) and
281
+ `LLMDecider`.
282
+ - LLM backends: `TransformersLLM`, `OpenAICompatibleLLM` (OpenAI, Ollama, vLLM
283
+ and others) and `AnthropicLLM` with server-side refusal fallbacks.
284
+ - Tracing: spans for runs, steps, decisions, provider attempts, generations,
285
+ tools and rules; JSONL, memory, console and OpenTelemetry sinks; run
286
+ summaries with decisions by plane, escalations, tokens, cost and time by
287
+ plane; content capture switch; a self-contained HTML viewer.
288
+ - A price table with sources, overridable with `THINKLESS_PRICING`.
289
+ - The support demo: an agent, a mock store, 53 labeled tickets and a separate
290
+ 48-row calibration set.
291
+ - Benchmarks: the support benchmark across `llm`, `hybrid` and `models` modes,
292
+ and intent benchmarks on Banking77, CLINC150 and Emotion with a simulated
293
+ cascade.
294
+ - `thinkless` CLI: `doctor`, `demo`, `bench support`, `bench intents`,
295
+ `calibrate`, `trace ls`, `trace show` and `trace view`.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: thinkless
3
- Version: 0.4.1
4
- Summary: The decision plane for AI agents. Rules and small calibrated models make the routine decisions, the LLM is reserved for the steps that need thought, and every step is traced.
3
+ Version: 0.6.0
4
+ Summary: Stop using an LLM for every decision. Rules and small local models answer an AI agent's routine decisions, including ones learned from its own LLM once proven; the LLM keeps the steps that need it, and every step is traced.
5
5
  Project-URL: Homepage, https://github.com/inboxpraveen/ThinkLess
6
6
  Project-URL: Documentation, https://inboxpraveen.github.io/ThinkLess/
7
7
  Project-URL: Repository, https://github.com/inboxpraveen/ThinkLess
@@ -14,7 +14,7 @@ Project-URL: Funding, https://github.com/sponsors/inboxpraveen
14
14
  Author: Praveen Kumar
15
15
  License-Expression: Apache-2.0
16
16
  License-File: LICENSE
17
- Keywords: agents,ai-agents,benchmark,calibration,classification,decision-models,gliner,guardrails,jev,langgraph,laya,llm,llm-routing,mcp,observability,openai-agents,system-one,tracing
17
+ Keywords: agents,ai-agents,anthropic,benchmark,calibration,classification,cost-optimization,decision-models,gliner,guardrails,jev,knowledge-distillation,langchain,langgraph,laya,llm,llm-cost,llm-routing,mcp,observability,openai,openai-agents,system-one,tracing
18
18
  Classifier: Development Status :: 4 - Beta
19
19
  Classifier: Framework :: Pydantic :: 2
20
20
  Classifier: Intended Audience :: Developers
@@ -32,10 +32,11 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
32
32
  Classifier: Typing :: Typed
33
33
  Requires-Python: >=3.10
34
34
  Requires-Dist: httpx<1,>=0.27
35
+ Requires-Dist: numpy>=1.24
35
36
  Requires-Dist: pydantic<3,>=2.6
36
37
  Requires-Dist: rich>=13.7
37
38
  Requires-Dist: tomli>=2.0; python_version < '3.11'
38
- Requires-Dist: typer>=0.12
39
+ Requires-Dist: typer>=0.13
39
40
  Provides-Extra: all
40
41
  Requires-Dist: accelerate>=1.0; extra == 'all'
41
42
  Requires-Dist: anthropic>=1.0; extra == 'all'
@@ -43,7 +44,7 @@ Requires-Dist: datasets>=3.0; extra == 'all'
43
44
  Requires-Dist: fastapi>=0.115; extra == 'all'
44
45
  Requires-Dist: gliner2[local]<3,>=2.0; extra == 'all'
45
46
  Requires-Dist: langgraph>=1.0; extra == 'all'
46
- Requires-Dist: laya<0.4,>=0.3.20; extra == 'all'
47
+ Requires-Dist: laya<0.5,>=0.4.17; extra == 'all'
47
48
  Requires-Dist: mcp>=1.10; extra == 'all'
48
49
  Requires-Dist: openai-agents>=0.22; extra == 'all'
49
50
  Requires-Dist: openai>=2.0; extra == 'all'
@@ -61,6 +62,7 @@ Provides-Extra: bench
61
62
  Requires-Dist: datasets>=3.0; extra == 'bench'
62
63
  Provides-Extra: dev
63
64
  Requires-Dist: fastapi>=0.115; extra == 'dev'
65
+ Requires-Dist: langchain-openai>=0.3; extra == 'dev'
64
66
  Requires-Dist: langgraph>=1.0; extra == 'dev'
65
67
  Requires-Dist: mcp>=1.10; extra == 'dev'
66
68
  Requires-Dist: mkdocs-material>=9.5; extra == 'dev'
@@ -80,12 +82,12 @@ Requires-Dist: transformers<5,>=4.48; extra == 'gliner'
80
82
  Provides-Extra: langgraph
81
83
  Requires-Dist: langgraph>=1.0; extra == 'langgraph'
82
84
  Provides-Extra: laya
83
- Requires-Dist: laya<0.4,>=0.3.20; extra == 'laya'
85
+ Requires-Dist: laya<0.5,>=0.4.17; extra == 'laya'
84
86
  Requires-Dist: transformers<5,>=4.48; extra == 'laya'
85
87
  Provides-Extra: local
86
88
  Requires-Dist: accelerate>=1.0; extra == 'local'
87
89
  Requires-Dist: gliner2[local]<3,>=2.0; extra == 'local'
88
- Requires-Dist: laya<0.4,>=0.3.20; extra == 'local'
90
+ Requires-Dist: laya<0.5,>=0.4.17; extra == 'local'
89
91
  Requires-Dist: protobuf>=4.25; extra == 'local'
90
92
  Requires-Dist: sentencepiece>=0.2; extra == 'local'
91
93
  Requires-Dist: torch>=2.1; extra == 'local'
@@ -109,6 +111,10 @@ Requires-Dist: fastapi>=0.115; extra == 'server'
109
111
  Requires-Dist: uvicorn>=0.30; extra == 'server'
110
112
  Description-Content-Type: text/markdown
111
113
 
114
+ <p align="center">
115
+ <img src="https://raw.githubusercontent.com/inboxpraveen/ThinkLess/main/docs/assets/logo.svg" alt="ThinkLess logo" width="96" height="96">
116
+ </p>
117
+
112
118
  <h1 align="center">ThinkLess</h1>
113
119
 
114
120
  <p align="center"><b>Stop using an LLM for every decision.</b></p>
@@ -124,6 +130,8 @@ Description-Content-Type: text/markdown
124
130
  <a href="https://github.com/inboxpraveen/ThinkLess/blob/main/LICENSE"><img alt="License: Apache 2.0" src="https://img.shields.io/badge/license-Apache%202.0-blue.svg"></a>
125
131
  </p>
126
132
 
133
+ <!-- mcp-name: io.github.inboxpraveen/thinkless -->
134
+
127
135
  ThinkLess is an open-source decision plane for AI agents. The routine
128
136
  judgments an agent makes (what the user wants, whether they asked for a
129
137
  person, which order they mean, whether a message is trying to manipulate the
@@ -132,7 +140,99 @@ LLM is kept for the steps that need it: writing, planning, and the decisions
132
140
  the small models are not sure about. Every step is traced with the plane that
133
141
  handled it, its confidence, latency, tokens and cost.
134
142
 
135
- It is model-neutral. Rules, [GLiNER 2.5](https://github.com/fastino-ai/GLiNER2),
143
+ There are two ways in. With **Habits**, ThinkLess goes under the LLM client
144
+ you already use, with one line, and the decisions your agent keeps making
145
+ become local habits once they are proven. With **typed decisions**, you
146
+ declare the questions and choose the models that answer them.
147
+
148
+ See it work first. This runs in about a second, offline, with no API key,
149
+ GPU or model download:
150
+
151
+ ```bash
152
+ pip install thinkless
153
+ thinkless habits demo
154
+ ```
155
+
156
+ The output, shortened (timings depend on the machine):
157
+
158
+ ```text
159
+ 1. Recording. 300 messages went to the LLM and were recorded.
160
+ 2. Probation. 450 more messages, 450 sent to the LLM: the student answered each in shadow only.
161
+ 3. Live. 300 messages: 281 answered locally (median 0.4 ms for the whole HTTP call);
162
+ the other 19 went to the LLM as random audits, so agreement keeps being measured.
163
+ Local answers that match what the LLM would have said: 281 of 281.
164
+ ```
165
+
166
+ The demo's LLM is a stand-in that always answers the same way, so agreement
167
+ is perfect. On real traffic it is lower, and the
168
+ [measured results](https://inboxpraveen.github.io/ThinkLess/habits/#results)
169
+ say by how much.
170
+
171
+ <p align="center">
172
+ <img src="https://raw.githubusercontent.com/inboxpraveen/ThinkLess/main/docs/assets/architecture.svg" alt="How ThinkLess works. Habits: habits.wrap(client) answers a call locally in about 4 ms when its call site is a proven habit, and otherwise sends it to your LLM unchanged and records it; in the background ThinkLess finds decision sites, trains a student per site on the LLM's answers, and makes it a habit only after 97% agreement on past calls and again on new calls, with 5% audits after. Typed decisions: a question goes through rules, GLiNER 2.5, Laya, System One models and an LLM decider, cheapest first, and comes back as a typed decision. Everything is traced to JSONL, OpenTelemetry and an HTML viewer." width="100%">
173
+ </p>
174
+
175
+ ## Habits: one line under the agent you already have
176
+
177
+ ```python
178
+ from openai import OpenAI
179
+ from thinkless import habits
180
+
181
+ client = habits.wrap(OpenAI()) # the only change
182
+ ```
183
+
184
+ ThinkLess sits in the HTTP client under your agent. It records each LLM call,
185
+ finds the call sites whose answers are decisions (a route, a yes or no, a
186
+ label, a value copied from the input), and trains a small local model for
187
+ each from your LLM's own answers. A site is answered locally only after that
188
+ model has matched your LLM at least 97% of the time (as a 95% lower
189
+ confidence bound) twice: on past calls it was not trained on, and then on a
190
+ probation of new calls it answers in shadow while the LLM still answers them.
191
+ A site that passes both becomes a habit. A random 5% of local answers keeps
192
+ being checked against the LLM, and a habit that stops agreeing goes back to
193
+ the LLM by itself. Responses keep the exact
194
+ shape the LLM returns, so Pydantic parsing, `with_structured_output` and the
195
+ OpenAI Agents SDK see nothing different.
196
+
197
+ - **Works under** the OpenAI SDK (Chat Completions and Responses), the
198
+ Anthropic SDK, LangChain and LangGraph, the OpenAI Agents SDK, and any
199
+ OpenAI-compatible provider. `thinkless habits proxy` does the same for
200
+ clients in any language.
201
+ - **Costs nothing extra.** No API, no model download, no GPU: the students
202
+ are linear models over hashed text features, trained on a CPU in the
203
+ background. A local answer takes about half a millisecond inside
204
+ ThinkLess, and about 4 ms for the whole SDK call.
205
+ - **Fails open.** Tool calls in agent loops, images, and anything ThinkLess
206
+ has not proven go to the LLM unchanged, and so does every call if
207
+ ThinkLess itself hits an error.
208
+ - **Statistically gated on agreement, with continuous audits.** The bound is
209
+ on agreement with your LLM, not on correctness: when your LLM is wrong, a
210
+ habit that agrees with it is wrong too. Prior work and how this differs
211
+ (Cache & Distil, Jevstiller) are on the
212
+ [docs page](https://inboxpraveen.github.io/ThinkLess/habits/#compared-with-a-cache-and-prior-work).
213
+
214
+ **Measured on a replay of real queries.** On 13,083 real banking queries
215
+ routed by Qwen 3.7 Flash across 77 intents, ThinkLess answered 26% of the
216
+ calls locally (44% of the last 500), its answers matched Qwen's 98.3% of the
217
+ time, accuracy against the true labels did not move (73.2%), and the billed
218
+ LLM cost fell 26%. On a toxicity check where Qwen's own answers were no more
219
+ predictable than always saying no, it answered nothing and said why.
220
+ [Results and method](https://inboxpraveen.github.io/ThinkLess/habits/#results)
221
+
222
+ Scan the logs you already have before switching anything on; it shows which
223
+ calls are decisions and what they cost:
224
+
225
+ ```bash
226
+ thinkless habits scan logs/ # JSONL exports; nothing is sent anywhere
227
+ ```
228
+
229
+ [Habits documentation](https://inboxpraveen.github.io/ThinkLess/habits/)
230
+
231
+ ## Typed decisions
232
+
233
+ When you want to design a decision yourself, ThinkLess answers typed
234
+ questions with a cascade of providers. It is model-neutral. Rules,
235
+ [GLiNER 2.5](https://github.com/fastino-ai/GLiNER2),
136
236
  [Laya](https://github.com/NandhaKishorM/laya), TypeSafe's
137
237
  [Jev](https://typesafe.ai) (and any server speaking its System One API, such as
138
238
  Kev and OpenJev), any Hugging Face classifier, and any LLM (local through
@@ -200,10 +300,15 @@ billed ([full results](https://inboxpraveen.github.io/ThinkLess/benchmarks/)):
200
300
  ## Quick start
201
301
 
202
302
  ```bash
203
- pip install "thinkless[local]" # GLiNER, Laya and a local LLM
303
+ pip install thinkless # rules, Habits, tracing; no model downloads
304
+ pip install "thinkless[local]" # adds GLiNER, Laya and a local LLM (PyTorch)
204
305
  thinkless doctor # check the environment
205
306
  ```
206
307
 
308
+ The example below uses the local models. Without them, start from
309
+ [`examples/01_rules_only.py`](https://github.com/inboxpraveen/ThinkLess/blob/main/examples/01_rules_only.py),
310
+ which shows the same API, cascade and traces with rules alone.
311
+
207
312
  ```python
208
313
  from thinkless import Choice, Engine, Extract, JSONLSink, Tracer, YesNo
209
314
  from thinkless.llm import TransformersLLM
@@ -253,12 +358,13 @@ Then open the trace:
253
358
  thinkless trace view
254
359
  ```
255
360
 
256
- No GPU? `pip install thinkless` and run
257
- [`examples/01_rules_only.py`](https://github.com/inboxpraveen/ThinkLess/blob/main/examples/01_rules_only.py): the API, the cascade
258
- and the traces with no model downloads.
361
+ No GPU? The local models also run on a CPU, more slowly (see the provider
362
+ table below), and a hosted LLM through OpenRouter works as the fallback.
259
363
 
260
364
  ## Use it in your agent
261
365
 
366
+ The quickest way in is [Habits](https://inboxpraveen.github.io/ThinkLess/habits/),
367
+ which needs no change to the agent at all. To design decisions yourself,
262
368
  ThinkLess sits inside the framework you already use, at the points where the
263
369
  agent decides something: which path to take, whether an input is safe,
264
370
  whether a tool call is inside policy. Uncertain decisions go to the code you
@@ -277,7 +383,8 @@ builder.add_conditional_edges(START, intent, intent.destinations)
277
383
  - [OpenAI Agents SDK](https://inboxpraveen.github.io/ThinkLess/integrations/openai-agents/):
278
384
  input guardrails, tool guardrails and routing to a specialist agent.
279
385
  - [Any framework](https://inboxpraveen.github.io/ThinkLess/integrations/any-framework/):
280
- `route` and `gate` for Pydantic AI, a hand-written loop, or anything else.
386
+ `route` and `gate` for CrewAI, LlamaIndex, Pydantic AI, a hand-written
387
+ loop, or anything else.
281
388
 
282
389
  Before switching anything, measure it. Shadow mode runs ThinkLess next to your
283
390
  current code on live traffic and reports, per decision, the agreement with a
@@ -373,7 +480,8 @@ Writing your own provider is one class. [Providers](https://inboxpraveen.github.
373
480
  ## Documentation
374
481
 
375
482
  - [Getting started](https://inboxpraveen.github.io/ThinkLess/getting-started/),
376
- [installation](https://inboxpraveen.github.io/ThinkLess/guides/installation/)
483
+ [installation](https://inboxpraveen.github.io/ThinkLess/guides/installation/),
484
+ [Habits](https://inboxpraveen.github.io/ThinkLess/habits/)
377
485
  - Use it in your agent: [overview](https://inboxpraveen.github.io/ThinkLess/integrations/),
378
486
  [LangGraph](https://inboxpraveen.github.io/ThinkLess/integrations/langgraph/),
379
487
  [OpenAI Agents SDK](https://inboxpraveen.github.io/ThinkLess/integrations/openai-agents/),
@@ -403,8 +511,9 @@ ThinkLess is pre-1.0: the core API (questions, the engine, decisions and
403
511
  traces) is meant to stay stable, and providers, adapters and benchmarks will
404
512
  grow. The [decision benchmark](https://inboxpraveen.github.io/ThinkLess/decision-benchmark/)
405
513
  compares decision models on eight public tasks and is open to submissions.
406
- Next up are more models on it, cross-request batching in the server, and
407
- calibrated LLM confidence from log probabilities. See the [roadmap](https://inboxpraveen.github.io/ThinkLess/roadmap/).
514
+ Next up are pretrained students (GLiNER, Laya, Jev) for Habits so sites
515
+ can be answered from day one, more models on the benchmark, and cross-request
516
+ batching in the server. See the [roadmap](https://inboxpraveen.github.io/ThinkLess/roadmap/).
408
517
 
409
518
  ## Contributing
410
519