@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.
The local pin is non-destructive: an existing
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.
What it checks:
- 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.
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.
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.
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.
After linking,
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.
Options:
Example:
agentmark run-experiment
Run an experiment against its dataset, with evaluations by default.
Options:
Example:
agentmark generate-types
Generate TypeScript type definitions from your prompt schemas.
Output:
The command outputs TypeScript definitions to stdout. Redirect to a file:
- 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.
Example:
agentmark build
Build prompts into pre-compiled JSON files for static loading with FileLoader.
Requirements:
- 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).
With both
--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.
.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