# Using plugins

Wago keeps host capabilities outside the core runtime. Plugins add the capabilities a module needs without putting every integration into Wago itself.

In this guide, you will add WASI Preview 1 support to a local project and run a module that writes to standard output.

![Installing the WASI plugin and running a WASI module](/demos/wasi.gif)

## Before you begin

You need:

- Wago installed with a runtime selected. Complete [Getting started](./getting-started) first if `wago --version` does not show an active runtime.
- [Go 1.22 or newer](https://go.dev/doc/install). Wago plugins are Go modules compiled into your runtime.

Check both tools from your terminal:

```sh
wago --version
go version
```

## Create a local Wago project

Create or enter a directory for the example, then initialize it:

```sh
mkdir wasi-example
cd wasi-example
wago init --run
```

This creates a `wago.json` manifest. Keeping the plugin local makes the project's dependencies and reviewed access reproducible instead of changing the runtime used by every project on your machine.

## Add WASI

[WASI](https://wasi.dev/) defines system-style interfaces that WebAssembly modules can import. Wago provides those interfaces through the official [wago-org/wasi](https://plugins.wago.sh/wago-org/wasi) plugin:

```sh
wago add wago-org/wasi
```

Keep **Preview 1** selected for this example. Review the source, dependencies, and requested Authorities before accepting them. Plugins are native Go dependencies; grants control access to privileged Wago integration APIs, but they do not sandbox arbitrary plugin code.

Now, check to make sure it is installed:

```sh
wago plugins list
```

> A lot of the subcommands have aliases so that it reads naturally. For example, `wago plugin` and `wago plugins` both work the same way.

The command updates `wago.json`, writes the complete resolved graph and reviewed grants to `wago-lock.json`, and builds a project runtime. Commit both JSON files with your project.

## Download a WASI module

This small module imports WASI Preview 1's `fd_write` function and calls it from `_start`:

```sh
curl -fsSL https://wago.sh/corpora/wasi-hello.wasm -o wasi-hello.wasm
```

You can see the import before executing the module:

```sh
wago module imports wasi-hello.wasm
```

## Run it

```sh
wago run wasi-hello.wasm
```

You should see:

```text
hello from wasi
```

You can even compile it to a standalone executable:

::: code-group

```bash [macOS / Linux]
wago compile wasi-hello.wasm -o wasi-hello
./wasi-hello
```

```powershell [Windows]
wago compile wasi-hello.wasm -o wasi-hello.exe
.\wasi-hello.exe
```

> **Wago — finds the nearest `wago.json`, selects its project runtime, and uses the WASI plugin to satisfy the module's import.:**

## Where to go next

### [Install and choose scope](./guides/plugins/install-and-scope)
  Learn when to use local, global, or bare plugin selection.

### [Review grants and lockfiles](./guides/plugins/grants-and-lockfiles)
  Understand Authorities, guest capabilities, dependency graphs, and reproducible builds.

### [Write your own plugin](./guides/plugins/authoring/first-plugin)
  Scaffold a Go module and add a host import from definition to catalog.

### [Browse plugins](https://plugins.wago.sh)
  Find published host capabilities and runtime extensions.

### [Troubleshoot a build](./troubleshooting/plugins-and-builds)
  Fix missing Go tools, denied grants, stale lockfiles, and plugin build failures.
