Quick start
agentmark dev options.
How it works
AgentMark Connect uses a persistent WebSocket connection between your CLI and the platform gateway:- CLI connects —
agentmark dev --remoteopens a WebSocket to the gateway (wss://api.agentmark.co/v1/connect), authenticated with your dev API key. - Gateway registers — A Durable Object is created for your app, maintaining heartbeat and connection state.
- Platform dispatches — When you click Run on a prompt or experiment, the platform sends a job to the gateway.
- Local execution — The gateway forwards the job over WebSocket to your CLI. Your local dev server executes it using your adapter (AI SDK, Claude Agent SDK, Mastra, etc.).
- Results stream back — Execution results stream back through the WebSocket to the platform in real time.
Connection status
The AgentMark dashboard shows live connection status on your app’s Settings page:- Connected — Your local dev server is connected and ready to receive jobs.
- Disconnected — No active connection. Start
agentmark dev --remoteto connect. - Error — Connection issue detected. Check CLI output for details.
Using the Connect SDK
For custom integrations outside the CLI, use the@agentmark-ai/connect npm package. This is useful if you want to build your own server that connects to the platform.
Installation
Basic usage
createConnectServer options
apiKey(string, required): Your AgentMark API key for authentication.appId(string, required): The app ID to connect to.handler(function, required): Async function called for each incoming job. Receives the job payload and returns the result.url(string, optional): WebSocket gateway URL. Default:wss://api.agentmark.co/v1/connect.onConnected(function, optional): Callback when the WebSocket connection is established.onDisconnected(function, optional): Callback when the connection is lost. Receives an optionalreasonstring.onError(function, optional): Callback when a connection error occurs.heartbeatIntervalMs(number, optional): Interval for heartbeat pings in milliseconds.reconnectMaxDelayMs(number, optional): Maximum delay between reconnection attempts.language(string, optional): Language identifier sent to the platform (e.g.,"typescript"or"python").
Troubleshooting
”Authentication failed”
The CLI could not authenticate with the platform. Runagentmark login to re-authenticate, or pass --api-key directly.
”WebSocket connection refused”
The gateway could not be reached. Check your network connection and ensurewss://api.agentmark.co is not blocked by a firewall or proxy.
”App not linked”
Your project is not linked to a platform app. Runagentmark link to select an app, or pass --app-id directly.
Connection keeps dropping
Intermittent disconnections are normal and handled automatically via reconnection with exponential backoff. If the connection drops frequently, check your network stability. The CLI logs reconnection attempts to your terminal.Platform shows “Disconnected” but CLI is running
Ensure--remote is passed to agentmark dev. Without it, the dev server runs in local-only mode without a platform connection. Also verify that no other CLI instance is connected to the same app — only one connection per app is supported.
Have Questions?
We’re here to help! Choose the best way to reach us:
- Join our Discord community for quick answers and discussions
- Email us at hello@agentmark.co for support
- Schedule an Enterprise Demo to learn about our business solutions