Safely introduce exactly one live LLM API call into a running simulation with hard limits, operator checkpoint, batch blocking, and fallback validation
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Instruções da origem · Visualização somente leitura
name
single-live-call-hardening
description
Safely introduce exactly one live LLM API call into a running simulation with hard limits, operator checkpoint, batch blocking, and fallback validation
source
auto-skill
extracted_at
2026-05-30T06:06:53.500Z
Single Live Call Hardening
When moving from dry-run/mock to a real live LLM API call inside a simulation, introduce exactly one live call with hard limits, manual operator approval, and batch blocking. Never switch multiple agents live at once.
Never log: full API key, auth header value, raw response body.
7. Live-run proof endpoint
@app.get("/api/live-proof")defget_live_proof():
live_calls = [c for c in call_log.calls if"live"in c.get("provider", "").lower()]
return {
"provider_summary": {
"mode": config.provider_mode,
"total_live_calls": len(live_calls),
"live_successes": len([c for c in live_calls if c["success"]]),
"live_failures": len([c for c in live_calls ifnot c["success"]]),
},
"event_provenance": event_log.summary(),
"quarantine_summary": {
"events": len(event_log.quarantined),
"provider_outputs": output_quarantine.count(),
},
"live_call_details": live_calls[-5:],
}
8. Tests
deftest_live_mode_builds_and_sends_request():
provider = NvidiaNimProvider(mode="nim-live-adam-single", api_key_env="TEST_KEY")
os.environ["TEST_KEY"] = "sk-test-key"with patch("urllib.request.urlopen") as mock_urlopen:
mock_urlopen.return_value = _mock_nim_response()
response = provider.generate("test", "Adam", 1)
assert mock_urlopen.called, "urlopen should be called"assert provider.live_call_count == 1del os.environ["TEST_KEY"]
deftest_batch_ticks_blocked_in_live_mode():
provider = NvidiaNimProvider(mode="nim-live-adam-single", ...)
# First call succeeds
provider.generate("test", "Adam", 1)
assert provider.live_call_count == 1# Second call blocked
response = provider.generate("test", "Adam", 2)
assert"limit"in json.loads(response)["thought"].lower()
assert provider.live_call_count == 1# Still 1deftest_eve_stays_mock_in_live_mode():
adam.set_provider(NvidiaNimProvider(mode="nim-live-adam-single", ...))
eve.set_provider(MockProvider(name="eve_mock"))
# Run tick — verify Adam live, Eve mockassertisinstance(eve.provider, MockProvider)
Key Rules
One agent live at a time — Adam first, then Eve, never both together initially
Hard limit of 1 call — _max_live_calls = 1, enforced in code
Batch ticks blocked — /api/run returns "blocked" in live-single mode
UI buttons disabled — batch tick buttons grayed out when _live_mode is true
Operator checkpoint printed — explicit confirmation before any live call
Same validation pipeline — live responses go through the same validator as mock
Fallback on failure — invalid live output triggers mock fallback, labeled SIMULATION_EVENT
No secrets in logs — key_present=true only, never the key value
Mock still works after live — 20-tick mock test passes after live test completes
Anti-Patterns
❌ Switching both agents live at once
❌ Allowing batch ticks in live-single mode
❌ Not enforcing the hard call limit in code
❌ Logging API keys or auth headers
❌ Skipping validation for live responses
✅ Print operator checkpoint before every live call
✅ Verify mock mode still works after live test
✅ Use /api/live-proof to audit live call history
✅ Proceed to Eve-only live only after Adam-only live passes