agent-swarm-cli.mdx 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. ---
  2. title: "Agent Swarm TUI"
  3. description: "Start the terminal UI with the main npx launcher, then expand optional sections only if you need them."
  4. icon: "terminal"
  5. ---
  6. Agent Swarm TUI is the terminal UI for Agency Swarm.
  7. Use it when you want to build or test your Agency Swarm project in the terminal.
  8. ## Start the TUI
  9. For most users, the right way to start is:
  10. ```bash
  11. npx @vrsen/agentswarm
  12. ```
  13. This is the main launch path. It handles first-run setup, then connects the terminal UI to your Agency Swarm server.
  14. Run it from your project root. If you are starting fresh, run it in a new empty folder.
  15. You do not need to install the TUI globally first.
  16. ![Agent Swarm TUI startup screen](/images/agent-swarm-cli-preview.png)
  17. ## Before You Start
  18. Make sure you have:
  19. - Node.js installed so `npx` is available
  20. - Python 3.12 or newer available for Agency Swarm projects
  21. - a model provider credential if you want to send prompts right away, or you can add it later with `/auth`
  22. - an existing agency project, or a starting point from [From Scratch](/welcome/getting-started/from-scratch) or the [Starter Template](/welcome/getting-started/starter-template)
  23. ## What Happens on First Launch
  24. On first launch, you will usually see this flow:
  25. <Steps>
  26. <Step title="Start the launcher">
  27. Start with `npx @vrsen/agentswarm`.
  28. </Step>
  29. <Step title="Point the launcher at an agency">
  30. The launcher can reuse the current Agency Swarm project, create a starter project, or connect to an agency that is already running.
  31. </Step>
  32. <Step title="Set up the project environment">
  33. The launcher checks for a project `.venv`. If it needs to create one, it asks first and then installs the project dependencies before opening the TUI.
  34. </Step>
  35. <Step title="Open the TUI and add auth if needed">
  36. The TUI opens connected to your agency. If you do not already have a usable model provider configured, use `/auth`.
  37. </Step>
  38. </Steps>
  39. This is the path we recommend for onboarding, videos, and first-time users.
  40. ## What You Can Do in the TUI
  41. Once the TUI is running, you get:
  42. - a keyboard-first terminal workflow
  43. - session history, export, undo, redo, and `/compact`
  44. - `/agents` to switch between top-level agents
  45. - `@AgentName` mentions to route a prompt to a specific top-level agent
  46. - `@` file and resource references to attach local or MCP context in the same prompt flow
  47. - `Tab` autocomplete for both agent mentions and file and resource references
  48. - direct access to local project files for prompt context
  49. ![Agent Swarm TUI agent picker](/images/agent-swarm-cli-agent-selection.png)
  50. ## Optional Paths
  51. If this is your first run, you can ignore everything below.
  52. <Accordion title="Connect to a running agency (optional)" defaultOpen={false}>
  53. Use the same `npx @vrsen/agentswarm` command, then choose **Connect to a running agency** during onboarding.
  54. This is the optional `/connect` path.
  55. The launcher asks for:
  56. 1. the Agency Swarm base URL
  57. 2. whether the server needs a bearer token
  58. 3. the agency id, if automatic discovery does not already find it
  59. Use it when:
  60. - a local Agency Swarm server is already running
  61. - you want to connect to a remote Agency Swarm server
  62. - the server is protected and needs a bearer token
  63. Current limitations for this path:
  64. - `/models` does not switch the models configured inside your Agency Swarm backend yet
  65. - local file tools are not available; if you want the TUI to work directly on project files, start with `npx @vrsen/agentswarm` from that project directory instead
  66. Use your Python config to choose backend models and providers.
  67. </Accordion>
  68. <Accordion title="Alternative: Launch from Python with agency.tui()" defaultOpen={false}>
  69. If your project already launches from Python, `agency.tui()` still works as the secondary entrypoint.
  70. ```python
  71. agency.tui()
  72. ```
  73. Then start your project the usual way:
  74. ```bash
  75. python agency.py
  76. ```
  77. This path stays bound to the exact `Agency` instance you passed in Python. It starts the local bridge for that agency, then opens the TUI connected to it.
  78. Use it when your team already starts the project from Python and you want a quick TUI test path without switching directories or changing entrypoints.
  79. </Accordion>
  80. `tui(show_reasoning=False)` is not supported in the new TUI yet.
  81. ## Related Pages
  82. - [Installation](/welcome/installation)
  83. - [From Scratch](/welcome/getting-started/from-scratch)
  84. - [Third-Party Models](/additional-features/third-party-models)
  85. - [Running an Agency](/core-framework/agencies/running-agency)
  86. - [FastAPI Integration](/additional-features/fastapi-integration)
  87. - [API Reference](/references/api)