Agents targeting
Running a task on a single agent
The basic syntax for running a task is:
jack run <agent_name> <plugin:task> [arguments...]
Example:
jack run agent1 health:ping
agent1
→ output:
true
Targeting methods overview
Jackadi provides several ways to target multiple agents:
1. Single agent targeting
Target a specific agent by name:
jack run -t agent1 example:task1
2. List-based targeting
Target multiple specific agents:
jack run -l "agent1,agent2,agent3" example:task1
3. Pattern-based targeting
Glob Patterns (default):
jack run -g "worker-*" example:task1
jack run "web-*" example:task1 # -g is default
Regular Expressions:
jack run -e "agent[0-9]+" example:task1
jack run -e "^(web|api)-server-[0-9]{2}$" example:task1
4. Query targeting
The most advanced targeting method using hostname and/or specs:
Exact match
The operator for an exact match is ==
.
jack run -q "id==hostname1" example:task1
List of agents
The operator for a list is ==
. The elements in the list are separated by a comma.
jack run -q "id==agent1,agent2" example:task1
Glob pattern
The operator for a glob pattern is =~
.
jack run -q "id=~agent*" example:task1
Regex pattern
The operator for regex filtering is =~
, followed by /your_regex/
.
jack run -q "id=~/^agent.*$/" example:task1
Logical operators
You can combine multiple filters together using AND
and OR
.
The order of execution follows standard binary/mathematical logic: AND
operations are processed before OR
.
jack run -q "id==agent1 AND specs.dev.hardware.Vendor==Lenovo" example:task1
jack run -q "id==agent1 OR specs.dev.hardware.Type==Laptop" example:task1
Using nested spec
When the used spec is nested, like a map or a struct, you can access to a specific leaf using .
.
jack run -q "specs.system.os.kernel.version=~'6.17.*'" kernel-specific:task
You can also access to an element of a list:
jack run -q "specs.system.network.interfaces[0].status==up" network:configure
4. Target from a file
You can import a list of target from a file (one agent per line).
agent1
agent2
agent3
jack run -f ./agents.txt cmd:run "pwd"