# WSCLI — WebSocket Client The `@agent-smith/wscli` package provides a WebSocket client for real-time communication with the Agent Smith server. It enables sending commands to agents and workflows, receiving streaming inference tokens, tool call notifications, and managing connection lifecycle with automatic reconnection. ## Installation Install the package via npm: ```bash npm install @agent-smith/wscli ``` The package depends on `reconnecting-websocket` for automatic reconnection and `@vue/reactivity` for reactive state management used by the higher-level client features service. ## Auto-Reconnect The client uses `ReconnectingWebSocket` under the hood, which automatically attempts to reconnect when the connection is lost. If a message cannot be sent because the WebSocket is not yet open, it will retry with exponential backoff (starting at 1s, incrementing by 500ms up to 5s). ## Basic Usage Connect to the server and execute an agent: ```typescript import { useWsServer } from "@agent-smith/wscli"; const ws = useWsServer({ url: "ws://localhost:5184/ws", onToken: (token, from) => console.log(`[${from}] ${token}`), onError: (err, from) => console.error(`[${from}] ${err}`), }); // Execute an agent named "my-agent" with a prompt ws.executeAgent("my-agent", { prompt: "Hello, world!" }); // Or execute a workflow ws.executeWorkflow("my-workflow", { input: "data" }); // Cancel a running operation await ws.cancel(); ``` The `useWsServer` factory returns an object with methods for executing agents/workflows and callbacks for receiving streamed responses from the server. Next: API