# Class LittleGhost::Tool::Binding

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/Tool/Binding.html

Supply run-scoped collaborators when tools are instantiated outside an agent.
A binding can be copied with selected collaborators replaced.

Tool instances expose the bound agent, run, runtime, model, workspace, and
sandbox through matching accessors. A Binding does not carry model Tool
arguments or application state; the current RunContext carries that state.
ToolRegistry and Agent normally create bindings on behalf of application code.

## Inheritance

`LittleGhost::Tool::Binding < Object`

## Attributes

<a id="attribute-i-agent"></a>
### `agent` (R)

Agent, run, runtime, model, workspace, and sandbox available to a tool.

<a id="attribute-i-model"></a>
### `model` (R)

Agent, run, runtime, model, workspace, and sandbox available to a tool.

<a id="attribute-i-run"></a>
### `run` (R)

Agent, run, runtime, model, workspace, and sandbox available to a tool.

<a id="attribute-i-runtime"></a>
### `runtime` (R)

Agent, run, runtime, model, workspace, and sandbox available to a tool.

<a id="attribute-i-sandbox"></a>
### `sandbox` (R)

Agent, run, runtime, model, workspace, and sandbox available to a tool.

<a id="attribute-i-workspace"></a>
### `workspace` (R)

Agent, run, runtime, model, workspace, and sandbox available to a tool.

## Class methods

<a id="method-c-new"></a>
### `.new`

```ruby
.new(agent: nil, run: nil, runtime: nil, model: nil, workspace: nil, sandbox: nil)
```

Creates a binding from any available run-scoped collaborators.

## Instance methods

<a id="method-i-build"></a>
### `#build`

```ruby
#build(*tool_classes)
```

Instantiates each supplied tool class against this binding.

<a id="method-i-with"></a>
### `#with`

```ruby
#with(agent: self.agent, run: self.run, runtime: self.runtime, model: self.model,
        workspace: self.workspace, sandbox: self.sandbox)
```

Copies the binding, replacing only the supplied collaborators.
