Skip to main content
The Agen CLI enables developers to directly integrate AI workloads right where they code. The CLI natively communicates with your existing active sessions to retrieve code created inside Agen isolated sandbox instances.

Installation

Ensure that you have npm or yarn correctly installed via Node.
npm install -g @agenhq/cli

Setup and Authentication

Before pulling any patch files from active Sandbox sessions, confirm you have securely logged in to the Agen web portal inside your local terminal environment.
agen login
Running the login command launches a secure authorization flow directly inside your default web browser. Once finished, an HTTP API token maps uniquely to your verified user account and local .agen workspace configurations.

The Watch Command

The real magic happens behind the scenes while the CLI listens to your codebase changes seamlessly. The following command starts a continuous bidirectional synchronization stream:
agen watch <SESSION_ID>
When you launch this, real-time files created, deleted, and modified via AI changes are parsed, previewed via standard stdout console updates, and integrated into your Git-backed codebase instantly! As your preferred LLM provider generates iterations of variables, code loops, tests, and component styling, agen watch streams the exact differences dynamically into your code editor.

Common Issue: Stale Patches

If you shut down the agen CLI during an active process, some previously active sessions might be missed. You can simply resume your stream via the same command:
agen watch <SESSION_ID>
The system automatically pulls the entire directory delta changes (git format patches) previously produced over our real-time messaging network and catches your local codebase repository accurately back up to the current sandbox state.