Embed fx
fx provides the agent runtime and tools for building coding-agent interfaces. You can run its native command-line interface (CLI) in a terminal, connect an editor or another application over Agent Client Protocol (ACP), or load a WebAssembly build from JavaScript.
Choose an interface
| Goal | Interface | Runs as |
|---|---|---|
| Use fx in a terminal | fx | Native process |
| Connect an editor or another ACP client | fx acp | Native process over stdio |
| Build a JavaScript interface around the agent | createFxAgent() | fx-core.wasm |
| Add the fx terminal to a JavaScript application | createFxTerminal() | fx-term.wasm |
Run fx directly
Start the native CLI from the project you want to work on:
cd /absolute/path/to/project
fx
The current directory becomes the primary workspace. See the CLI reference for commands and global options.
Connect a native client over ACP
Run fx as an Agent Client Protocol (ACP) server:
fx acp
The ACP client launches fx as a native process and communicates with it over standard input and output. Use this interface for editors and applications that support ACP.
Load fx from JavaScript
The Zig toolchain can also compile fx to WebAssembly. The experimental JavaScript SDK loads that build as either a headless agent or an interactive terminal. The try page runs the terminal WebAssembly build of fx.
Read the WebAssembly SDK guide to choose an API and check runtime support. For browser storage, authentication, command execution, and network requests, see Browser integration.