feat: add shared runtime with FastAPI job server and safety pipeline
This commit is contained in:
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -21,4 +22,38 @@ class AgentResult:
|
||||
steps: int
|
||||
started_at: float
|
||||
ended_at: float
|
||||
usage: "UsageSummary"
|
||||
error: str | None = None
|
||||
cancelled: bool = False
|
||||
|
||||
|
||||
@dataclass
|
||||
class UsageSummary:
|
||||
input_tokens: int = 0
|
||||
cached_input_tokens: int = 0
|
||||
output_tokens: int = 0
|
||||
reasoning_tokens: int = 0
|
||||
total_tokens: int = 0
|
||||
estimated_cost_usd: float | None = None
|
||||
model_for_pricing: str | None = None
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
return {
|
||||
"input_tokens": self.input_tokens,
|
||||
"cached_input_tokens": self.cached_input_tokens,
|
||||
"output_tokens": self.output_tokens,
|
||||
"reasoning_tokens": self.reasoning_tokens,
|
||||
"total_tokens": self.total_tokens,
|
||||
"estimated_cost_usd": self.estimated_cost_usd,
|
||||
"model_for_pricing": self.model_for_pricing,
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
class RuntimeOptions:
|
||||
model: str
|
||||
max_steps: int = 60
|
||||
command_timeout: int = 45
|
||||
type_interval: float = 0.02
|
||||
click_pause: float = 0.10
|
||||
disable_tools: set[str] | None = None
|
||||
|
||||
Reference in New Issue
Block a user