On this page
Run lifecycle: RunConfig plus start_run()/start_run_from_file() mint the run principal, assemble the Scheduler, and execute the workflow; abort/pause/resume_run() drive trace state transitions.
#services.src.orxtra.services._run
#services.src.orxtra.services._run
#RunConfig
| Field | Type | Default | |
|---|---|---|---|
workflow_path | Path | ||
agents_dir | Path | ||
knowledge_dir | Path | ||
categories_path | Path | ||
read_root | Path | ||
db_url | str | ||
provider_configs | dict[str, dict[str, str]] | ||
budget | Decimal | ||
autonomy_level | str | ||
budget_exhaustion_policy | BudgetExhaustionPolicy | BudgetExhaustionPolicy.UNLIMITED | |
secrets_env | `dict[str, str] | None` | None |
tools_dir | `Path | None` | None |
pricing | `dict[str, TokenRates] | None` | None |
#_redact_netloc
def _redact_netloc(netloc: str) -> strRedact the password in a netloc, keeping everything else verbatim.
Works on the raw string (not parsed properties) so percent-encoded userinfo, IPv6 brackets, and host case survive untouched. Userinfo is everything before the last @; the password is everything after the first : within it.
#_redact_query
def _redact_query(query: str) -> strRedact the value of any password query parameter.
Other parameters are preserved verbatim. Keys are percent-decoded for comparison (libpq decodes URI parameter keys) but emitted as written.
#_redact_db_url
def _redact_db_url(db_url: str) -> strRedact password material in a database URL, if present.
Covers both the userinfo password (postgres://u:pw@host/db) and the libpq/asyncpg query-parameter form (postgres://host/db?password=pw).
#_serialize_config
def _serialize_config(config: RunConfig) -> dict[str, Any]Serialize a RunConfig for persistence in the run record.
Credential-bearing values (provider api_keys, db_url password) are redacted to a fixed placeholder -- the snapshot is stored verbatim in PostgreSQL and must never contain plaintext secrets.
#_load_custom_tools
def _load_custom_tools(tools_dir: Path, secret_registry: SecretRegistry | None) -> list[ToolEntry]Load data-defined tools and convert to ToolEntry objects.
Http-type definitions get a real factory via build_http_tool. Monty and command types use build_monty_tool and build_command_tool respectively, with capability-derived tags.
#start_run
async def start_run(pool: asyncpg.Pool | None, principal_storage: PrincipalStorage, caller_principal: Principal, intent: str, config: RunConfig, *, transport_registry: dict[str, Any] | None=None, overseer: Any | None=None, backend: StorageBackend | None=None, get_worker_bridge: Callable[..., Any] | None=None, run_manager: Any | None=None) -> UUID#start_run_from_file
async def start_run_from_file(pool: asyncpg.Pool, principal_storage: PrincipalStorage, get_worker_bridge: Callable[..., Any] | None, run_manager: Any, caller_principal: Principal, intent: str, config_path: Path) -> UUID#get_run
async def get_run(pool: asyncpg.Pool, run_id: UUID) -> RunReport | None#list_runs
async def list_runs(pool: asyncpg.Pool) -> list[RunSummary]#_resolve_run_principal_id
async def _resolve_run_principal_id(pool: asyncpg.Pool, run_id: UUID) -> UUIDResolve the run's own principal id for transition attribution.
Run control operations (abort/pause/resume) emit a run_transition event attributed to the run principal. It was minted at run birth; a missing one is a hard error (an invariant violation), never a silent fallback.
#abort_run
async def abort_run(pool: asyncpg.Pool, run_id: UUID) -> None#pause_run
async def pause_run(pool: asyncpg.Pool, run_id: UUID) -> None#resume_run
async def resume_run(pool: asyncpg.Pool, run_id: UUID) -> None