Guide to using PolarDB Agent Squad

更新时间:
复制 MD 格式

This topic describes the end-to-end workflow from purchasing PolarDB Agent Squad to dispatching your first issue with a Squad, including how to purchase, configure a Squad instance, initialize the workspace, dispatch issues, and review delivery results and self-evolving retrospection.

Note

For questions about PolarDB Agent Squad, you can join the consultation group on DingTalk. You can @ experts in the group and attach your question.

DingTalk group ID: 28000021116

Step 1: Purchase a Squad

  1. Log on to the PolarDB console. In the left-side navigation pane, choose PolarDB AI > PolarDB Agent Squad to go to the PolarDB Agent Squad management page.

  2. Click Create PolarDB Agent Squad to open the buy page.

  3. Configure the parameters based on your business requirements. We recommend the following order: Billing type > Engine > Region > Ecosystem > Instance specification (component set) > Network and zone > Security group.

  4. After the purchase, return to the PolarDB console. You can see the created Squad instance on the PolarDB Agent Squad page.

Step 2: Configure the Squad instance

A newly created Squad instance supports only VPC private network access, and access is limited by a whitelist. Based on your actual access method, enable public access, configure the whitelist, log on to Squad Console to dispatch tasks, and connect the runtime to Squad through a daemon.

(Optional) Enable public access

If you need to access Squad Console from the public network, or let agents access public network resources through the Squad, enable the corresponding capability.

  1. Access Squad Console over the public network:

    1. On the squad details page, on the Basic Information tab, locate the Connection Management area.

    2. Click Application, and in the confirmation dialog box click OK to apply for a public endpoint. After the application succeeds, the connection management area shows the public IP address and port.

  2. Allow the Squad to access public network resources: To let agents in the Squad access the public network, turn on the global SNAT switch in the usage workflow guide area.

Configure the network whitelist

A newly created Squad instance denies access from all external IP addresses by default. You must add the public IP addresses of your client networks to the whitelist.

  1. On the squad details page, click the Whitelist tab.

  2. Click Add Whitelist, or use the Configure entry on an existing whitelist group to add the public IP address of your client to the whitelist.

Note

In the usage workflow guide area of the squad details page, you can also click Add Current IP to automatically detect and add the public IP address of the current client.

Log on to Squad Console

After you apply for a public endpoint and configure the whitelist, you can log on to Squad Console in the following way to dispatch tasks.

  1. On the squad details page, on the Basic Information tab, locate the Connection Management area and obtain the public IP address and port of the frontend.

  2. Enter http://<public IP>:<port> in the browser to open Squad Console.

  3. Select a logon method based on the authentication configuration of the instance:

    • Passwordless logon: Enabled when the backend.PAS_AUTH_DISABLED environment variable is set to true. After this option is enabled, you can directly access the console. The default logon account is admin@polar-agent-squad.local.

    • Email + verification code logon: Applicable to users who have been invited by the admin. The user email address must be on the invitation whitelist. After the first logon, we recommend that you go to Settings > Profile to set or change the password.

    • Email + password logon: Applicable to accounts that have completed the invitation process and set a password. Users can log on with the invited email address and password.

  4. Configure an authentication token in Squad Console: Go to Settings > API Token, enter your custom token, and save it. You can then start dispatching tasks.

Note

In the usage workflow guide area of the squad details page, you can also click Open PolarDB Agent Squad Console for quick access.

Configure a daemon

Use a daemon to connect your local or cloud-based agent runtime environments to the Squad. First, install PAS CLI:

Note
  • In the usage workflow guide area of the squad details page, you can also click View Configuration Method to view the configuration command that includes the actual endpoint.

  • If you want the platform to automatically manage the daemon, skip this step. The managed mode does not require manual configuration.

curl -fsSL https://polar-squad-cli-hangzhou.oss-cn-hangzhou.aliyuncs.com/install.sh | bash

After installation, choose one of the following methods to connect to the Squad based on your network environment:

  • Method 1: Public Network

    Suitable for environments that have public network access. After you obtain the public endpoint from the Connection Management area, run:

    pas setup self-host \
      --server-url http://<public IP>:<squad backend port> \
      --app-url http://<public IP>:<frontend port>
  • Method 2: VPC Private Network

    Suitable for VPC private network environments. After you obtain the private endpoint from the Connection Management area, run:

    pas login --server-url http://<private endpoint> \
      --token <your token>
    
    pas daemon start
  • Method 3: Managed

    The platform automatically manages the daemon. No manual configuration is required.

Step 3: Initialize the Squad workspace

After you log on to Squad Console, we recommend that you initialize the workspace in the following order. This order helps you first establish the execution chain and then progressively add workflow, knowledge, and automation capabilities.

  1. Configure skills.

    • Supports manual skill import.

    • Supports one-click skill synchronization from a runtime.

    • Supports connecting an external SkillHub for one-click batch query and import of skills for business scenarios.

    • We recommend that you first import the team's common coding standards, release workflows, test commands, troubleshooting procedures, and code review rules.

  2. Configure runtimes.

    • A runtime can be a local machine or a remote ECS instance.

    • Copy the install or start command from Squad Console and run it on the target machine with one click.

    • After a runtime is connected, the platform detects available coding tools and treats them as agent execution environments.

  3. Configure repositories.

    • Add all project repositories that require agent participation in development.

    • We also recommend that you specify the default branch, target branch, and repository description so that agents can obtain the correct code context.

  4. Configure projects.

    • Create a project and associate it with the corresponding repositories.

    • A project carries a set of related issues, such as a product line, a version plan, or a dedicated governance task.

  5. Configure agents and Squads.

    • You can generate agents with one click through the Conversation entry, or create agent roles such as Director, PM, PD, RD, QA, and Reviewer on the agents page.

    • Configure the runtime, model, role description, and available skills for each agent.

    • Combine multiple agents into a Squad. The Squad takes on subsequent issues.

  6. Configure automation.

    • Create automated tasks that run on a schedule or are triggered by events.

    • Specify the executing agent, run rules, input scope, and output requirements for each automated task.

    • Common tasks include external work item sync, log-based defect discovery, stability inspections, and post-delivery retrospection.

  7. Configure playbooks.

    • You can generate a playbook with one click through the Conversation entry, or create a new playbook on the playbooks page, clone an existing playbook, or directly modify a system-provided playbook.

    • The core playbook configuration includes completion criteria, assigned roles, and prompts for each execution stage.

    • The Director uses the completion criteria to decide whether the current step passes, requires a retry, needs a rollback, or needs human confirmation.

    • Each playbook step can be assigned a maximum retry count to handle transient failures such as environment issues, network fluctuations, and unstable tests.

  8. Configure knowledge.

    • To let agents use enterprise knowledge during coding, first purchase the PolarDB knowledge base product.

    • After the purchase, you can connect the knowledge base in Squad with one click.

    • The knowledge base can add interface specifications, architecture designs, domain terminology, troubleshooting handbooks, and historical solutions to the coding context.

Step 4: Use a Squad to dispatch tasks

A Squad supports two ways to dispatch tasks: Squad Console and PAS CLI. Squad Console suits manual issue creation and observation. PAS CLI suits external system integration and automated dispatch.

(Recommended) Create an issue through conversation

  1. Open Squad Console.

  2. Click Conversation.

  3. Describe your requirement in a conversation with the Squad Assistant, which helps you generate an issue with one click.

Create an issue through Squad Console

  1. Open Squad Console.

  2. Click Create Issue.

  3. Enter the requirement title, description, acceptance criteria, and necessary attachments.

  4. Select the target Squad.

  5. Select the target Project.

  6. Select the Playbook. If you want the system to first determine the task type, select Auto evaluate.

  7. Click Dispatch. The issue enters the Squad execution flow.

  8. On the issue page, view the execution timeline, playbook stages, agent output, human comments, test results, and delivery evidence.

  9. If a stage fails, the issue enters the retry, rollback, or human confirmation flow as defined by the playbook.

Create an issue through PAS CLI

  1. Confirm that the external system and the Squad instance are in a network environment where they can reach each other.

  2. Install and log on to PAS CLI on the external system or automation machine.

  3. Use PAS CLI to query available workspaces, projects, squads, and playbooks.

  4. Use PAS CLI to create an issue with information such as the requirement title, description, project, squad, playbook, and external system links.

  5. After the creation succeeds, record the returned issue identifier for external system write-back and subsequent queries.

  6. You can use PAS CLI to query issue status, run records, and execution results.

You can view common commands as follows:

pas --help
pas issue --help
pas issue create --help
pas issue list --help

Step 5: View delivery results and self-evolving retrospection

  1. On the issue page, view the requirement completion status, execution evidence, test results, and review conclusions.

  2. For requirements that need to be retrospected, trigger self-evolving retrospection.

  3. The retrospection task analyzes the run and produces improvement suggestions that require human confirmation.

  4. Suggestions can cover playbook stages, completion criteria, agent prompts, skill content, automation triggers, and evidence chain requirements.

  5. After human confirmation, the approved suggestions are consolidated back into playbooks, skills, rules, or knowledge to improve the next delivery.

Squad management page

On the PolarDB console, choose PolarDB AI > PolarDB Agent Squad to perform full lifecycle management of Squads.

Squad list

On the PolarDB Agent Squad page, you can view the list of all Squads in the current region, including the Squad ID, status, and creation time. Click Create PolarDB Agent Squad to open the buy page and create a new Squad.

Squad details

Click a Squad ID to open the details page. The details page contains the following modules:

Tab

Description

Basic Information

View the basic properties of the Squad, the usage workflow guide, connection management, and agent relationship and topology information.

Configure

View and modify the Squad application parameters, including IM channel keys (such as DingTalk, WeCom, and Lark Secret and Client ID), backend service configuration (authentication switch, auto-login, and so on), and application ID.

Whitelist

Configure IP whitelists and security group rules to control access to the Squad.

Agent Relationships/Topology

In the Agent Relationships/Topology area of the Basic Information tab, you can view and manage the agents in the Squad. Agents are grouped by type. Each agent contains the following information:

Column

Description

Agent Name

The name identifier of the agent.

Agent Type/Source

The source type of the agent, such as PolarDB Agent Express or a custom agent.

Attach Status

The attachment status of the agent with the Squad. Valid values:

  • Unattached: The agent has not connected to the Squad.

  • Attaching: The agent is establishing a connection with the Squad.

  • Attached: The agent has successfully connected to the Squad and can participate in collaboration.

Attach an agent

In the Agent Relationships/Topology area, locate an agent in the Unattached state and click Attach in the Actions column. In the dialog box that appears, enter the agent's Token and click OK to complete the attachment.

Detach an agent

For an agent in the Attached state, click Unbind in the Actions column. In the confirmation dialog box, click OK to detach the agent.