Skip to content

Conversation

@JoeColeman95
Copy link
Contributor

@JoeColeman95 JoeColeman95 commented Nov 11, 2025

Primary purpose of this PR is to enable filtering via --state and --tags.

  • --state allows input of running, idle or paused.
  • --tags will match with AND logic, so if multiple tags are defined, both must resolve to true in order to display any agent(s). If the Agent has 3 tags and we match with 2 tags, that's also fine.

The issue raised requesting this feature #544 requested a --queue flag. However, due to the filtering capability that could be enabled by allowing multiple flags, I've opted for --tags, this would still allow --tags queue=default in this case.

Tags can be filtered like so:

  • --tags queue=default
  • --tags queue=default --tags os=linux
  • --tags queue=default,os=linux

Both filters implemented are client-side, as the API doesn't currently support server-side filtering for these attributes.

Tests added to validate states, validate invalid state input and test single/multiple tags.

Tested this locally, too. All works great.

Fixes #544

Adding --state flag to filter agents by running, idle, or paused state using GraphQL. Adds support for paused-related fields to the Agent type in the schema and updates the agent list command to use GraphQL for state-based filtering.
Adding--state flag to filter agents by their state (running, idle, paused) using a helper function
Adding --tags flag to the agent list command, allowing agents filtering by one or more tags
@JoeColeman95 JoeColeman95 requested a review from a team as a code owner November 11, 2025 17:10
@mcncl mcncl merged commit 1697ce1 into main Nov 11, 2025
1 check passed
@mcncl mcncl deleted the SUP-4793/Adding-state-and-tags-filter-to-agent-list branch November 11, 2025 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💡 feat: Add --state and --queue filter for bk agent list

3 participants