logo

Swiftor AI Agent

Overview

The Swiftor AI Agent provides an advanced chat interface powered by the Vercel AI SDK. It allows interaction with a diverse range of AI models, including those capable of using tools via the Model Context Protocol (MCP) by connecting to your Swiftor Deployments (VMs). Key features include persistent chat history, text-to-speech output, custom prompts, and fine-grained model selection based on your subscription tier.

Experimental Feature

This is an experimental feature and not yet released to the public. Due to its heavy construction status, major crashes are expected. As a result there is minimal to no support available.

Interface Layout

The Agent interface is composed of several key sections:

Agent Layout
  1. Header: Contains controls for the side menu, creating new chats, viewing connection status, and accessing usage metrics (metrics functionality TBD).
  2. Side Menu (Left, Toggleable): Lists chat history, provides search functionality, and includes a button to access settings.
  3. Messages Area (Center): Displays the conversation history for the selected chat.
  4. Input Area (Bottom): Where you type messages, select deployments (for tool use), and choose AI models.
  • Side Menu Toggle (): Shows or hides the left-side chat history menu.
  • New Chat: Clears the current conversation and prepares for a new chat session (the chat is saved upon sending the first message).
  • Connection Status: Indicates whether the Agent is currently connected to a deployment via MCP for tool usage (Connected / Disconnected).
  • Metrics (pi-gauge): Placeholder for accessing usage metrics.

Side Menu

  • Search Bar: Filters your chat history by chat name or message content.
  • Chat History: Lists previous conversations stored in your browser's localStorage.
    • Each entry shows the chat name (auto-generated from the first message) and a snippet of the last message.
    • Chats are sorted by the timestamp of the last message (most recent first).
    • Clicking a chat loads its messages, selected model, and deployment connection (if applicable) into the main interface.
    • A trash icon appears on hover to delete individual chats.
  • Settings Button: Opens the settings panel.

Messages Area

Displays the flow of the conversation.

  • User Messages: Displayed typically on the right, showing the text you entered.
  • Assistant Messages: Displayed typically on the left, often preceded by an icon.
    • Content is rendered as Markdown, supporting formatting like headings, lists, bold/italics, links, etc.
    • Code Blocks: Rendered with syntax highlighting (vscDarkPlus theme). A copy button appears on hover within the code block itself.
    • Tool Calls/Results: (Visual representation may vary) The interface handles the underlying tool calls and results, presenting the final assistant response.
  • Hover Actions: When hovering over an assistant message, action icons appear:
    • Copy (pi-clone): Copies the message content to the clipboard.
    • Speak (pi-volume-up / pi-volume-off): Initiates or stops text-to-speech playback of the message content using the selected voice and speed (see Settings).
    • Regenerate (pi-sync): Resubmits the conversation history up to the message before this one to get a new response, effectively replacing the current message and any subsequent ones in that turn.
  • Welcome Screen: When no chat is selected, a welcome message with default prompt suggestions is shown.
  • Scrolling: The area automatically scrolls down as new content streams in. If you scroll up manually, auto-scroll pauses, and a "Scroll to Bottom" button appears.

Input Area

Compose messages and configure the AI's context.

  • Deployment Selector:
    • Shows the currently connected Deployment (VM) or "Select your Deployment".
    • Clicking opens a panel listing your available VMs, grouped by type (Workspace, Deployments).
    • Selecting a running VM connects the Agent to its MCP server, enabling tool usage for capable models.
    • Selecting "Direct Chat" or having no VM selected disables tool usage.
    • Connection status (Connected/Disconnected) is reflected in the header.
  • Model Selector:
    • Shows the currently selected AI model.
    • Clicking opens a panel listing available models, filterable by search.
    • Models are grouped by subscription tier (Starter, Hacker, Engineer). You can only select models available in your current tier or lower.
    • Models indicate their capabilities with tags (e.g., Tools, Vision).
    • Selecting a model updates the current chat's configuration.
    • Tool usage requires both selecting a tool-capable model AND connecting to a deployment.
  • Text Input (textarea):
    • Where you type your messages.
    • Automatically resizes vertically as you type (up to a maximum height).
    • Enter sends the message.
    • Shift+Enter inserts a newline.
    • Tab inserts 4 spaces for indentation.
    • Features a dynamic typing placeholder effect.
  • Microphone Button (pi-microphone): Placeholder for potential voice input functionality.
  • Send/Abort Button (pi-arrow-up / ProgressSpinner):
    • When idle, sends the message in the text input (enabled only if text is present).
    • When the AI is generating a response, changes to a spinner/abort icon. Clicking it stops the current generation stream.

Core Functionality

  • Tool Use (MCP): When connected to a Deployment and using a model supporting tools (function_call: true), the Agent can interact with the VM's environment. The AI determines when to use available tools based on your prompt and the conversation context.
  • Model Capabilities: Choose models based on your needs (e.g., vision models for image understanding, tool-using models for interacting with deployments).
  • Chat Persistence: Conversations, including messages, the selected model, and the connected deployment (if any), are automatically saved to your browser's localStorage. This allows you to close and reopen the browser without losing your chat history.
  • Streaming Responses: AI responses are streamed word by word or token by token for a more interactive experience.
  • Aborting Generation: You can stop the AI mid-response by clicking the abort button.
  • Regenerating Responses: Use the Regenerate (pi-sync) hover action on an assistant message to get a different response based on the preceding conversation.
  • Text-to-Speech (TTS): Use the Speak (pi-volume-up) hover action to have assistant messages read aloud.

Settings

Accessible via the cog icon (pi-cog) in the side menu.

Agent Layout
  • Voice Settings:
    • Choose from various TTS voices (e.g., Tara, Leo).
    • Adjust the speech speed (0.5x to 1.5x).
  • Custom Prompt:
    • Add persistent custom instructions (up to 50 words) to guide the AI's behavior, role, or response style across all your chats. This prompt is appended to the base system prompt.
    • Saved to localStorage.
  • Chat Management (Placeholder): Buttons for Exporting/Importing chats (functionality might be limited based on code).
  • Danger Zone:
    • Delete all chats: Permanently removes all chat history from localStorage.
    • Reset all settings: Resets voice, speed, and custom prompt to their default values. (Both actions require confirmation).