@agentmark-ai/cli) provides tools for developing, testing, and building your AI prompts.
Commands at a glance
Jump to any command’s full reference:agentmark init: set up AgentMark in a new or existing projectagentmark doctor: check that you configured your project correctlyagentmark dev: start the local dev environment (API, webhook, UI)agentmark login: authenticate with AgentMark Cloudagentmark logout: clear stored CLI credentialsagentmark link: link your local project to a Cloud appagentmark run-prompt: run a single prompt with test propsagentmark run-experiment: run an experiment against its datasetagentmark generate-types: generate type definitions from prompt schemasagentmark generate-schema: generate a JSON Schema for prompt frontmatteragentmark build: compile prompts to JSON for static loadingagentmark pull-models: pull and configure models from a provider
Installation
agentmark init, @agentmark-ai/cli is also pinned as a local dev dependency, so npm run dev and CI resolve that pinned version from node_modules/.bin regardless of what’s installed globally.
Environment variables
The CLI automatically loads environment variables from a.env file in the current working directory. This happens before any command execution, so you can store API keys and configuration there.
Update notifications
The CLI checks for updates asynchronously when you run commands. If a newer version is available, you’ll see a notification after your command completes. This check is non-blocking. To disable update checks, set the environment variable:Commands
agentmark init
Set up AgentMark in a new or existing project. Writes agentmark.json, creates the agentmark/ prompts directory, pins @agentmark-ai/cli as a local dev dependency (plus npm scripts), wires IDE MCP configs for the clients you pick, and installs the agent skill. Run it once per project: from inside an existing repo (the common case) or with a folder name to scaffold a fresh one.
| Option | Description | Default |
|---|---|---|
[folder] / --path <folder> | Target directory | . inside an existing project, else my-agentmark-app |
--client <ids> | IDE clients to wire MCP configs for, comma-separated: claude-code, codex, cursor, vscode, zed (or all) | prompt (pre-selects detected editors) |
-y, --yes | Non-interactive: accept the default for every prompt (folder default, all IDE clients, keep an existing agentmark.json). For CI and coding agents | interactive |
--overwrite | Replace an existing agentmark.json with the default config | keep existing |
--api-url <url> | Override the AgentMark gateway URL for the cloud MCP entry (internal staging / self-host) | https://api.agentmark.co |
dev / build script is never overwritten. AgentMark’s scripts land under namespaced keys (agentmark:dev, …) instead. npm create agentmark is a thin wrapper that runs this exact flow.
agentmark doctor
Check that you set up your AgentMark project correctly. The default pass is a static health check (no network calls, no servers spawned) that inspects your config, prompts, client, and dependencies and reports each finding with a fix. The optional --smoke tier adds a live end-to-end run. Run it right after scaffolding, or when a command fails with a config or dependency error.
| Option | Description | Default |
|---|---|---|
--json | Emit the report as JSON instead of human-readable text | human text |
--strict | Exit non-zero on warnings too (useful in CI) | off |
--smoke | Also run a live tier: execute a prompt against a running agentmark dev and verify the emitted trace’s shape (model, tokens, input, output) | static only |
--boot | With --smoke, start agentmark dev automatically and tear it down afterward (one command, for CI / agents) | assumes dev is running |
--prompt <path> | Prompt to run for --smoke (defaults to the first prompt found) | first prompt |
--props <json> | Props as a JSON string for the --smoke prompt. Requires --prompt (for example '{"name":"Alice"}') | none |
--webhook-port <number> | Webhook port --smoke targets (and --boot starts dev on) | 9417 |
--api-port <number> | API-server port --smoke reads traces from (and --boot starts dev on) | 9418 |
- Project:
agentmark.jsonis present and valid (including field/schema shape: required keys present, no unknown-key typos);agentmarkPathresolves (catches the"/"mistake); the client file (agentmark.client.ts/agentmark_client.py), the dev-server entry, and the managed-deploy handler (handler.ts/handler.py) exist;AGENTMARK_API_KEY/AGENTMARK_APP_IDare present;.envis gitignored; Node.js is 20.6+. - Config & prompts: every
.prompt.mdxparses and declares amodel_name; you declare prompt models inbuiltInModels(doctor enforces a non-empty list as an allowlist); the catalog recognizes the models. - Dependencies: doctor checks that you installed the runtime packages (resolvable from the project), not just listed them in
package.json. The client and dev-entry import@agentmark-ai/prompt-core, so doctor fails the check whenpackage.jsondeclares prompt-core butnode_moduleslacks it, and points you tonpm install; a missing install is the most common reasonagentmark devordoctor --smoke --bootexits 1.@agentmark-ai/sdkcarries tracing and the cloud-execution runner; doctor warns (rather than fails) whennode_moduleslacks it orpackage.jsonomits it.agentmark initpins@agentmark-ai/clilocally so CI and teammates run the same version; a missing pin is an advisory warning. For Python projects, doctor checks thatagentmark-prompt-coreandagentmark-sdkimport, and skips with a reminder when it can’t verify them. There is no SDK-specific adapter to require: you bring your own SDK through@agentmark-ai/prompt-core’s neutral render or an executor. - Live run (
--smoke): runs one prompt end-to-end throughagentmark devand confirms real output + token usage came back, then fetches the emitted trace and validates its shape, exercising your SDK, provider keys, and tracing indirectly, with no provider-specific knowledge.
0 when nothing failed (warnings don’t fail the run), 1 on any failure, or on any non-advisory warning with --strict. Advisory warnings (like a missing local @agentmark-ai/cli pin) are informational and never fail the run, so adding agentmark init to an existing project won’t turn a green --strict CI gate red. So it drops straight into CI.
Example:
agentmark dev
Start the local development environment: the API server, the webhook server, and the local dev UI app. Once you link the project (agentmark link), traces from local runs automatically forward to AgentMark Cloud.
| Option | Description | Default |
|---|---|---|
--api-port <number> | API server port | 9418 |
--webhook-port <number> | Webhook server port | 9417 |
--app-port <number> | Local dev UI port | 3000 |
--no-forward | Disable trace forwarding to AgentMark Cloud (forwarding is on by default once you link the project) | forward |
--no-ui | Skip the UI app (API + webhook only) for CI / headless / test use | UI on |
--no-watch | Don’t restart on file changes; exit on a dev-entry crash so the error surfaces (for CI / headless / boot use) | watch on |
For programmatic Cloud access, run the
agentmark-mcp MCP server or call the gateway REST API directly.- TypeScript projects:
agentmark.client.tsin the project root - Python projects:
pyproject.toml,agentmark_client.py, or.agentmark/dev_server.py
dev-server.ts(custom override, project root)dev-entry.ts(default location, project root)
.venv/ or venv/ directories.
Example:
agentmark login
Authenticate with AgentMark Cloud via browser OAuth. The CLI opens your default browser to complete the login flow, then stores credentials locally for subsequent commands.
| Option | Description | Default |
|---|---|---|
--base-url <url> | AgentMark Cloud URL | $AGENTMARK_PLATFORM_URL or https://app.agentmark.co |
--print-url | Print the auth URL instead of opening a browser (for SSH’d shells, CI runners, or IDE-embedded agents) | open browser |
--json | Emit a single line of JSON on completion instead of human text; useful for wrapper scripts that need to capture user_id / email programmatically | human text |
--timeout <seconds> | How long to wait for the browser handoff before failing | 120 (2 minutes) |
agentmark link, trace forwarding in agentmark dev, and the agentmark-mcp MCP server all use the stored credentials automatically. For the MCP server, the AGENTMARK_API_KEY environment variable takes precedence over the cached session bearer; agentmark link itself always requires a login session.
agentmark logout
Clear stored CLI authentication credentials.
| Option | Description | Default |
|---|---|---|
--base-url <url> | AgentMark Cloud URL | $AGENTMARK_PLATFORM_URL or https://app.agentmark.co |
--json | Emit a single line of JSON on completion instead of human text. Shape: {"logged_out": true, "was_logged_in": <bool>, "revoked_dev_key": <bool>} | human text |
agentmark link
Link your local project to an app in AgentMark Cloud. The CLI prompts you to select an app from your account (or use --app-id to skip the prompt), then stores the app ID and app/org metadata in .agentmark/dev-config.json. The CLI creates no API key: trace forwarding authenticates with your login session.
| Option | Description | Default |
|---|---|---|
--app-id <uuid> | App ID to link (skips interactive selection) | None |
--base-url <url> | AgentMark Cloud URL | $AGENTMARK_PLATFORM_URL or https://app.agentmark.co |
--json | Emit a single line of JSON on completion (for example, for CI to capture the linked appId). Shape: {"linked": true, "appId": "...", "appName": "...", "tenantId": "...", "orgName": "...", "baseUrl": "..."} | human text |
agentmark dev automatically forwards traces from local prompt runs to the linked app, with no flag needed. agentmark dev reads the linked appId from .agentmark/dev-config.json (per-developer, gitignored). The forwarder authenticates with the session bearer from ~/.agentmark/auth.json (auto-refreshed).
agentmark run-prompt
Run a single prompt file with test props.
| Argument | Description |
|---|---|
filepath | Path to the .prompt.mdx file |
| Option | Description | Default |
|---|---|---|
--server <url> | Webhook server URL | http://localhost:9417 |
--props <json> | Props as JSON string | - |
--props-file <path> | Path to JSON or YAML file containing props | - |
agentmark run-experiment
Run an experiment against its dataset, with evaluations by default.
| Argument | Description |
|---|---|
filepath | Path to the .prompt.mdx file with test configuration |
| Option | Description | Default |
|---|---|---|
--server <url> | Webhook server URL | http://localhost:9417 |
--skip-eval | Skip running evals even if they exist | false |
--format <format> | Output format: table, csv, json, jsonl, junit | table |
--threshold <percent> | Fail if pass rate is below threshold (0-100) | - |
--sample <percent> | Sample N% of dataset rows randomly (1-100) | - |
--rows <spec> | Select specific rows by index/range (for example 0,3-5,9) | - |
--split <spec> | Train/test split (for example train:80, test:80) | - |
--seed <number> | Seed for reproducible sampling/splitting | - |
--truncate <chars> | Truncate table cell content to N chars (0 = no limit) | 1000 |
--concurrency <number> | Dataset rows to run in parallel | 20 |
--baseline-commit <ref> | Git ref (or tree hash) of a prior run to compare against; enables the regression gate via test_settings.regression_tolerance | - |
agentmark generate-types
Generate TypeScript type definitions from your prompt schemas.
| Option | Description | Default |
|---|---|---|
-l, --language <language> | Target language (typescript or python) | typescript |
--local <port> | Local server port to fetch prompts from | - |
--root-dir <path> | Root directory containing agentmark files | - |
- Input types based on
input_schema - Output types based on the model’s
schema - A mapping of prompt paths to their respective types
- Tool argument types
agentmark generate-schema
Generate a JSON Schema file for .prompt.mdx frontmatter. This enables IDE validation (squiggles) for fields like model_name in your prompt files.
| Option | Description | Default |
|---|---|---|
-o, --out <directory> | Output directory | .agentmark |
agentmark build
Build prompts into pre-compiled JSON files for static loading with FileLoader.
| Option | Description | Default |
|---|---|---|
-o, --out <directory> | Output directory | dist/agentmark |
- An
agentmark.jsonconfig file must exist in the current directory agentmark buildreads prompts from the directory thatagentmarkPathnames in the config
FileLoader.
agentmark pull-models
Pull and configure models from a provider. Runs interactively by default; pass --provider + --models to skip the prompts (for example, for CI or agents).
| Option | Description | Default |
|---|---|---|
--provider <name> | Provider key (skips the interactive picker) | prompt |
--models <csv> | Comma-separated model IDs to add (skips the interactive multi-select) | prompt |
--list | Print available providers (or models when combined with --provider) as JSON and exit; doesn’t modify agentmark.json | off |
--provider and --models set, the command runs fully non-interactively and is safe for CI.
This command opens an interactive prompt (when you pass no flags) to:
- Select a model provider
- Choose models to enable
- Update your local configuration
--list to discover valid providers and model IDs before modifying config (no agentmark.json required):
--list output is stable JSON, safe to pipe into jq or capture in scripts.
Programmatic gateway access (for agents and scripts)
Programmatic gateway access is available through two protocol-level surfaces that stay in lock-step with the gateway’s OpenAPI spec:- IDE agents (Claude Code, Cursor, VS Code, Zed): run the
agentmark-mcpMCP server. It fetches the gateway’s OpenAPI spec at startup and exposes one MCP tool per operation (for examplecreate_app,list_traces,start_app_git_connect). The agent calls those tools directly; no CLI invocation needed. - CI / shell scripts: call the gateway REST API with
curland anAGENTMARK_API_KEY. AgentMark generates the MCP tools from the same OpenAPI spec, so request shapes are identical; only the transport differs.
AGENTMARK_API_KEY env var first, then the session bearer from ~/.agentmark/auth.json (written by agentmark login).
Configuration files
agentmark.json
Project configuration file in your project root. See Project config for the full schema.
| Field | Description |
|---|---|
agentmarkPath | Base path for agentmark files (contains the agentmark/ directory); use "." for the canonical layout, not "/" |
version | Configuration version |
mdxVersion | MDX syntax version |
.agentmark/dev-config.json
Auto-generated local development configuration (gitignored):
appPort: local dev server UI port (updated when dev server starts).forwarding: linked app metadata (app ID, app and org names, gateway base URL) used byagentmark devwhen forwarding traces to AgentMark Cloud. Populated byagentmark linkand cleared byagentmark logout. No credentials live here: the forwarder authenticates with your login session.
agentmark link again restores the app binding.
Have questions?
Reach out any time:
- Email the team at hello@agentmark.co for support
- Schedule an Enterprise Demo to learn about AgentMark’s business solutions