Announcing: The Scout CLI and AI Workflows as CodeLearn More
Back to blocks topics
Blocks

Copilot Blocks

Copilot blocks are designed to power conversational AI experiences in Scout Copilot. They handle messaging, dynamic thinking states, and link extraction/return.

Learning Objectives:

  • Learn how to trigger and structure a Copilot workflow
  • Build a complete Copilot experience
  • Learn how to extract and display links from model output.

1. Copilot Block (Trigger/Input):

  • This block acts as the workflow’s trigger when a user interacts with your Copilot widget. It receives the user’s message, chat history, and optional metadata.
  • Configuration Options:
    • These are preset and shouldn't need any modifications unless you would like to change the display name or ID.
      • User Message (user_message) – The user’s input message.
      • Chat History (chat_history) – The conversation so far.
      • Metadata (metadata) – Optional context, like user ID or source.

2. Copilot Thinking Block:

  • Sends a “thinking” or “pending” message to the Copilot client, letting users know the assistant is working on their request. This block is typically placed right after the trigger. It helps improve user experience by showing a loading or status message while downstream blocks (like Copilot Message) are running.
  • Configuration Options:
    • Add a block and select Copilot Thinking.
    • In the right-hand panel, under Configuration:
    • Text: Enter the message you want the user to see while the workflow is processing (e.g., “Searching for the best answer…”).

3. Copilot Message Block

  • Generates a response using a language model (e.g., GPT-4o) and sends it back to the Copilot client.
  • Configuration Options:
    • Add a block and select Copilot Message.
    • In the right-hand panel, under Configuration:
    • Model: Choose your preferred LLM (default is GPT-4o).
    • Temperature: Controls randomness (0 = deterministic, 2 = very creative; default is 0.7).
    • Max Tokens: Limits response length (default is 300).
    • Response Format: Choose text (plain text) or json_object (structured output).
    • Providing a System Prompt:
      • In the Copilot Message block, enter a "System" prompt that guides the AI's response. For example:
json
Using the data from the documentation, provide a summary of the key insights or help the user answer any questions based on the documentation. If you do not know an answer or the documentation does not cover a particular topic let the user know your are unsure and DO NOT try and answer the question.

Documentation: 
PDF: {{collection_block.output}}
  • Use placeholders like {{collection_block.output}} to dynamically insert data from previous blocks.
    • Be sure to change out the ID's so that they reflect the actual ID that's used in your workflow.
  • Next we need to add a user prompt:
    • This will be defining what the user message is. In this workflow the user message should be {{inputs.message}} or whatever has been designated as the initial input in the Trigger/Input block.
  • Messages section of the Copilot Message block:
    • System Message
      • Definition: A special message that sets the initial context, instructions, or role for the model.
      • Example: "You are a helpful legal advisor specializing in startup law."
      • Purpose: Directs how the model should behave throughout the conversation.
    • User Message
      • Definition: Any input from the user, usually a question, command, or statement.
      • Example: "What legal structure should I use for my new startup?"
      • Purpose: Tells the model what needs to be answered, reasoned about, or acted upon.
    • Assistant Message
      • Definition: The AI's response to a user message.
      • Example: "For most startups, an LLC is a flexible and popular choice because..."
      • Purpose: To generate outputs based on the system message and user message history.

4. Extract Links From Markdown Block

  • Extracts all markdown links from a given text (such as the Copilot Message output), fetches their titles, snippets, and favicons, and prepares them for display.
  • How to configure:
    • Add a block and select Extract Links From Markdown.
    • In the right-hand panel, under Configuration:
      • Items: Set this to the output of your Copilot Message block
        • {{copilot_message_block.output}}
          • Make sure this matches the ID of your copilot message block.
      • Fetch Snippets: Toggle on if you want to fetch a snippet/preview for each link.
      • Fetch Titles: Toggle on to fetch the page title for each link.
      • Fetch Favicons: Toggle on to fetch the site’s favicon.
  • Tip: Make sure the upstream block (usually Copilot Message) actually outputs markdown links.

5. Return Links Block:

  • Displays a beautified, formatted list of links (with titles, snippets, favicons) at the end of the Copilot’s response. This block takes the enriched links and displays them as a formatted list at the end of the Copilot chat, making it easy for users to see sources or further reading.
  • How to configure:
    • Add a block and select Return Links (sometimes called Copilot List of Links).
    • In the right-hand panel, under Configuration:
      • Items: Set this to the output of your Extract Links block
      • Limit: Set the maximum number of links to display (default is 5).
      • Header: Optional. Set a custom header for your list (e.g., “References” or “Sources”).
    • Tip: This block expects a list of dictionaries (one per link), so always connect it to Extract Links.

Micro-Challenge:

  • Use the template below to set up a Copilot workflow. Try experimenting with different “Thinking” messages, and test how the Copilot extracts and returns citation links.
Share article: