← Về thư mục
openai4s/agent/runtime.py
- _DetachedCallBudget · class · L75-L144 — class _DetachedCallBudget
- init · method · L98-L103 — def init(self, limit: int, *, per_scope_limit: int) -> None
- outstanding · method · L105-L109 — def outstanding(self, scope: str | None = None) -> int
- admit · method · L111-L127 — def admit(self, scope: str | None = None) -> None
- track · method · L129-L130 — def track(self, scope: str | None = None) -> "_DetachedCall"
- _enter · method · L132-L135 — def _enter(self, scope: str | None) -> None
- _exit · method · L137-L144 — def _exit(self, scope: str | None) -> None
- _DetachedCall · class · L147-L178 — class _DetachedCall
- init · method · L156-L161 — def init(self, budget: _DetachedCallBudget, scope: str | None) -> None
- detach · method · L163-L169 — def detach(self) -> None
- settle · method · L171-L178 — def settle(self) -> None
- _LateAccounting · class · L196-L247 — class _LateAccounting
- init · method · L211-L216 — def init(self) -> None
- submit · method · L218-L235 — def submit( self, sink: Callable[[Mapping[str, Any]], None], reply: Mapping[str, Any], ) -> None
- _drain · method · L237-L247 — def _drain(self) -> None
- _null_log · function · L253-L254 — def _null_log(*args: object) -> None
- _allow_cell · function · L257-L258 — def _allow_cell(_action: CodeCell) -> None
- _CancelProbe · class · L261-L281 — class _CancelProbe
- init · method · L276-L278 — def init(self, probe: Callable[[], bool], *, abort_stream: bool) -> None
- call · method · L280-L281 — def call(self) -> bool
- _cancelled_model_reply · function · L284-L292 — def _cancelled_model_reply() -> dict[str, Any]
- TranscriptTurn · class · L296-L298 — class TranscriptTurn
- CompletionSignal · class · L302-L306 — class CompletionSignal
- completion · method · L305-L306 — def completion(self) -> Any
- ChatModel · class · L310-L530 — class ChatModel
- complete · method · L345-L530 — def complete( self, messages: Sequence[Mapping[str, Any]], on_delta: Callable[[str], None], ) -> Mapping[str, Any]
- is_cancelled · function · L394-L403 — def is_cancelled() -> bool
- report_abandoned_reply · function · L411-L433 — def report_abandoned_reply() -> None
- abandon · function · L435-L444 — def abandon() -> Mapping[str, Any]: # Latch before inspecting outcome: the provider may be between # storing its reply and running its accounting callback.
- emit_delta · function · L448-L453 — def emit_delta(text: str) -> None: # WebEventSink and the action ledger are single-threaded state # machines. The provider thread only queues bytes; the owning # Agent thread below is the sole caller of on_delta.
- invoke · function · L460-L491 — def invoke() -> None
- _positive_float · function · L533-L543 — def _positive_float(value: Any) -> float | None
- CompactionPolicy · class · L547-L834 — class CompactionPolicy
- prepare · method · L588-L606 — def prepare(self, state: RunState) -> Sequence[Mapping[str, Any]]
- _trip · method · L608-L611 — def _trip(self, reason: str, before: ContextEstimate) -> None
- _prepare · method · L613-L751 — def _prepare( self, state: RunState, tool_schemas: Sequence[Mapping[str, Any]], context_budget: int | None, calibration: float, ) -> tuple[Sequence[Mapping[str, Any]], ContextEstimate]
- _compaction_failed · method · L753-L769 — def _compaction_failed( self, state: RunState, before: ContextEstimate, error: BaseException, messages: Sequence[Mapping[str, Any]], ) -> Sequence[Mapping[str, Any]]
- _calibration_ratio · method · L771-L788 — def _calibration_ratio(self, state: RunState) -> float
- _should_trigger · method · L790-L802 — def _should_trigger( self, *, context_budget: int | None, calibrated_total: float ) -> bool
- _tool_schemas · method · L804-L812 — def _tool_schemas(self, state: RunState) -> tuple[Mapping[str, Any], ...]
- _context_budget · method · L814-L826 — def _context_budget(self, state: RunState) -> int | None
- _metadata · method · L828-L834 — def _metadata(self, state: RunState) -> CompactionArchiveMetadata
- _generation_json_safe · function · L837-L845 — def _generation_json_safe(value: Any) -> Any
- KernelGenerationRecorder · class · L848-L959 — class KernelGenerationRecorder
- init · method · L863-L867 — def init(self, store: Any, root_frame_id: str) -> None
- observe · method · L869-L889 — def observe(self, kernel: Any, *, language: str = "python") -> str | None
- current · method · L891-L894 — def current(self, language: str = "python") -> str | None
- close · method · L896-L910 — def close( self, *, language: str | None = None, reason: str = "run_finished" ) -> None
- _create · method · L912-L959 — def _create(self, kernel: Any, language: str) -> str | None
- LocalActionExecutor · class · L963-L1410 — class LocalActionExecutor
- bind_progress_circuit · method · L984-L1010 — def bind_progress_circuit(self, state: RunState) -> None
- execute · method · L1012-L1029 — def execute( self, action: Action | None, reply: ModelReply, state: RunState ) -> ExecutionOutcome
- _execute_native · method · L1031-L1156 — def _execute_native( self, batch: NativeToolBatch, state: RunState ) -> ExecutionOutcome: # Evidence counts executed calls, not declared or merely dispatched # ones: the batch answers parse/validation/limit refusals without # invoking anything, an unknown tool name is refused before the # dispatcher, and a static precheck, the dispatcher's permission gate, # a soft-fail result or a raised dispatch all end without the work a # later bullet may claim. Count a call only once its dispatch reports # ok, so none of those can back an execution-shaped finalize claim. # list.append is atomic under the GIL, so parallel read waves count # safely.
- dispatch · function · L1045-L1115 — def dispatch(call)
- execute · function · L1049-L1052 — def execute()
- execute_with_capture · function · L1065-L1103 — def execute_with_capture()
- invoke · function · L1117-L1123 — def invoke(call)
- _execute_code · method · L1158-L1278 — def _execute_code( self, action: CodeCell, reply: ModelReply, state: RunState ) -> ExecutionOutcome
- _allocate_code_attempt · method · L1280-L1317 — def _allocate_code_attempt(self) -> tuple[Any, str, str] | None
- _finish_code_attempt · method · L1320-L1324 — def _finish_code_attempt(attempt: tuple[Any, str, str], state: str) -> None
- _attempt_generation · method · L1326-L1341 — def _attempt_generation( self, action: CodeCell, result: dict, state: RunState ) -> str | None
- _record_kernel_generation · method · L1343-L1356 — def _record_kernel_generation(self, state: RunState) -> None
- _execute_legacy_or_nudge · method · L1358-L1400 — def _execute_legacy_or_nudge( self, reply: ModelReply, state: RunState ) -> ExecutionOutcome
- count_executed · function · L1374-L1380 — def count_executed(call: Any, ok: bool) -> None
- _user_observation · method · L1403-L1410 — def _user_observation( observation: str, *, completion: Any = None ) -> ExecutionOutcome
- TranscriptEventSink · class · L1414-L1429 — class TranscriptEventSink
- emit · method · L1420-L1429 — def emit(self, event: AgentEvent) -> None
- _spill_observation · function · L1448-L1467 — def _spill_observation(text: str, kind: str, workspace: str | None) -> str | None
- _budgeted · function · L1470-L1496 — def _budgeted(text: str, kind: str, workspace: str | None) -> str
- evidence_cell_id · function · L1499-L1513 — def evidence_cell_id(dispatcher: Any, cell_id: Any) -> str | None
- format_observation · function · L1516-L1562 — def format_observation(result: dict, *, cell_id: str | None = None) -> str