ExecuteTool

org.llm4s.agent.harness.ExecuteTool
@Experimental
object ExecuteTool

The execute tool (design ยง4.33): runs a command in a SandboxBackend, and knows nothing else about where. Through the backend, every command runs under C4's Unverifiable guard: a completed command replays its stored result, one that may have run is refused rather than run again, and a Block cannot undo what a command did (rule 5).

  • '''Arguments.''' command; workdir, a path such as /src (default /); timeout_seconds (default defaultTimeout, at most maxTimeout).
  • '''Permissions.''' A call touches ToolResource(Operation.Execute, <command>), so a PermissionMiddleware rule matches on the command; the hints are destructive and openWorld.
  • '''Order.''' A call holds backend.locks(workdir) (a workspace sandbox: its whole workspace), so a batch's commands and the edits of the files they may touch apply in call order.
  • '''Bounds.''' Each stream is at most the backend's maxOutputBytes, the command at most SandboxBackend.MaxCommandBytes, the run at most the timeout; the tool itself is stopped maxTimeout plus a minute in, for a sandbox that never answers.

The result is the exit code, stdout and stderr, and a note when output was cut. A refusal (by the sandbox's policy, or of a replay) is a tool error; a failure whose outcome is unknown fails the task, so recover decides it from C4's records.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

final case class Args(command: String, workdir: Option[String], timeoutSeconds: Option[Int])

The arguments of one call; timeout_seconds on the wire.

The arguments of one call; timeout_seconds on the wire.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def apply(backend: SandboxBackend, defaultTimeout: FiniteDuration, maxTimeout: FiniteDuration): AgentTool[Args]

The tool over backend; both timeouts must be positive and defaultTimeout at most maxTimeout.

The tool over backend; both timeouts must be positive and defaultTimeout at most maxTimeout.

Attributes

Concrete fields

val Name: String

The tool's name.

The tool's name.

Attributes