core: Registry, Skills, Router, Executor, Verifier, Runner mit Tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 00:36:21 +02:00
co-authored by Claude Opus 5.5
parent fef930d176
commit f79e2a8556
24 changed files with 2581 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
"""Token-Budget: Passt Prompt + Ausgabe in den effektiven Kontext eines Slots?"""
from __future__ import annotations
import math
from collections.abc import Callable
from dataclasses import dataclass
MESSAGE_OVERHEAD = 64
Tokenizer = Callable[[str], int]
def estimate_tokens(text: str) -> int:
"""Konservative Schätzung (eher zu hoch): ~3 Zeichen pro Token."""
return math.ceil(len(text) / 3)
@dataclass(frozen=True)
class Budget:
prompt_tokens: int
output_tokens: int
limit: int
@property
def required(self) -> int:
return self.prompt_tokens + self.output_tokens + MESSAGE_OVERHEAD
@property
def fits(self) -> bool:
return self.required <= self.limit
def compute(system: str, user: str, max_output_tokens: int, limit: int,
tokenizer: Tokenizer = estimate_tokens) -> Budget:
return Budget(tokenizer(system) + tokenizer(user), max_output_tokens, limit)