When many agents work in many repositories, a person does not ask each one what it is doing. The forge keeps one table of which agents are at work, and af activity reads it: how many are working, waiting and not responding, and a line for each agent you may see, with the task it holds longest and how far its checklist is.
The counts and the lines
$ af activity
agents: 2 working, 1 waiting, 1 not responding, 3 idle
by kind: 4 coder, 2 reviewer, 1 of no kind
3f9a0c21...e1 coder working main task 7 "Fix the parser" 3 of 7 says "reading the spec"
9b41d7a0...55 coder waiting main
c0e2b8d4...09 none not responding docs task 12 "Write the guide" 0 of 4The first line counts the organization’s agents by state. The second, which is there only if some live agent was started as an agent kind, counts the organization’s live agents by the kind each was started as, the agents of no kind last. It is the organization’s count, as the live agents are, and says nothing of what any of them does. A line below it names an agent’s own kind as the kind of the task it holds, which is a different thing: the kind an agent was started as is on af agent show. An agent is:
- working when it holds a claim and its heartbeats are in time,
- waiting when it waits for the answer to a question it asked. An agent that holds a claim and waits is
not respondingif its heartbeat is late, andwaitingif it is not, and a person who waits for an answer is no agent at work and is not counted, - not responding when it holds a claim and its heartbeat is late. It is not gone: a heartbeat brings it back at once, and only a claim that runs out is freed.
- idle when it is none of these. An agent that is working on what you may not read is idle to you, and shifts none of your numbers.
Each line is one agent in one repository, by its actor id, its kind, its state, the repository, and the task of the claim it has held longest, with how many of that task’s checklist items are done or skipped, and what it says it is doing. An agent in two repositories has two lines with the same id, and counts once, in the state that takes precedence: not responding, then waiting, then working.
What a line says of a task, a title or a status line is the author’s word, untrusted: af shows its control characters as ? and cuts what is long.
What you may see
An agent is listed only if you may read the folders of everything it holds. One that works on a folder you may not read is not listed, whatever you filter by: no filter, no page and no timeout tells you of it, and to you it is idle. An agent whose work was restricted a moment ago is shown by its id alone, as hidden, until the forge has heard of it.
Narrow it
$ af activity --state not-responding
3f9a0c21...e1 coder not responding main task 7 "Fix the parser" 3 of 7
$ af activity --repo main --task 7
3f9a0c21...e1 coder not responding main task 7 "Fix the parser" 3 of 7
$ af activity --repo main --text parser
3f9a0c21...e1 coder not responding main task 7 "Fix the parser" 3 of 7--kind and --state filter by what the agent counts as. --repo keeps the agents at work in a repository. --task and --text need --repo, since a task’s number and a title are a repository’s: --task finds the holders of the task, and --text the agents that hold a task with the text in its title, not case-sensitive. A search by text reads the claims of at most 500 agents at once and says when it stopped.
A list is cut at 50 lines, or at --limit, and says so. The order is that of the actor ids, so an agent that changes state is neither skipped nor shown twice between two pages; the holders of a task are in the order they took it. The forge looks at no more than a thousand entries for one call, so a filter that fits few of many agents may give a short page: af activity then says that the search stopped at its budget, and you narrow it with another filter or a repository’s task.
Follow it
af activity --follow shows the list and then shows it again, in full under a line that says it changed, every two seconds it has. An agent that goes silent, one that comes back, and one that starts in another repository write nothing the forge could tell of, so the list is read again on a tick, and a failed read is tried again. The cost of a read is the same whatever the number of followers.
For an agent
An agent reads the same with the activity_list tool, a page at a time, and one agent with agent_show. Both only read.