Local
swerex.runtime.local.LocalRuntime
LocalRuntime(*, logger: Logger | None = None, **kwargs: Any)
Bases: AbstractRuntime
A Runtime that runs locally and actually executes commands in a shell. If you are deploying to Modal/Fargate/etc., this class will be running within the docker container on Modal/Fargate/etc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**kwargs
|
Any
|
Keyword arguments (see |
{}
|
Source code in swerex/runtime/local.py
363 364 365 366 367 368 369 370 371 372 373 |
|
sessions
property
sessions: dict[str, Session]
close
async
close() -> CloseResponse
Closes the runtime.
Source code in swerex/runtime/local.py
469 470 471 472 473 |
|
close_session
async
close_session(request: CloseSessionRequest) -> CloseSessionResponse
Closes a shell session.
Source code in swerex/runtime/local.py
407 408 409 410 411 412 413 414 |
|
create_session
async
create_session(request: CreateSessionRequest) -> CreateSessionResponse
Creates a new session.
Source code in swerex/runtime/local.py
387 388 389 390 391 392 393 394 395 396 397 398 |
|
execute
async
execute(command: Command) -> CommandResponse
Executes a command (independent of any shell session).
Raises:
Type | Description |
---|---|
CommandTimeoutError
|
If the command times out. |
NonZeroExitCodeError
|
If the command has a non-zero exit code and |
Source code in swerex/runtime/local.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
|
from_config
classmethod
from_config(config: LocalRuntimeConfig) -> Self
Source code in swerex/runtime/local.py
375 376 377 |
|
is_alive
async
is_alive(*, timeout: float | None = None) -> IsAliveResponse
Checks if the runtime is alive.
Source code in swerex/runtime/local.py
383 384 385 |
|
read_file
async
read_file(request: ReadFileRequest) -> ReadFileResponse
Reads a file
Source code in swerex/runtime/local.py
450 451 452 453 |
|
run_in_session
async
run_in_session(action: Action) -> Observation
Runs a command in a session.
Source code in swerex/runtime/local.py
400 401 402 403 404 405 |
|
upload
async
upload(request: UploadRequest) -> UploadResponse
Uploads a file
Source code in swerex/runtime/local.py
461 462 463 464 465 466 467 |
|
write_file
async
write_file(request: WriteFileRequest) -> WriteFileResponse
Writes a file
Source code in swerex/runtime/local.py
455 456 457 458 459 |
|