# CLI

The SDK provides a built-in CLI entrypoint through `Agent::run()`. Every embedding binary automatically gets two subcommands.

## Subcommands

### `run`

Execute a local Roto script file and print the result to stdout.

```sh
<agent-binary> run --script <path> [-- arg1 arg2 ...]
```

- `--script` — path to a `.roto` file.
- Trailing positional arguments after `--` are passed to the script's `main` entrypoint.

Examples:

```sh
cargo run -p basic-agent -- run --script examples/basic-agent/scripts/basic.roto
cargo run -p basic-agent -- run --script examples/basic-agent/scripts/args.roto -- hello
```

### `serve`

Start the gRPC server.

```sh
<agent-binary> serve [--listen <addr>]
```

- `--listen` — bind address (default: `127.0.0.1:7000`).

## Exit codes

- `0` on successful execution.
- Non-zero on any error (compile failure, runtime contract violation, limits exceeded, etc.). Error details are printed to stderr.

## Notes

- The entrypoint is always `main`. There is no `--entrypoint` flag.
- Only file-backed scripts are accepted via the CLI. Inline scripts are supported over gRPC.
- Default runtime limits apply unless overridden programmatically.
