pub struct AgentVm { /* private fields */ }Expand description
One VM with coding agents in it: the Sandbox plus the specs it was built for.
Runtime-checked, like the sandbox it wraps, and for the same reason: one object is what the bindings can hold.
Implementations§
Source§impl AgentVm
impl AgentVm
Sourcepub fn new(sandbox: Sandbox, specs: Vec<AgentSpec>) -> Result<Self, Error>
pub fn new(sandbox: Sandbox, specs: Vec<AgentSpec>) -> Result<Self, Error>
Wraps a sandbox for specs. Refuses an empty or repeated set.
Sourcepub fn claude_code(sandbox: Sandbox) -> Self
pub fn claude_code(sandbox: Sandbox) -> Self
A VM for Claude Code with the profile’s defaults.
pub fn sandbox(&self) -> &Sandbox
pub fn sandbox_mut(&mut self) -> &mut Sandbox
Sourcepub fn session(&self) -> Option<&Session>
pub fn session(&self) -> Option<&Session>
The session, once AgentVm::launch has run.
Sourcepub fn image_name(&self, request: &CreateImageRequest) -> String
pub fn image_name(&self, request: &CreateImageRequest) -> String
The image name for these specs and this binary: the stem plus the first twelve
hex characters of the artifact content hash, so an unchanged binary and an
unchanged spec set name the image build --reuse would find (AGENT-3).
Sourcepub fn image_request(
&self,
binary: Vec<u8>,
build_role_arn: impl Into<String>,
size: SizeClass,
) -> Result<CreateImageRequest, Error>
pub fn image_request( &self, binary: Vec<u8>, build_role_arn: impl Into<String>, size: SizeClass, ) -> Result<CreateImageRequest, Error>
The create request for this VM’s image, named per AgentVm::image_name.
code_artifact_uri is left empty for the caller to fill: the upload is theirs
(S3 is not in this crate’s dependency set), and the key they choose is usually
derived from the name this method just computed. Sandbox::preflight refuses a
request whose URI is still blank.
Sourcepub async fn build(
&mut self,
request: CreateImageRequest,
) -> Result<&Image, Error>
pub async fn build( &mut self, request: CreateImageRequest, ) -> Result<&Image, Error>
Builds the image. The caller has uploaded the artifact to the request’s URI.
Sourcepub fn launch_request(
&self,
image_identifier: impl Into<String>,
execution_role_arn: Option<String>,
) -> RunRequest
pub fn launch_request( &self, image_identifier: impl Into<String>, execution_role_arn: Option<String>, ) -> RunRequest
The launch request: egress on (AGENT-9), because neither agent reaches Bedrock without it, and the token label set to the image name.
Sourcepub async fn launch(&mut self, request: RunRequest) -> Result<&Session, Error>
pub async fn launch(&mut self, request: RunRequest) -> Result<&Session, Error>
Launches and waits for the daemon to answer.
Sourcepub async fn install_access(&self, access: &BedrockAccess) -> Result<(), Error>
pub async fn install_access(&self, access: &BedrockAccess) -> Result<(), Error>
install_access on this VM’s session.
Sourcepub async fn prompt(
&self,
agent: Agent,
task: &str,
options: &PromptOptions,
) -> Result<ExecHandle, Error>
pub async fn prompt( &self, agent: Agent, task: &str, options: &PromptOptions, ) -> Result<ExecHandle, Error>
prompt on this VM’s session, for one of the agents it carries.
Sourcepub async fn terminate(&mut self, opts: TeardownOpts) -> TeardownReport
pub async fn terminate(&mut self, opts: TeardownOpts) -> TeardownReport
Tears the VM down; see Sandbox::terminate.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AgentVm
impl !UnwindSafe for AgentVm
impl Freeze for AgentVm
impl Send for AgentVm
impl Sync for AgentVm
impl Unpin for AgentVm
impl UnsafeUnpin for AgentVm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more