Playbook
Pro Hebel: was, wann, wie, wie verifiziert.
Phase 3 — Gate
Hebel 2 — AWS Budget + (optional Action)
Wann: sofort bei jedem neuen Account mit Bedrock-Caller. Account-weit, einmalig.
Wie (Alarm-only, sicher):
aws budgets create-budget \
--account-id <account-id> \
--budget '{
"BudgetName": "bedrock-monthly",
"BudgetLimit": {"Amount": "80", "Unit": "USD"},
"TimeUnit": "MONTHLY",
"BudgetType": "COST",
"CostFilters": {"Service": ["Amazon Bedrock"]}
}' \
--notifications-with-subscribers '[{
"Notification": {"NotificationType":"ACTUAL","ComparisonOperator":"GREATER_THAN","Threshold":50,"ThresholdType":"PERCENTAGE","NotificationState":"ALARM"},
"Subscribers": [{"SubscriptionType":"EMAIL","Address":"hello@marvinkuehlmann.com"}]
}, {
"Notification": {"NotificationType":"ACTUAL","ComparisonOperator":"GREATER_THAN","Threshold":80,"ThresholdType":"PERCENTAGE","NotificationState":"ALARM"},
"Subscribers": [{"SubscriptionType":"EMAIL","Address":"hello@marvinkuehlmann.com"}]
}, {
"Notification": {"NotificationType":"FORECASTED","ComparisonOperator":"GREATER_THAN","Threshold":100,"ThresholdType":"PERCENTAGE","NotificationState":"ALARM"},
"Subscribers": [{"SubscriptionType":"EMAIL","Address":"hello@marvinkuehlmann.com"}]
}]' \
--profile <profile> --region us-east-1Wichtig: CostFilters.Service muss exakt “Amazon Bedrock” sein. ABER: Anthropic-Modelle erscheinen in Cost Explorer als eigene Services (“Claude Sonnet 4.6 (Amazon Bedrock Edition)” etc.) — die ohne Filter mitzaehlen. Pruefen: ggf mehrere Services in Service: Array oder Budget ohne Filter laufen lassen (alle av-production-Kosten).
Budget-Action mit IAM-Restrict (heikel): Template in templates/budget-action-iam-restrict.yaml. Nur deployen wenn Marvin explizit OK gibt. Risiko: bei Alarm-Trigger geht Bedrock fuer ALLE Caller offline.
Hebel 3 — max_tokens Hard-Cap + Stop-Sequences
Pro Caller-Typ:
- ECS-Service mit Open-WebUI: Env-Var
DEFAULT_MODEL_PARAMS={"max_tokens":2000, ...}in Task-Definition. - Lambda mit boto3 + Bedrock: im
converse()oderinvoke_model()CallinferenceConfig.maxTokenssetzen. - FastAPI/ECS mit eigenem Bedrock-Client (siehe a-icking
bedrock_claude.py): Konstruktor-Parametermax_tokensmit sicherem Default (z.B. 1024) + per-Request-Override moeglich.
Stop-Sequences wo strukturierte Outputs (JSON, Tool-Use): inferenceConfig.stopSequences=["}\n}"] oder analog. Halbiert oft Output-Tokens.
Hebel 10 — Service-Quotas drosseln
aws service-quotas list-service-quotas \
--service-code bedrock \
--profile <profile> --region eu-central-1 \
--query 'Quotas[?contains(QuotaName,`Sonnet`)]'Decrease via AWS Support-Ticket (nicht direkt API). Increase geht direkt. Bei Decrease: konservativen Wert kommunizieren der Normal-Last + 20% Puffer abdeckt.
Cross-Region-Inference-Profile zaehlen ueber alle Backing-Regionen. Sonnet 4.6 EU = eu-central-1 + eu-west-3 + eu-north-1. Quota in allen drei pruefen.
Phase 4 — Profile
Hebel 1 — Application Inference Profile (AIP) + Tags
Voraussetzung: Bedrock Model-Invocation-Logging aktivieren (rueckwirkend nicht moeglich, aber ab Aktivierungs-Zeitpunkt forensisch nachvollziehbar):
aws bedrock put-model-invocation-logging-configuration \
--logging-config '{
"cloudWatchConfig": {
"logGroupName": "/aws/bedrock/invocation-logs",
"roleArn": "arn:aws:iam::<acct>:role/BedrockLoggingRole"
},
"textDataDeliveryEnabled": true,
"imageDataDeliveryEnabled": false,
"embeddingDataDeliveryEnabled": false
}' \
--profile <profile> --region eu-central-1Achtung Privacy: textDataDeliveryEnabled: true logged Prompts + Responses. Bei sensiblen Daten (PII) nur false setzen oder gezielt selektive Caller loggen.
AIP anlegen:
aws bedrock create-inference-profile \
--inference-profile-name "open-webui-vf" \
--model-source '{
"copyFrom": "arn:aws:bedrock:eu-central-1:<acct>:inference-profile/eu.anthropic.claude-sonnet-4-6"
}' \
--tags '[
{"key":"Application","value":"open-webui-vf"},
{"key":"Environment","value":"production"},
{"key":"Owner","value":"marvin"}
]' \
--profile <profile> --region eu-central-1Diese Tags erscheinen in Cost Explorer wenn Cost Allocation Tags aktiviert sind:
aws ce update-cost-allocation-tags-status \
--cost-allocation-tags-status '[
{"TagKey":"Application","Status":"Active"},
{"TagKey":"Owner","Status":"Active"},
{"TagKey":"Environment","Status":"Active"}
]' \
--profile <profile> --region us-east-1Caller-Code-Switch: pro Caller die modelId-Referenz vom System-Inference-Profile-ARN auf die AIP-ARN umstellen. Verifizieren via CloudTrail-Management-Event CreateInferenceProfile + erste echte Invocation in CloudWatch.
Phase 5 — Optimize
Hebel 4 — Tool-Description-Cutdown
Anthropic-Pattern aus advanced-tool-use: 134k → wenige k Tokens. Bei Tool-heavy Agents bringt das 30-50% Input-Reduktion.
Skript: templates/tool-description-audit.py (Python, nutzt MCP-Server-Discovery-Endpoint).
Heuristik:
- Beschreibung > 200 Tokens pro Tool: rot
- Beispiele im JSON-Schema: raus (sind Tokens, Modell weiss das ohnehin)
descriptionan jedem Property: nur wo unklar- Tools die in CloudTrail/Logs <1x pro Woche aufgerufen werden:
disabled: truemarkieren oder rauswerfen
Vor/Nach-Token-Counts pro MCP dokumentieren in intern/capabilities/mcps/<slug>.md Sektion „Token-Footprint”.
Hebel 5 — System-Prompt + RAG-Tuning
Open-WebUI-spezifisch:
| Setting | Default | Empfehlung |
|---|---|---|
| RAG Top-K | 10 | 4 |
| RAG Chunk-Size | 1000 Tokens | 500 (300 bei Eval-OK) |
| Re-Ranking | ein | bleiben (Cohere v3.5 ist guenstig) |
| Chat-Verlauf Truncation | auto | max 20 Messages oder 10k Tokens |
ENABLE_SEARCH_QUERY_GENERATION | true | false wenn Web-Search wenig benutzt (Quick-Win!) |
BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL | (variabel) | false wenn aktiv (sonst gehen Web-Results roh in den Prompt) |
Eval-Set vor Aenderung: 10 typische Fragen + erwartete Antwort-Schluessel. Nach Aenderung gleicher Test, bei Quality-Drop zurueck.
Hebel 6 — Prompt-Caching 1h-TTL
Bedrock-Converse-API erwartet:
response = client.converse(
modelId="...",
system=[
{"text": "..."},
{"cachePoint": {"type": "default"}} # nach dem static-Teil
],
messages=[...],
inferenceConfig={...}
)1h-TTL ist seit Jan 2026 verfuegbar. Erfordert additionalModelRequestFields mit anthropic_beta: ["extended-cache-ttl-2025-04-11"] und cache_control.ttl: "1h" im Tool-Block.
LiteLLM-Spezifik (Open-WebUI VF):
litellm_settings:
cache_control_injection_points:
- location: message
role: system
# Achtung: location: message reicht NICHT alleine bei Bedrock-Converse-API.
# LiteLLM muss auch den cachePoint-Block in den system[] injizieren.
# Falls 0 Cache-Reads in CloudWatch: LiteLLM-Version pruefen, ggf via
# Custom-Header `anthropic-beta: prompt-caching-2024-07-31` (alt) bzw
# `anthropic-beta: extended-cache-ttl-2025-04-11` (neu) setzen.Hebel 7 — Embeddings: Titan v2 vs Cohere
| Modell | Preis (1M Tokens) | Dimension | Use-Case |
|---|---|---|---|
amazon.titan-embed-text-v2:0 | $0.02 | 1024/512/256 | DE-only Suche, billigste Variante |
cohere.embed-multilingual-v3 | $0.10 | 1024 | Cross-Lingual (DE-Query gegen EN-Doc) |
eu.cohere.embed-v4:0 | $0.12 | bis 1536 | Multimodal (Text+Bild) |
Migration = Re-Embedding-Lauf + Vector-DB-Schema-Anpassung. Roll-Back-Plan: alte + neue Embeddings parallel halten bis Eval-OK.
Hebel 8 — Modell-Routing
Open-WebUI TASK_MODEL-Fix (sofort umsetzbar):
LiteLLM-Config um Haiku-Block erweitern:
model_list:
- model_name: claude-haiku-4-5
litellm_params:
model: bedrock/eu.anthropic.claude-haiku-4-5-20251001-v1:0
aws_region_name: eu-central-1
model_info:
supports_prompt_caching: true
input_cost_per_token: 0.0000011
output_cost_per_token: 0.0000055Open-WebUI Env:
TASK_MODEL: claude-haiku-4-5TASK_MODEL_EXTERNAL: claude-haiku-4-5
Haiku NICHT in DEFAULT_MODELS aufnehmen (sonst sehen User es im Dropdown). Bleibt Background-only.
Confidence-basiertes Escalation (komplexer): Haiku ruft + structured-output mit confidence-Field; wenn confidence < threshold → Sonnet-Retry.
Hebel 9 — Batch-Inference
Geeignet wenn User-Wartezeit > 24h ok. Konkrete Kandidaten bei av-production:
agent-daily-briefing(1x/Tag) → klassischer Batch-Job-Kandidatagent-beleg-pipeline(lief in Spikes 12./13.05.) → wenn nicht zeitkritisch- Recherche-Reports in
intern/runs/ - Eval-/Benchmark-Lauefe in a-icking
Pattern:
aws bedrock create-model-invocation-job \
--job-name "daily-briefing-2026-05-18" \
--model-id "eu.anthropic.claude-haiku-4-5-20251001-v1:0" \
--input-data-config 's3InputDataConfig={s3Uri=s3://bucket/input.jsonl}' \
--output-data-config 's3OutputDataConfig={s3Uri=s3://bucket/output/}' \
--role-arn "arn:aws:iam::<acct>:role/BedrockBatchRole" \
--profile <profile> --region eu-central-1Lambda triggert Batch-Job, schreibt nach S3, Folge-Schritt liest Output.
Phase 6 — Compound
Siehe phase-6-compound fuer komplette Liste der Vault-Touchpoints.
Wesentliche Stellen:
intern/wissen/prozesse/mcp-best-practicesSektion „Token-Footprint + Cost-Hygiene”intern/capabilities/skills/mcp-eigenbau/SKILLPflicht-Audit vor Liveintern/capabilities/skills/routine-anlegen/SKILLPflicht-Parametermax_tokens+AIP-ARNintern/capabilities/mcps/_indexneue Spalte „Token-Cost-Tier” (A/B/C)