pub trait PendingCall: Send {
// Required methods
fn function_name(&self) -> &str;
fn positional_args(&self) -> &[Value];
fn keyword_args(&self) -> &[(String, Value)];
fn call_id(&self) -> u64;
fn dump(&self) -> Result<Vec<u8>, RuntimeError>;
fn resume(
self: Box<Self>,
with: ResumeWith,
) -> Result<RunStep, RuntimeError>;
}agents and codeact only.Expand description
A paused external-function call awaiting a result.
It can be resumed exactly once (consuming it), or its continuation can be
serialized with dump for suspend-to-store before resuming.
§Arguments
A call exposes its arguments the way an interpreter actually produces them —
positional_args and
keyword_args, separately. The driver binds them onto
the tool’s parameter names (via bind_call_args) before invoking the tool,
so a runtime never needs the tool’s schema to name positional arguments. A
runtime whose language has only keyword arguments returns an empty positional
slice; one with only positional arguments returns an empty keyword slice.
Required Methods§
Sourcefn function_name(&self) -> &str
fn function_name(&self) -> &str
The name of the external function (tool) the script called.
Sourcefn positional_args(&self) -> &[Value]
fn positional_args(&self) -> &[Value]
The positional arguments, in call order, marshalled to JSON.
Sourcefn keyword_args(&self) -> &[(String, Value)]
fn keyword_args(&self) -> &[(String, Value)]
The keyword arguments, in call order, marshalled to JSON.
Sourcefn dump(&self) -> Result<Vec<u8>, RuntimeError>
fn dump(&self) -> Result<Vec<u8>, RuntimeError>
Serialize the suspended continuation to bytes (valid while paused here).
The returned bytes can later be passed to CodeRuntime::resume.
Sourcefn resume(self: Box<Self>, with: ResumeWith) -> Result<RunStep, RuntimeError>
fn resume(self: Box<Self>, with: ResumeWith) -> Result<RunStep, RuntimeError>
Resume execution, consuming this call. Advances to the next RunStep.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".