The agent pool
The agent pool is the set of DK Studio Agents the platform can address β one per bench, one per test rig, one per vehicle bench. It is the scheduling surface of the lab: every shell script, every system snapshot and every serial session is dispatched to one named agent from here. This page introduces what an agent is, how one joins the pool, who is online, how work is assigned, and how the pool scales.
What an agent is in the platform
An agent is the DK Studio Agent process running on the machine under test. The platform keeps one
row per agent in the agents table:
| Field | Meaning |
|---|---|
id | The agent id, sent with every command, heartbeat and registration. |
name | The name the agent gave itself at registration. |
capabilities | JSON array of what the agent reports it can do. |
workstation | JSON description of the host: hostname, platform, architecture. |
status | The stored status. active marks an agent the pool may address. |
scope, owner_user_id | Who the machine belongs to, derived from the licence type it claimed. |
api_key, agent_secret | Credentials: a 32-character key returned once at registration, and the secret that authenticates the socket. |
license_id | The licence the agent claimed. |
registration_count | How many times it has registered. |
last_registered_at, last_seen_at | Registration and last-contact timestamps. |
The agent dials out to the studio and holds a Socket.IO connection open; the studio never dials
back, so a bench needs no public address. On the bench itself, the agent serves a small page at
http://localhost:3001 where an operator can open a serial port directly.
Registering agents
Registration is a two-step handshake: somebody issues a licence, and the agent claims it.
- A licence is issued
A person applies for a personal licence in their Personal Center, or an administrator issues a lab licence from Admin β Licences.
POST /api/licensescreates the licence and returns itscode. - The agent claims it
POST /api/agent/registerpresents the code together with the agent's name, the studio URL, its workstation description and its capabilities. The platform validates the licence, registers the machine in the scope the licence type dictates, and returns the agent's permanent identity:agentId,apiKeyandagentSecret. - The agent authenticates on the socket
The agent sends an
authrequest with itsagentId,agentSecretandprotocolVersion; the platform answers with anauthresponse βok: trueand the agent's identity, orok: falsewith the codeAUTH_FAILED, after which it closes the socket.
{ "type": "lab", "location": "A-12", "label": "Bench A" }{
"code": "dk_l_β¦",
"name": "bench-01",
"studioUrl": "http://studio.lab.example:3000",
"workstation": { "hostname": "bench-01", "platform": "linux", "arch": "x64" },
"capabilities": ["shell", "serial"]
}The response gives back agentId, apiKey and agentSecret, along with licenseType and scope.
A licence is claimed once: registering the same code again is refused. To bring an agent back after a
reinstall, register with the agent's own agentId and agentSecret β the platform updates it in
place, same id, same apiKey.
The licence code is returned once, at creation, and only its owner and an administrator can read it. A licence is spent on the registration it authorises. The full procedure is in Agent Registration.
Seeing who is online
It answers with {agents, timestamp}, where each agent carries id, name, status (always
"online"), lastSeen and capabilities.
Two conditions have to hold for an agent to appear here: its stored status must be active, and
it must have a live Socket.IO connection. Presence is derived from the socket map on every request,
so the list is a live view of the lab.
| View | Endpoint | What it answers |
|---|---|---|
| Live | GET /api/agents | The agents that are connected right now, each reported with status: "online". |
| Inventory | GET /api/admin/agents | Every registered agent, with status, connectionStatus (online or offline), capabilities, workstation, lastSeen and registrationCount. |
An agent can be active and offline β powered down, on a flaky link, or waiting for the studio.
The inventory view shows both states; the live view shows only what you can send a command to
right now.
Assigning work
Work is a command addressed to one agent. The platform records it, delivers it, and keeps the outcome.
{
"agentId": "0f2cβ¦",
"command": "shell",
"args": { "script": "uname -a" },
"timeout": 30000
}The command is written to agent_commands as pending, pushed down the socket, and answered with
the new commandId. The agent claims it β in_progress β and posts the result back, which moves
the row to completed:
pending βββΆ in_progress βββΆ completed
If the socket is down, the same rows are served by the agent's polling path,
GET /api/agent/commands?agentId=, and the agent answers with POST /api/agent/commands/result.
Read the finished record back with GET /api/agents/commands/{id}, which returns id, agentId,
commandType, status, result, startedAt and completedAt β with result holding stdout,
stderr, exitCode and durationMs.
The command vocabulary the pool can dispatch:
| Command | Arguments | What it does on the bench |
|---|---|---|
shell | script, cwd, timeout | Writes the script and runs it with /bin/bash. |
get_system_info | β | Returns a snapshot of the machine. |
get_serial_ports | β | Lists the serial ports available. |
open_serial | path, baudRate | Opens a serial port. |
close_serial | path | Closes a port the agent has open. |
serial_write | path, data | Writes to a port the agent has open. |
The full contract for each one is in Command Reference.
| Response | Meaning |
|---|---|
400 Agent is offline | The agent has no live connection. |
400 Agent is not active | The agent is registered but not in the pool. |
404 Agent not found | No agent carries that id. |
Health and capacity
last_seen_atis the liveness timestamp the platform keeps. The agent reports in withPOST /api/agent/heartbeatand the platform updateslast_seen_at; thestatusin that request is advisory, because presence comes from the socket.registration_countrises each time an agent registers again with the credentials it already holds. A count above one usually means the machine was reinstalled or re-pointed β the agent kept its id.- The licence is the entitlement.
.studio-license.jsoncarriesedition,maxAgentsandfeatures, and the platform enforces them: the pool will not take more agents thanmaxAgentsallows, andfeaturesdecides which parts of the platform the licence unlocks.
| Edition | Licence key prefix | maxAgents | features |
|---|---|---|---|
| Starter | STR0 | 3 | core, agents |
| Professional | PRF0 | 10 | adds analytics, api |
| Pro | PR00 | 25 | adds advanced |
| Enterprise | ENT0 | 999 | adds enterprise |
Scaling the pool across a lab
Give every bench its own agent and name it after the bench it sits on β bench-01, bench-02,
rig-hil-a. The name is what your team will read in the agent list and in the command log, and it
is the handle you use when you write a test that targets a particular machine.
From there the pool scales along three lines:
- More benches. Register another agent up to the licence's
maxAgentsallowance. Each agent carries its own credentials and its own licence, so a bench can be swapped without touching the others. - More per bench. An agent reports its
capabilities, so you can tell a rig with serial control from one that only offers a shell, and route work to the right one. - More throughput. Commands are addressed to a named agent, so spreading a campaign across
several agents spreads the load across several benches β send the same script to
bench-01andbench-02and compare the two results.
The Agents screen in the studio is the working view of the pool: the live list of connected agents, a shell console on each, and the socket status of the ones that are away.
How to verify
GET /api/agentsβ the live list, withlastSeenon every entry.GET /api/admin/agentsβ the full inventory, withconnectionStatusandregistrationCount.GET /api/agents/commands/{id}β the result of a command you dispatched.
Related pages
- Agent Registration β issuing a licence and claiming it.
- Personal Center β your own licences and machines.
- Socket Protocol β how a command actually reaches the agent.
- Remote Shell and Serial β the commands in use.
- Configuration β the licence file and the studio's own settings.