# libtmux.workspace:apply-workspace

**Workspace Manager concept example** A working example of the core library. It can change without notice.

- **Package:** libtmux/workspace
- **Language:** Common Lisp
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-lisp/blob/c2e5fc4ed3befda21f45dfa5d5868c38fd138311/src/workspace.lisp#L1217
- **Public owner:** libtmux.workspace
- **Page:** https://libtmux.org/en/lisp/latest/workspace/reference/libtmux-workspace-apply-workspace/

```
(apply-workspace client workspace &key cancel-token (timeout nil timeout-p) (output-limit nil output-limit-p) (total-timeout nil total-timeout-p))
```

Create or reuse WORKSPACE through explicit CLIENT and return WORKSPACE-RESULT.
The function first calls FETCH-SNAPSHOT and PLAN-WORKSPACE. A proven match
returns immediately with no command outcomes. A missing session executes each
planned core mutation once, in order, then captures and proves the final
topology. TIMEOUT and OUTPUT-LIMIT, when supplied, apply separately to each core
operation; CANCEL-TOKEN is shared. Conflicts dispatch no mutation.

TOTAL-TIMEOUT, when supplied, is a nonnegative finite number of seconds shared
across the application. Each acquisition and core step receives the smaller of
its remaining total budget and TIMEOUT or the client's default. The budget is
also checked after initial and final planning. Zero refuses the initial read;
omission adds no application budget. OUTPUT-LIMIT remains per operation.

This budget controls admission at workspace boundaries. Preparation before a
core timer starts, synchronous platform calls and additive cleanup can let an
admitted core call run or dispatch past it; caller wall time is not bounded.
Boundary expiry before the first core-step invocation signals
WORKSPACE-DEADLINE-EXCEEDED directly. Execution begins with that invocation,
which can itself fail before dispatch. Later expiry becomes WORKSPACE-APPLY-FAILED's cause,
retaining completed outcomes. It does not imply an uncertain command effect.

Failure within a core step or later signals WORKSPACE-APPLY-FAILED. RESULT-OUTCOMES retains
every dispatched outcome, including one whose post-command observation cannot
advance workspace state; FAILED-STEP identifies the failed or unstarted next
step. Final-verification failure has no failed step. No rollback or automatic
retry occurs.

See also: `libtmux.workspace:failed-step`, `libtmux.workspace:plan-workspace`, `libtmux.workspace:result-outcomes`, `libtmux.workspace:result-snapshot`, `libtmux.workspace:workspace-deadline-exceeded`.

## Parameters

- `client`
- `workspace`
- `cancel-token?`
- `timeout?`
- `output-limit?`
- `total-timeout?`

## Guides

Pages that discuss `apply-workspace`.

- [Workspace guide](/en/lisp/latest/workspace/source-guide/)

## In other ports

Build a session from a workspace description

| Language | Equivalent |
| --- | --- |
| Python | [`tmuxp.workspace.builder.ClassicWorkspaceBuilder.build`](/en/py/latest/workspace/reference/tmuxp-workspace-builder-classicworkspacebuilder-build/) (method) |
| Ruby | [`LibTmux::Workspace::Plan#apply`](/en/ruby/latest/workspace/reference/libtmux-workspace-plan-apply/) (method) |
| PowerShell | [`LibTmux.Workspace\Invoke-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-invoke-tmuxworkspace/) (cmdlet). Applies the exact reviewed [`-Plan`](/en/powershell/latest/workspace/reference/libtmux-workspace-invoke-tmuxworkspace/#LibTmux.Workspace%5CInvoke-TmuxWorkspace.parameter.Plan) after PowerShell confirmation. [`-WhatIf`](/en/powershell/latest/workspace/reference/libtmux-workspace-invoke-tmuxworkspace/#LibTmux.Workspace%5CInvoke-TmuxWorkspace.parameter.WhatIf) previews without applying it; application is detached. |
| Julia | [`LibTmuxWorkspace.apply`](/en/julia/latest/workspace/reference/libtmuxworkspace-apply/) (function). Applies a prepared `WorkspacePlan` on an explicit `Server`, detached and under one deadline. Existing session names fail unless reuse is explicit. |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`builder.applyWorkspace`](/en/ts/latest/workspace/reference/builder-applyworkspace/) (function) |
| Rust | [`src.WorkspaceBuilder.build`](/en/rs/latest/workspace/reference/src-workspacebuilder-build/) (method) |
| Go | [`workspace.Build`](/en/go/latest/workspace/reference/workspace-build/) (function) |
| Java | [`io.github.libtmux.workspace.WorkspaceBuilder.build`](/en/java/latest/workspace/reference/io-github-libtmux-workspace-workspacebuilder-workspacebuilder-build/) (method) |
| C# | [`LibTmux.Workspace.WorkspaceBuilder.BuildAsync`](/en/csharp/latest/workspace/reference/libtmux-workspace-workspacebuilder-buildasync/) (method) |
| C++ | [`libtmux::workspace::build`](/en/cxx/latest/workspace/reference/libtmux-workspace-build/) (function) |
| Swift | [`WorkspaceBuilder.build(_:on:)`](/en/swift/latest/workspace/reference/workspacebuilder-build(_-on-)/) (method) |
| OCaml | [`Libtmux_unix.Workspace.await`](/en/ocaml/latest/workspace/reference/libtmux_unix-workspace-await/) (function). Apply a validated Plan through submit, then await its retained execution receipt. Inspect preserves partial and late outcomes. |
| Perl | [`LibTmux::Workspace::load`](/en/perl/latest/workspace/reference/libtmux-workspace-load/) (method). Loads through installed public core APIs; existing-target policy and known owned rollback effects are explicit. |

No equivalent is recorded in Lua, Erlang, Elixir, Clojure, Kotlin, Scala or F#.
