# `Nous.CodeRuntime.Binding`
[🔗](https://github.com/nyo16/nous/blob/v0.17.1/lib/nous/code_runtime/request.ex#L1)

One global the program can call, and the functions hanging off it.

A binding is how a tool reaches model-authored code. `functions` maps the name
the program calls to the closure that serves it — already scoped to the caller,
because the closure is built from `Nous.Permissions.filter_tools/2`'s output.
A denied tool still appears here, bound to a stub that returns an error, so the
program gets a comprehensible failure instead of an undefined-function crash.

`error_class` names the exception the substrate should raise inside the guest
when a call fails, so a program can `try`/`catch` in its own idiom.

There is exactly one permission mechanism. A binding is not a second one: it
carries no allow/deny decisions of its own, only the closures that survived the
policy.

# `fun_name`

```elixir
@type fun_name() :: String.t()
```

# `t`

```elixir
@type t() :: %Nous.CodeRuntime.Binding{
  error_class: String.t(),
  functions: %{
    required(fun_name()) =&gt; (map() -&gt; {:ok, term()} | {:error, term()})
  },
  global: String.t()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
