Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Prism/Views/PrismAgentsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ struct PrismAgentsView: View {
let name: String
switch model {
case "gpt-6-luna": name = "GPT-6 Luna"
case "gpt-6.1-sol": name = "GPT-6.1 Sol"
case "gpt-6-astra": name = "GPT-6 Astra"
default: name = model
}
Expand Down
8 changes: 4 additions & 4 deletions Tests/RuntimeContractCheck.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ struct RuntimeContractCheck {
"Every cascade agent must have a stable, unique UI identity.")
try require(state.agents.filter { $0.model == "gpt-6-luna" }.count == 24,
"The default breadth layer must expose 24 Luna collectors.")
try require(state.agents.filter { $0.model == "gpt-6.1-sol" }.count == 6,
"The default analysis layer must expose six Sol analysts.")
try require(state.agents.filter { $0.model == "gpt-6-astra" }.count == 3,
"The strategy and execution layers must expose three Astra agents.")
try require(state.agents.filter { $0.model == "gpt-6.1-sol" }.count == 9,
"The analysis, strategy, and execution layers must expose nine Sol agents.")
try require(state.agents.allSatisfy { $0.model != "gpt-6-astra" },
"The active roster must no longer route work to Astra.")
try require(state.agents.allSatisfy { !($0.instructions ?? "").isEmpty },
"Each agent must expose its new layer instructions in the existing disclosure.")
try require(state.agents.allSatisfy { $0.capabilities != nil && $0.recentTools != nil },
Expand Down
4 changes: 2 additions & 2 deletions backend/agent_roles/executor.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# GPT-6 Astra operational execution
# GPT-6.1 Sol operational execution

## Role and limits

Act on an exact frozen strategy version through the supplied Responses tools. Use `gpt-6-astra`. You may hold, request a permitted order, amend or cancel a known order, or reduce exposure. Credentials, eligibility, sizing constraints, reconciliation, accounting and protective actions belong to the host. A model opinion that a strategy is promising is never permission to trade.
Act on an exact frozen strategy version through the supplied Responses tools. Use `gpt-6.1-sol`. You may hold, request a permitted order, amend or cancel a known order, or reduce exposure. Credentials, eligibility, sizing constraints, reconciliation, accounting and protective actions belong to the host. A model opinion that a strategy is promising is never permission to trade.

Read the task's strategy dossier, triggering event, measured market snapshot, current account, host eligibility and limits, and previous execution decisions with their outcomes. The dossier contains frozen identity, parameters, policy, evidence, lineage, results, prior conclusions, unresolved questions and changes. Truncation is explicit. Request current state with the narrow inspection tools when needed. Quotes, OHLCV, indicators and balances are measurements; your interpretation is not a measurement.

Expand Down
4 changes: 2 additions & 2 deletions backend/prism_runtime/agent_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'scheduler': {'model': 'gpt-6-luna', 'reasoning_effort': 'low', 'daily_calls': 96, 'daily_usd': 15., 'concurrency': 1, 'max_output_tokens': 4096},
'discovery': {'model': 'gpt-6.1-sol', 'reasoning_effort': 'medium', 'daily_calls': 96, 'daily_usd': 100., 'concurrency': 4, 'max_output_tokens': 8192},
'review': {'model': 'gpt-6.1-sol', 'reasoning_effort': 'medium', 'daily_calls': 32, 'daily_usd': 40., 'concurrency': 1, 'max_output_tokens': 8192},
'execution': {'model': 'gpt-6-astra', 'reasoning_effort': 'high', 'daily_calls': 240, 'daily_usd': 150., 'concurrency': 1, 'max_output_tokens': 4096},
'execution': {'model': 'gpt-6.1-sol', 'reasoning_effort': 'high', 'daily_calls': 240, 'daily_usd': 150., 'concurrency': 1, 'max_output_tokens': 4096},
}


Expand Down Expand Up @@ -143,7 +143,7 @@ def _response(self, component, task_id, round_index, body, *, experiment_id=None

def _base(self, component, payload, role):
limits = self.budget.limits(component)
return {'model': 'gpt-6-astra' if component == 'execution' else limits['model'],
return {'model': DEFAULT_RESOURCES['execution']['model'] if component == 'execution' else limits['model'],
'reasoning': {'effort': limits['reasoning_effort']}, 'store': False,
'include': ['reasoning.encrypted_content'], 'max_output_tokens': limits['max_output_tokens'],
'input': [{'role': 'developer', 'content': self._instructions(role)},
Expand Down
4 changes: 2 additions & 2 deletions backend/prism_runtime/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
'layers': {
'collector': {'count': 24, 'model': 'gpt-6-luna', 'reasoning_effort': 'low'},
'analyst': {'count': 6, 'model': 'gpt-6.1-sol', 'reasoning_effort': 'medium'},
'strategist': {'count': 2, 'model': 'gpt-6-astra', 'reasoning_effort': 'high'},
'executor': {'count': 1, 'model': 'gpt-6-astra', 'reasoning_effort': 'max'},
'strategist': {'count': 2, 'model': 'gpt-6.1-sol', 'reasoning_effort': 'high'},
'executor': {'count': 1, 'model': 'gpt-6.1-sol', 'reasoning_effort': 'max'},
},
# Operator-supplied conservative reservation rates, not a published price claim.
'model_prices': {
Expand Down
20 changes: 10 additions & 10 deletions backend/prism_runtime/live_execution.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Event-driven Astra execution over the host Bybit and market-data services.
"""Event-driven Sol execution over the host Bybit and market-data services.

The controller owns no exchange transport. All market/account reads and order
mutations go through the injected services, so development and tests can use
Expand Down Expand Up @@ -40,14 +40,14 @@ def _order_link(tool_id):


class ExecutionController:
"""Operational Astra execution coordinator.
"""Operational Sol execution coordinator.

Args:
store: Prism's SQLite ``Store``.
adapter: ``BybitAdapter`` (including its injected transport, if offline).
market: ``MarketDataService`` with ``snapshot`` and ``snapshot_status``.
memory: ``ResearchMemory``; execution observations are recorded per strategy.
agents: ``ResponsesAgent``. Astra is called only from ``handle_event``.
agents: ``ResponsesAgent``. Sol is called only from ``handle_event``.
eligibility: Optional ``eligibility(strategy_id)`` callback. Defaults to
``LiveResearch(store).eligibility``.
clock: Callable returning epoch seconds.
Expand Down Expand Up @@ -1213,7 +1213,7 @@ def _event_summary(self, event):
return result

def handle_event(self, event):
"""Run one bounded Astra conversation for a durable runtime event."""
"""Run one bounded Sol conversation for a durable runtime event."""
if not isinstance(event, dict):
return {"status": "blocked", "reason": "Invalid execution event"}
strategy_id = event.get("strategy_id")
Expand All @@ -1233,7 +1233,7 @@ def handle_event(self, event):
if not config["bybit"].get("enabled") or not config["live_execution"].get("enabled") or not self._permission_allowed():
reason = ("Bybit is disabled by the operator" if not config["bybit"].get("enabled") else
"Live execution is disabled by the operator" if not config["live_execution"].get("enabled") else
"Runtime permission is paused; discretionary Astra execution is blocked.")
"Runtime permission is paused; discretionary Sol execution is blocked.")
value = self._decision_value(decision_id=decision_id, event_id=event_id, strategy_id=strategy_id,
fingerprint=identity([strategy_id, event.get("kind"), event.get("snapshot_id"), reason]),
status="blocked", snapshot_id=event.get("snapshot_id"), rationale=reason)
Expand Down Expand Up @@ -1273,7 +1273,7 @@ def handle_event(self, event):
if not self._permission_allowed():
value = self._decision_value(decision_id=decision_id, event_id=event_id, strategy_id=strategy_id,
fingerprint=fingerprint, status="blocked", snapshot_id=snapshot_id,
rationale="Runtime permission is paused; discretionary Astra execution is blocked.")
rationale="Runtime permission is paused; discretionary Sol execution is blocked.")
self._record_memory(world, value)
return value
approved_snapshots = {snapshot_id}
Expand All @@ -1299,7 +1299,7 @@ def handle_event(self, event):
task_id="execution-" + decision_id)
except BudgetExceeded as error:
status = "blocked"
reason = "Astra execution budget unavailable (" + type(error).__name__ + ")"
reason = "Sol execution budget unavailable (" + type(error).__name__ + ")"
value = self._decision_value(decision_id=decision_id, event_id=event_id, strategy_id=strategy_id,
fingerprint=fingerprint, status=status, snapshot_id=snapshot_id, rationale=reason,
result={"summary": reason})
Expand All @@ -1308,7 +1308,7 @@ def handle_event(self, event):
return value
except Exception as error:
status = "blocked"
reason = "Astra execution unavailable (" + type(error).__name__ + ")"
reason = "Sol execution unavailable (" + type(error).__name__ + ")"
value = self._decision_value(decision_id=decision_id, event_id=event_id, strategy_id=strategy_id,
fingerprint=fingerprint, status=status, snapshot_id=snapshot_id, rationale=reason,
result={"summary": reason})
Expand Down Expand Up @@ -1341,9 +1341,9 @@ def handle_event(self, event):
rationale = rationale or action_rationale or action_result.get("rationale") or action_result.get("decision_rationale")
rationale = rationale or summary
if not rationale and action.get("name") == "hold":
rationale = "Astra recorded a hold."
rationale = "Sol recorded a hold."
else:
rationale = summary or "Astra made no execution proposal; the host recorded a hold."
rationale = summary or "Sol made no execution proposal; the host recorded a hold."
rationale = _bounded_text(rationale)
decision_snapshot_id = (action_result.get("decision_snapshot_id") or action_result.get("snapshot_id")
or snapshot_id)
Expand Down
4 changes: 2 additions & 2 deletions backend/prism_runtime/operations_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'scheduler': {'model': 'gpt-6-luna', 'reasoning_effort': 'low', 'daily_calls': 96, 'daily_usd': 15., 'concurrency': 1, 'max_output_tokens': 4096},
'discovery': {'model': 'gpt-6.1-sol', 'reasoning_effort': 'medium', 'daily_calls': 96, 'daily_usd': 100., 'concurrency': 8, 'max_output_tokens': 8192},
'review': {'model': 'gpt-6.1-sol', 'reasoning_effort': 'medium', 'daily_calls': 32, 'daily_usd': 40., 'concurrency': 1, 'max_output_tokens': 8192},
'execution': {'model': 'gpt-6-astra', 'reasoning_effort': 'high', 'daily_calls': 240, 'daily_usd': 150., 'concurrency': 1, 'max_output_tokens': 4096},
'execution': {'model': 'gpt-6.1-sol', 'reasoning_effort': 'high', 'daily_calls': 240, 'daily_usd': 150., 'concurrency': 1, 'max_output_tokens': 4096},
},
'bybit': {
'mode': 'paper', 'enabled': False, 'mainnet_enabled': False,
Expand Down Expand Up @@ -55,7 +55,7 @@ def validate_operations_section(section, changes):
if set(row) != set(OPERATION_DEFAULTS[section][component]):
raise ValueError('Unknown resource setting')
if row['model'] != OPERATION_DEFAULTS[section][component]['model']:
raise ValueError('Runtime role model is fixed; execution requires gpt-6-astra')
raise ValueError(component + ' model is fixed at ' + OPERATION_DEFAULTS[section][component]['model'])
if row['reasoning_effort'] not in {'low', 'medium', 'high', 'xhigh', 'max'}:
raise ValueError('Invalid reasoning effort')
for name in ('daily_calls', 'concurrency', 'max_output_tokens'):
Expand Down
2 changes: 1 addition & 1 deletion backend/prism_runtime/operations_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def section(key, title, rows):
f"{r.get('parent_experiment_id', 'parent')} → {r.get('child_experiment_id') or 'no child'}",
str(r.get('evaluation') or 'Separate experiment; parent history retained.'), key=r.get('id'), status=r.get('status'))
for r in memory.get('recent_revisions', [])])
section('decisions', 'Astra decisions', [_item(
section('decisions', 'Sol decisions', [_item(
f"{r.get('strategy_id', r.get('strategy_version', 'Strategy'))} · {r.get('action', 'decision')}",
r.get('rationale', r.get('reason', r.get('summary', ''))), key=r.get('id'), status=r.get('status'), at=r.get('created_at', r.get('at')))
for r in execution.get('decisions', [])])
Expand Down
2 changes: 1 addition & 1 deletion backend/prism_runtime/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ def _authorize(self, agent, cycle, inputs, generation):
if not self._active(generation):
return []
# Legacy daily-equity paper execution remains deterministic. Operational
# Astra decisions belong to the independent Bybit execution lane, with
# Sol decisions belong to the independent Bybit execution lane, with
# tool results and current host checks; never pay for ignored advice.
with self._execution_lock:
if not self._active(generation):
Expand Down
6 changes: 4 additions & 2 deletions backend/prism_runtime/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def _array(items: dict, maximum: int = 16) -> dict:
_DEFAULTS = {
"collector": ("gpt-6-luna", "low"),
"analyst": ("gpt-6.1-sol", "medium"),
"strategist": ("gpt-6-astra", "high"),
"execution": ("gpt-6-astra", "max"),
"strategist": ("gpt-6.1-sol", "high"),
"execution": ("gpt-6.1-sol", "max"),
}
_INSTRUCTIONS = {
"collector": "Extract a few material, novel findings with source evidence IDs. "
Expand Down Expand Up @@ -179,6 +179,8 @@ def run(self, agent: dict, payload: dict) -> dict:
schema = output_schema(layer)
default_model, default_effort = _DEFAULTS[layer]
model = str(agent.get("model") or default_model)
if layer in {"execution", "strategist"} and model == "gpt-6-astra":
model = default_model # Old persisted task records follow the current role routing.
effort = str(agent.get("reasoning_effort") or default_effort)
if effort not in {"none", "minimal", "low", "medium", "high", "xhigh", "max"}:
raise ProviderError("Unsupported reasoning effort")
Expand Down
2 changes: 1 addition & 1 deletion backend/prism_runtime/risk_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def validate_intent(intent, *, strategy, decision_snapshot, market, account, ord
expiry = number(intent.get('expires_at_ms'), 'Intent expiry', positive=True)
deadline = min(limits['max_decision_age_seconds'], strategy['market_policy']['max_decision_latency_seconds']) * 1000
if captured > now_ms + 1000 or now_ms - captured > deadline or not now_ms < expiry <= captured + deadline:
raise IntentRejected('Astra intent is stale or exceeds its permitted validity window')
raise IntentRejected('Sol intent is stale or exceeds its permitted validity window')
if account.get('reconciliation_required', True):
raise IntentRejected('Account reconciliation is required')
account_at = number(account.get('updated_at_ms'), 'Account update time', positive=True)
Expand Down
22 changes: 22 additions & 0 deletions backend/prism_runtime/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,28 @@ def __init__(self, path, *, clock=None):
db.execute("UPDATE cascade_calls SET status='unknown',charged=reserved WHERE status='reserved'")
db.execute("UPDATE cascade_jobs SET status='interrupted' WHERE status='working'")
self._upgrade_sector_config()
self._upgrade_sol_routing()

def _upgrade_sol_routing(self):
"""Replace former Astra role settings without touching evidence or budgets."""
with self.connection() as db:
db.execute('BEGIN IMMEDIATE')
row = db.execute("SELECT value FROM cascade_meta WHERE key='config'").fetchone()
if row is None:
return
saved = json.loads(row['value'])
updated = copy.deepcopy(saved)
roles = [updated.get('resources', {}).get('execution')]
roles.extend(updated.get('layers', {}).get(role) for role in ('strategist', 'executor'))
for role in roles:
if isinstance(role, dict) and role.get('model') == 'gpt-6-astra':
role['model'] = 'gpt-6.1-sol'
if updated == saved:
return
db.execute('INSERT OR IGNORE INTO cascade_meta VALUES (?,?)',
('config_before_sol_routing', encoded(saved)))
db.execute("UPDATE cascade_meta SET value=? WHERE key='config'", (encoded(updated),))
self.event('configuration', 'Migrated execution and strategy-review model routing to GPT-6.1 Sol.')

def _now_ms(self):
value = self._clock()
Expand Down
38 changes: 34 additions & 4 deletions backend/tests/test_agent_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def handle(name, args, key):
result = self.agent.tools({'strategy_version': 'frozen'}, tools, handle, task_id='decision')
self.assertEqual(len(calls), 1)
self.assertEqual(len(self.requests), 2)
self.assertEqual(self.requests[0]['model'], 'gpt-6-astra')
self.assertEqual(self.requests[0]['model'], 'gpt-6.1-sol')
self.assertFalse(self.requests[0]['parallel_tool_calls'])
self.assertIn('reasoning', [r.get('type') for r in self.requests[1]['input']])
self.assertIn('function_call_output', [r.get('type') for r in self.requests[1]['input']])
Expand Down Expand Up @@ -89,12 +89,42 @@ def test_mainnet_configuration_and_component_merging_are_explicit(self):
self.assertFalse(self.store.config()['bybit']['enabled'])
self.assertFalse(self.store.config()['bybit']['mainnet_enabled'])
self.store.update_config({'resources': {'execution': {'daily_calls': 5}}})
self.assertEqual(self.store.config()['resources']['execution']['model'], 'gpt-6-astra')
with self.assertRaises(ValueError):
self.store.update_config({'resources': {'execution': {'model': 'gpt-6-luna'}}})
self.assertEqual(self.store.config()['resources']['execution']['model'], 'gpt-6.1-sol')
for model in ('gpt-6-luna', 'gpt-6-astra'):
with self.subTest(model=model), self.assertRaises(ValueError):
self.store.update_config({'resources': {'execution': {'model': model}}})
with self.assertRaises(ValueError):
self.store.update_config({'live_execution': {'max_decision_age_seconds': 300}})

def test_saved_astra_routing_migrates_once_without_rewriting_history_or_limits(self):
legacy = self.store.config()
legacy['resources']['execution'].update(model='gpt-6-astra', daily_calls=7,
daily_usd=11., reasoning_effort='medium')
for role in ('strategist', 'executor'):
legacy['layers'][role]['model'] = 'gpt-6-astra'
self.store.set_document('config', legacy)
self.store.set_document('execution_state', {'decision': 'prior hold', 'order_id': 'keep'})
call = self.store.reserve('gpt-6-astra', 1000, 100, now=self.clock())
self.store.settle(call, {'input_tokens': 200, 'output_tokens': 20})
expected = copy.deepcopy(legacy)
expected['resources']['execution']['model'] = 'gpt-6.1-sol'
for role in ('strategist', 'executor'):
expected['layers'][role]['model'] = 'gpt-6.1-sol'
restarted = Store(self.store.path, clock=self.clock)
self.assertEqual(restarted.config(), expected)
self.assertEqual(restarted.get_document('config_before_sol_routing'), legacy)
self.assertEqual(restarted.get_document('execution_state'), {'decision': 'prior hold', 'order_id': 'keep'})
with restarted.connection() as db:
receipt = dict(db.execute('SELECT * FROM cascade_calls WHERE id=?', (call,)).fetchone())
self.assertEqual(receipt['model'], 'gpt-6-astra')
self.assertAlmostEqual(receipt['charged'], .009)
again = Store(self.store.path, clock=self.clock)
self.assertEqual(again.config(), expected)
self.assertEqual(again.get_document('config_before_sol_routing'), legacy)
with again.connection() as db:
count = db.execute("SELECT COUNT(*) FROM cascade_events WHERE message LIKE 'Migrated execution and strategy-review%'").fetchone()[0]
self.assertEqual(count, 1)


if __name__ == '__main__':
unittest.main()
Loading
Loading