SPB Git

Repository Public

sessions-connect.md 4.3 KB 48 lines markdown

1---2title: Connect to a Managed Agents session from your terminal3url: https://platform.claude.com/docs/en/cli-sdks-libraries/cli/sessions-connect4description: Attach the ant CLI to a Claude Managed Agents session to follow its transcript live, send messages, allow or deny tool calls, or open the session viewer in your browser.5---67`ant beta:sessions connect` attaches your terminal to an existing Claude Managed Agents [session](https://platform.claude.com/docs/en/managed-agents/sessions). It loads the session's transcript and follows it live as the agent works. You can also step in: send a message, interrupt the agent, or allow or deny a tool call that is waiting for approval. With `--web`, it opens the session in the Claude Console's session viewer in your browser instead.89The command requires version 1.32.0 or later of the CLI. To install or update the CLI and authenticate, see the [CLI quickstart](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/quickstart).1011## Connect to a session1213Pass the ID of a session in your workspace. You can copy it from the create response, from `ant beta:sessions list`, or from the Console.1415```bash CLI16ant beta:sessions connect sesn_011CZkZAtmR3yMPDzynEDxu717```1819Without `--web`, the command needs an interactive terminal. In scripts, use `ant beta:sessions:events stream` and `ant beta:sessions:events send` instead. See [CLI scripting and automation](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/scripting).2021Press Ctrl+C to detach. The session keeps running, and connecting again loads its full history.2223## Follow and steer the session2425The terminal view shows the conversation live: messages and tool calls, with each call's duration and outcome. A status bar shows whether the session is running, idle, or waiting for your approval. In [multiagent](https://platform.claude.com/docs/en/managed-agents/multiagent-orchestration) sessions, the view follows the session's primary thread, which includes the messages the coordinator exchanges with the agents it delegates to.2627| Key                | Action                                                                                                                     |28| ------------------ | -------------------------------------------------------------------------------------------------------------------------- |29| Enter              | Send your input as a `user.message` event. Alt+Enter or Ctrl+J starts a new line.                                          |30| Esc                | Interrupt the agent while it's running (`user.interrupt`).                                                                 |31| Ctrl+O             | Show or hide detail: tool inputs and results, token usage, and status events. `--verbose` (`-v`) starts with detail shown. |32| Page Up, Page Down | Scroll through the transcript. Scrolling up pauses following; End resumes it.                                              |33| Ctrl+C             | Detach. Ctrl+D on an empty input line also detaches.                                                                       |3435When a tool call is waiting for your approval, the input line changes to **Allow tool call?** This happens under an `always_ask` policy, or under `auto` when the server reaches no determination. Choose **Yes**, **No**, or **No, and tell the agent why**. The CLI sends your choice as a [`user.tool_confirmation`](https://platform.claude.com/docs/en/managed-agents/permission-policies#respond-to-confirmation-requests) event, with any reason you type as its `deny_message`.3637If the session is `terminated` or deleted, the view is read-only.3839## Open the session viewer in your browser4041```bash CLI42ant beta:sessions connect sesn_011CZkZAtmR3yMPDzynEDxu7 --web43```4445`--web` serves the Console's session viewer from a local server on `127.0.0.1`, prints its URL, and opens it in your browser. Add `--no-browser` to skip opening the browser. You can also send messages, interrupt the agent, and allow or deny a tool call from the browser. Unlike the terminal view, the browser viewer follows every thread of a multiagent session.4647The URL can be opened once, within two minutes of being printed. Reloading that tab works, but to open the viewer anywhere else, run the command again. Your credentials never leave the CLI: the page sends requests only to the local `ant` process, which makes the API requests. The server runs until you press Ctrl+C.48
Files main
Menu

Theme