@pentatonic-ai/ai-agent-sdk 0.10.32 → 0.10.33

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.
package/dist/index.cjs CHANGED
@@ -878,7 +878,7 @@ function fireAndForgetEmit(clientConfig, sessionOpts, messages, result, model) {
878
878
  }
879
879
 
880
880
  // src/telemetry.js
881
- var VERSION = "0.10.32";
881
+ var VERSION = "0.10.33";
882
882
  var TELEMETRY_URL = "https://sdk-telemetry.philip-134.workers.dev";
883
883
  function machineId() {
884
884
  const raw = typeof process !== "undefined" ? `${process.env?.USER || process.env?.USERNAME || "u"}:${process.platform || "x"}:${process.arch || "x"}` : "browser";
package/dist/index.js CHANGED
@@ -847,7 +847,7 @@ function fireAndForgetEmit(clientConfig, sessionOpts, messages, result, model) {
847
847
  }
848
848
 
849
849
  // src/telemetry.js
850
- var VERSION = "0.10.32";
850
+ var VERSION = "0.10.33";
851
851
  var TELEMETRY_URL = "https://sdk-telemetry.philip-134.workers.dev";
852
852
  function machineId() {
853
853
  const raw = typeof process !== "undefined" ? `${process.env?.USER || process.env?.USERNAME || "u"}:${process.platform || "x"}:${process.arch || "x"}` : "browser";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pentatonic-ai/ai-agent-sdk",
3
- "version": "0.10.32",
3
+ "version": "0.10.33",
4
4
  "description": "TES SDK — LLM observability and lifecycle tracking via Pentatonic Thing Event System. Track token usage, tool calls, and conversations. Manage things through event-sourced lifecycle stages with AI enrichment and vector search.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -193,13 +193,24 @@ _PROV_REL = _cap_prov("relationships.provenance_event_ids", "EXCLUDED.provenance
193
193
  # lever, this is the monitoring + active-learning sample (drift detection and
194
194
  # fresh teacher-gold on live traffic). Default conservative-ish 5%.
195
195
  STUDENT_SAMPLE_RATE = float(os.environ.get("STUDENT_SAMPLE_RATE", "0.05"))
196
- # Fact categories that always go to the teacher regardless of the student's
197
- # output (high-value, cheap to over-escalate). Comma-separated, lowercased.
196
+ # Fact categories that go to the teacher regardless of the student's output
197
+ # (high-value, cheap to over-escalate). Comma-separated, lowercased.
198
198
  HIGH_VALUE_CATEGORIES = {
199
199
  c.strip().lower()
200
200
  for c in os.environ.get("HIGH_VALUE_CATEGORIES", "decision,commitment").split(",")
201
201
  if c.strip()
202
202
  }
203
+ # Fraction of high-value-class events that ESCALATE to the teacher. 1.0 (default)
204
+ # = the original always-teacher gate. The gate was set at cascade launch when the
205
+ # student was unproven; since then the clean student has zero quality-fail
206
+ # escalations in prod and shadow-eval parity with the teacher — while the HV gate
207
+ # routed ~57% of a decision/commitment-heavy backlog to the teacher (90% of all
208
+ # escalations, 2026-07-09), pinning drain to teacher capacity with the student
209
+ # idle. Lowering this (e.g. 0.25) makes HV student-primary with an elevated
210
+ # teacher sample as the safety net/monitoring corpus on exactly the high-value
211
+ # class. Instant rollback: set back to 1.0. Escalated-anyway HV events keep the
212
+ # 'high_value_class' ledger reason, so the mix stays queryable.
213
+ HIGH_VALUE_SAMPLE_RATE = float(os.environ.get("HIGH_VALUE_SAMPLE_RATE", "1.0"))
203
214
 
204
215
 
205
216
  # KV-text output format constants. We dropped JSON output (and the
@@ -1078,10 +1089,14 @@ def escalation_decision(
1078
1089
  for em in {e.lower() for e in _EMAIL_RE.findall(blob)}:
1079
1090
  if em not in known:
1080
1091
  return True, "grounding_violation"
1081
- # 2. High-value fact class — always teacher.
1092
+ # 2. High-value fact class — teacher at HIGH_VALUE_SAMPLE_RATE (1.0 = the
1093
+ # original always-teacher gate; lower = student-primary with an elevated
1094
+ # teacher sample on exactly this class — see the config note).
1082
1095
  for f in student_result.get("facts", []):
1083
1096
  if (f.get("category") or "").lower() in HIGH_VALUE_CATEGORIES:
1084
- return True, "high_value_class"
1097
+ if HIGH_VALUE_SAMPLE_RATE >= 1.0 or random.random() < HIGH_VALUE_SAMPLE_RATE:
1098
+ return True, "high_value_class"
1099
+ break # HV but sampled-out → student writes; still eligible for gate 3
1085
1100
  # 3. Random monitoring/active-learning sample (not a quality lever).
1086
1101
  if STUDENT_SAMPLE_RATE > 0 and random.random() < STUDENT_SAMPLE_RATE:
1087
1102
  return True, "random_sample"
@@ -2964,7 +2979,8 @@ async def amain():
2964
2979
  f"cascade ENABLED — student-primary "
2965
2980
  f"(model={STUDENT_MODEL}, endpoint={STUDENT_ENDPOINT or '(unset!)'}, "
2966
2981
  f"sample_rate={STUDENT_SAMPLE_RATE}, "
2967
- f"high_value={sorted(HIGH_VALUE_CATEGORIES)})"
2982
+ f"high_value={sorted(HIGH_VALUE_CATEGORIES)}, "
2983
+ f"hv_sample_rate={HIGH_VALUE_SAMPLE_RATE})"
2968
2984
  )
2969
2985
  if not STUDENT_ENDPOINT:
2970
2986
  log.warning(