agent-council 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CAUTIONS.md +254 -0
- data/DESIGN.md +57 -16
- data/INSTALL.md +13 -10
- data/README.md +214 -96
- data/RELEASE_NOTES.md +40 -0
- data/RUNAWAY_AGENTS.md +10 -6
- data/USE_CASES.md +3 -3
- data/examples/configs/antigravity.yml +20 -0
- data/examples/configs/mixed-harness.yml +10 -7
- data/exe/agent-council +3 -1
- data/lib/agent_council/harnesses/antigravity_harness.rb +249 -0
- data/lib/agent_council/harnesses/harness.rb +8 -0
- data/lib/agent_council/harnesses/opencode_harness.rb +2 -2
- data/lib/agent_council/harnesses/scaffold.rb +4 -2
- data/lib/agent_council/harnesses.rb +4 -1
- data/lib/agent_council/version.rb +1 -1
- data/lib/agent_council/worker_pool.rb +1 -1
- data/lib/agent_council.rb +15 -10
- metadata +8 -5
data/RUNAWAY_AGENTS.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
agent-council has no time limit of its own: a run lasts until every
|
|
4
4
|
agent finishes. This document explains why, what can go wrong without
|
|
5
5
|
one, how to stop a runaway agent yourself, and how to put a limit on a
|
|
6
|
-
run with the `timeout` command.
|
|
6
|
+
run with the `timeout` command. For broader security, billing, and cost
|
|
7
|
+
disclaimers, see [`CAUTIONS.md`](CAUTIONS.md).
|
|
7
8
|
|
|
8
9
|
## The problem
|
|
9
10
|
|
|
@@ -13,7 +14,8 @@ consolidator starts only after every review agent has finished) and,
|
|
|
13
14
|
on pay-per-token providers, running up cost. Its tokens and cost
|
|
14
15
|
aren't in the run's totals if you stop the run, since an interrupted
|
|
15
16
|
agent records no usage (see [How far to trust the
|
|
16
|
-
cost](README.md#how-far-to-trust-the-cost)
|
|
17
|
+
cost](README.md#how-far-to-trust-the-cost) and
|
|
18
|
+
[`CAUTIONS.md`](CAUTIONS.md#token-counts-and-cost-estimates-why-they-are-unreliable)).
|
|
17
19
|
|
|
18
20
|
The cause may be the particular model or provider: if one entry in
|
|
19
21
|
your config keeps doing it, try removing it.
|
|
@@ -133,7 +135,7 @@ working, only slowly. A coding assistant can help tell which.
|
|
|
133
135
|
|
|
134
136
|
`agent-council-ps` tells you which process to look at. A coding
|
|
135
137
|
assistant that can run shell commands, such as Claude Code, Codex,
|
|
136
|
-
OpenCode, or pi, can look further: paste that output and ask. For
|
|
138
|
+
OpenCode, Antigravity, or pi, can look further: paste that output and ask. For
|
|
137
139
|
example, one OpenCode agent reviewing a commit was still running after
|
|
138
140
|
37 minutes, long after the others had finished:
|
|
139
141
|
|
|
@@ -186,7 +188,9 @@ are in the agent's session: while the agent runs, OpenCode keeps it in
|
|
|
186
188
|
a database in the agent's scratch directory, which is deleted when the
|
|
187
189
|
agent finishes. An assistant can find the database's path in the agent
|
|
188
190
|
process's environment, as `OPENCODE_DB`. (OpenCode 1.2.4 ignored
|
|
189
|
-
`OPENCODE_DB`, saving sessions to your history instead.)
|
|
191
|
+
`OPENCODE_DB`, saving sessions to your history instead.) Antigravity
|
|
192
|
+
agents always save conversations under
|
|
193
|
+
`~/.gemini/antigravity-cli/conversations/`. pi, Claude
|
|
190
194
|
Code, and Codex agents save no session, so for them an assistant can
|
|
191
195
|
see the process and the commands it runs, but not the conversation.
|
|
192
196
|
|
|
@@ -219,8 +223,8 @@ usual: it's recorded as failed in `run.json`, and the consolidator
|
|
|
219
223
|
still runs on the other agents' reports. Its usage is what its output
|
|
220
224
|
had reported by then, which may be little or nothing.
|
|
221
225
|
|
|
222
|
-
- **The commands it started.** pi, Claude Code,
|
|
223
|
-
SIGTERM. OpenCode doesn't, and may not exit at all (it didn't within
|
|
226
|
+
- **The commands it started.** pi, Claude Code, Codex, and Antigravity
|
|
227
|
+
stop them on SIGTERM. OpenCode doesn't, and may not exit at all (it didn't within
|
|
224
228
|
5 seconds in a check with 1.19.6); `kill -KILL -48212` then stops it,
|
|
225
229
|
but not its commands, which run in process groups of their own and
|
|
226
230
|
are left running.
|
data/USE_CASES.md
CHANGED
|
@@ -32,8 +32,8 @@ Where a sample prompt exists, it's linked; the samples are in
|
|
|
32
32
|
or periodically to track health over time
|
|
33
33
|
([`state-of-the-code-base-prompt.md`](examples/prompts/state-of-the-code-base-prompt.md)).
|
|
34
34
|
- Due diligence on a library, fork, or acquisition before adopting it
|
|
35
|
-
(in a sandbox; see the README's
|
|
36
|
-
privacy](README.md#safety-and-privacy)).
|
|
35
|
+
(in a sandbox; see [`CAUTIONS.md`](CAUTIONS.md) and the README's
|
|
36
|
+
[Safety and privacy](README.md#safety-and-privacy)).
|
|
37
37
|
- Specific questions about how something works ("what happens when the
|
|
38
38
|
cache is unavailable?"), where agreement builds confidence and
|
|
39
39
|
disagreement shows where to look.
|
|
@@ -110,7 +110,7 @@ saved.
|
|
|
110
110
|
- Comparing providers serving the same model, on latency, price, and
|
|
111
111
|
reliability.
|
|
112
112
|
- Comparing harnesses running the same model (say, pi and Claude Code,
|
|
113
|
-
pi and Codex,
|
|
113
|
+
pi and Codex, pi and OpenCode, or pi and Antigravity), on
|
|
114
114
|
speed, cost, and what they find.
|
|
115
115
|
- Finding out which listed models your plan actually covers.
|
|
116
116
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Sample Google Antigravity ensemble: runs under your own `agy` setup
|
|
2
|
+
# (Google AI subscription, Gemini API key, or Vertex AI — see "Choosing a
|
|
3
|
+
# harness" in the README). Run `agy models` to list available model slugs.
|
|
4
|
+
# `provider` is a label only; use `google` (or `anthropic` / `openai` when
|
|
5
|
+
# selecting non-Gemini models served through Antigravity).
|
|
6
|
+
agents:
|
|
7
|
+
- harness: agy
|
|
8
|
+
provider: google
|
|
9
|
+
model: gemini-4-neon-high
|
|
10
|
+
- harness: agy
|
|
11
|
+
provider: google
|
|
12
|
+
model: gemini-4-carbon-high
|
|
13
|
+
- harness: agy
|
|
14
|
+
provider: anthropic
|
|
15
|
+
model: claude-sonnet-5-5-high
|
|
16
|
+
|
|
17
|
+
consolidator:
|
|
18
|
+
harness: agy
|
|
19
|
+
provider: google
|
|
20
|
+
model: gemini-4-neon-medium
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Sample mixed-harness ensemble: Claude Code, Codex, and
|
|
2
|
-
# alongside pi analysts, with a Claude Code consolidator. Claude Code
|
|
3
|
-
# entries run under your own `claude` and `
|
|
4
|
-
# do (see "Choosing a harness" in the README); pi
|
|
5
|
-
# credentials for their providers. Replace any
|
|
6
|
-
# don't have; "Discovering and configuring models" in the
|
|
7
|
-
# how to find each harness's models.
|
|
1
|
+
# Sample mixed-harness ensemble: Claude Code, Codex, OpenCode, and Antigravity
|
|
2
|
+
# analysts alongside pi analysts, with a Claude Code consolidator. Claude Code,
|
|
3
|
+
# Codex, and Antigravity entries run under your own `claude`, `codex`, and `agy`
|
|
4
|
+
# setups and bill however they do (see "Choosing a harness" in the README); pi
|
|
5
|
+
# and OpenCode entries need credentials for their providers. Replace any
|
|
6
|
+
# provider or model you don't have; "Discovering and configuring models" in the
|
|
7
|
+
# README says how to find each harness's models.
|
|
8
8
|
agents:
|
|
9
9
|
- harness: claude
|
|
10
10
|
provider: anthropic
|
|
@@ -12,6 +12,9 @@ agents:
|
|
|
12
12
|
- harness: codex
|
|
13
13
|
provider: openai
|
|
14
14
|
model: gpt-5.6-terra
|
|
15
|
+
- harness: agy
|
|
16
|
+
provider: google
|
|
17
|
+
model: gemini-4-neon-high
|
|
15
18
|
- harness: pi
|
|
16
19
|
provider: deepseek
|
|
17
20
|
model: deepseek-flash
|
data/exe/agent-council
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# lib/agent_council.rb orchestration (AgentCouncil)
|
|
6
6
|
# lib/agent_council/harnesses.rb harnesses by name (AgentCouncil::Harnesses)
|
|
7
7
|
# lib/agent_council/harnesses/harness.rb the base class every harness subclasses (Harness)
|
|
8
|
-
# lib/agent_council/harnesses/scaffold.rb read-only scaffolding every harness
|
|
8
|
+
# lib/agent_council/harnesses/scaffold.rb read-only scaffolding every harness gives agents
|
|
9
9
|
# lib/agent_council/harnesses/pi_harness.rb pi-specific behavior (AgentCouncil::Harnesses::PiHarness)
|
|
10
10
|
# lib/agent_council/harnesses/claude_code_harness.rb
|
|
11
11
|
# Claude Code-specific behavior (ClaudeCodeHarness)
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
# Codex-specific behavior (CodexHarness)
|
|
14
14
|
# lib/agent_council/harnesses/opencode_harness.rb
|
|
15
15
|
# OpenCode-specific behavior (OpenCodeHarness)
|
|
16
|
+
# lib/agent_council/harnesses/antigravity_harness.rb
|
|
17
|
+
# Antigravity-specific behavior (AntigravityHarness)
|
|
16
18
|
#
|
|
17
19
|
# Usage, options, and AGENT_COUNCIL_OPTS: agent-council -h, and the README.
|
|
18
20
|
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# AgentCouncil::Harnesses::AntigravityHarness — all knowledge specific to
|
|
4
|
+
# the Google Antigravity CLI harness: how to invoke `agy` for one agent,
|
|
5
|
+
# with its session permission denials and the shared read-only scaffolding,
|
|
6
|
+
# and how to read its stream-json output afterward.
|
|
7
|
+
#
|
|
8
|
+
# AgentCouncil is harness-agnostic and finds this class through
|
|
9
|
+
# AgentCouncil::Harnesses (lib/agent_council/harnesses.rb), by its NAME.
|
|
10
|
+
# Authentication and billing are left to Antigravity: an agent uses
|
|
11
|
+
# whatever account or provider `agy` would at the user's terminal (Google AI
|
|
12
|
+
# subscription, Gemini API key, or Vertex AI).
|
|
13
|
+
|
|
14
|
+
require 'json'
|
|
15
|
+
require_relative 'harness'
|
|
16
|
+
|
|
17
|
+
module AgentCouncil
|
|
18
|
+
module Harnesses
|
|
19
|
+
class AntigravityHarness < Harness
|
|
20
|
+
NAME = 'agy'
|
|
21
|
+
|
|
22
|
+
# Session-only permission overrides merged over the user's settings.json
|
|
23
|
+
# (never saved):
|
|
24
|
+
# - write_file(*) withholds the file-editing tools (write_file, edit_file)
|
|
25
|
+
# while preserving the user's allow rules (e.g. MCP servers);
|
|
26
|
+
# - execute_url(*) withholds browser actions that act outside the machine;
|
|
27
|
+
# - download_url(*) withholds direct URL downloads to disk.
|
|
28
|
+
# Shell commands stay governed by the user's agy settings and terminal
|
|
29
|
+
# sandbox (where commands can still write $TMPDIR).
|
|
30
|
+
SETTINGS = JSON.generate(
|
|
31
|
+
'permissions' => { 'deny' => %w[write_file(*) execute_url(*) download_url(*)] }
|
|
32
|
+
).freeze
|
|
33
|
+
|
|
34
|
+
# Invocation for one agent. The prompt is not part of argv: agy's -p
|
|
35
|
+
# flag takes a string argument rather than reading stdin, so we use
|
|
36
|
+
# --input-format stream-json instead (see stdin_data), which reads one
|
|
37
|
+
# NDJSON user message per line and finishes cleanly on EOF. provider is
|
|
38
|
+
# not passed: agy takes none, so an entry's provider only labels the
|
|
39
|
+
# agent. --model comes before --settings so the model slug stays near
|
|
40
|
+
# the start of the command line.
|
|
41
|
+
def self.argv(_provider, model)
|
|
42
|
+
[
|
|
43
|
+
NAME,
|
|
44
|
+
'--input-format', 'stream-json', # NDJSON user message on stdin
|
|
45
|
+
'--output-format', 'stream-json', # JSONL event stream on stdout
|
|
46
|
+
'--disable-slash-commands', # keep prompts starting with '/' literal
|
|
47
|
+
'--model', model,
|
|
48
|
+
'--settings', SETTINGS
|
|
49
|
+
]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# One NDJSON user-message line for --input-format stream-json. agy has
|
|
53
|
+
# no system-prompt flag or settings key, so the shared read-only
|
|
54
|
+
# scaffolding is prepended to the user message.
|
|
55
|
+
def self.stdin_data(prompt)
|
|
56
|
+
str = prompt.to_s
|
|
57
|
+
clean_prompt =
|
|
58
|
+
if str.encoding == Encoding::UTF_8
|
|
59
|
+
str.scrub
|
|
60
|
+
else
|
|
61
|
+
str.encode(Encoding::UTF_8, invalid: :replace, undef: :replace)
|
|
62
|
+
end
|
|
63
|
+
text = "#{Harnesses.scaffold_text}\n\n#{clean_prompt}"
|
|
64
|
+
"#{JSON.generate('event' => 'user', 'message' => { 'content' => text })}\n"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# --- event stream reading ---
|
|
68
|
+
|
|
69
|
+
# The payload hashes for events whose 'event' key equals name, in order.
|
|
70
|
+
# Antigravity keys its stream by 'event' (with the payload under a key
|
|
71
|
+
# of the same name), not by 'type', so Harness.last_event does not apply.
|
|
72
|
+
def self.payloads(jsonl, name)
|
|
73
|
+
events(jsonl).filter_map do |event|
|
|
74
|
+
payload = event[name] if event['event'] == name
|
|
75
|
+
payload if payload.is_a?(Hash)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
private_class_method :payloads
|
|
79
|
+
|
|
80
|
+
# The agent's terminal result payload, or nil if the stream has none
|
|
81
|
+
# (e.g. for an agent killed with SIGKILL).
|
|
82
|
+
def self.result_event(jsonl)
|
|
83
|
+
payloads(jsonl, 'result').last
|
|
84
|
+
end
|
|
85
|
+
private_class_method :result_event
|
|
86
|
+
|
|
87
|
+
# The agent's response steps, grouped by step_index in order, with each
|
|
88
|
+
# step's streamed text_delta fragments joined.
|
|
89
|
+
def self.assistant_messages(jsonl)
|
|
90
|
+
steps = payloads(jsonl, 'step_update').select { |step| step['step_type'] == 'agent_response' }
|
|
91
|
+
steps.group_by { |step| step['step_index'] }.map do |index, group|
|
|
92
|
+
text = group.filter_map { |step| step['text_delta'] if step['text_delta'].is_a?(String) }.join
|
|
93
|
+
{ 'step_index' => index, 'text' => text }
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Finish reasons indicating a run was cut off or failed even if status
|
|
98
|
+
# is reported as "SUCCESS".
|
|
99
|
+
UNUSABLE_FINISH_REASONS = %w[
|
|
100
|
+
print_timeout interrupted error length content-filter max_tokens
|
|
101
|
+
].freeze
|
|
102
|
+
|
|
103
|
+
# The final response: the result payload's text, for an agent that
|
|
104
|
+
# succeeded without an unusable finished_reason.
|
|
105
|
+
def self.final_response(jsonl)
|
|
106
|
+
result = result_event(jsonl)
|
|
107
|
+
return nil unless result && result['status'] == 'SUCCESS'
|
|
108
|
+
return nil if UNUSABLE_FINISH_REASONS.include?(result['finished_reason'])
|
|
109
|
+
|
|
110
|
+
nonblank_text(result['response'])
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Our usage keys, each mapped to Antigravity's name for it. Antigravity's
|
|
114
|
+
# input_tokens excludes cache_read_tokens, and its output_tokens includes
|
|
115
|
+
# thinking_tokens; it reports neither cache writes nor cost.
|
|
116
|
+
USAGE_KEYS = { 'input' => 'input_tokens',
|
|
117
|
+
'output' => 'output_tokens',
|
|
118
|
+
'cache_read' => 'cache_read_tokens' }.freeze
|
|
119
|
+
|
|
120
|
+
# Token usage as AgentCouncil expects it (see Harness), from the
|
|
121
|
+
# terminal result event alone: it totals all steps in the run, whereas
|
|
122
|
+
# step_update usage is per-step. Antigravity prices nothing, so there is
|
|
123
|
+
# no 'cost'. nil when the stream has no result event or reports no usage.
|
|
124
|
+
def self.usage(jsonl)
|
|
125
|
+
result = result_event(jsonl)
|
|
126
|
+
usage = result && result['usage']
|
|
127
|
+
return nil unless usage.is_a?(Hash)
|
|
128
|
+
|
|
129
|
+
totals = USAGE_KEYS.transform_values { |key| count(usage[key]) }.merge('cache_write' => 0)
|
|
130
|
+
usage_result(totals)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Why the agent produced no usable report, or nil. A failed or
|
|
134
|
+
# interrupted run has a result event with status other than "SUCCESS"
|
|
135
|
+
# (e.g. "ERROR") or an unusable finished_reason; one that succeeded
|
|
136
|
+
# with no text is reported as such (noting any refused actions).
|
|
137
|
+
def self.error_message(jsonl)
|
|
138
|
+
result = result_event(jsonl)
|
|
139
|
+
return agy_error_line(jsonl) || 'the stream has no result event' unless result
|
|
140
|
+
|
|
141
|
+
unless result['status'] == 'SUCCESS'
|
|
142
|
+
return error_reason(result) || missing_reason(result)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
reason = result['finished_reason']
|
|
146
|
+
return "stopped early (reason: #{reason})" if UNUSABLE_FINISH_REASONS.include?(reason)
|
|
147
|
+
return nil if nonblank_text(result['response'])
|
|
148
|
+
|
|
149
|
+
actions = denied_action_names(result)
|
|
150
|
+
return "the result event has no text (refused: #{actions.join(', ')})" unless actions.empty?
|
|
151
|
+
|
|
152
|
+
'the result event has no text'
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# An AGY_ERROR line emitted when agy fails without a result event (e.g.
|
|
156
|
+
# on stderr for print-timeout or startup errors). Extracts short_error
|
|
157
|
+
# (or message/error/status/code) from a JSON payload after "AGY_ERROR:"
|
|
158
|
+
# when present, else returns the stripped line.
|
|
159
|
+
def self.agy_error_line(text)
|
|
160
|
+
line = text.each_line.map(&:strip).find { |l| l.start_with?('AGY_ERROR') }
|
|
161
|
+
return nil unless line
|
|
162
|
+
|
|
163
|
+
payload = line.sub(/\AAGY_ERROR:?\s*/, '')
|
|
164
|
+
parsed = begin
|
|
165
|
+
JSON.parse(payload)
|
|
166
|
+
rescue JSON::ParserError
|
|
167
|
+
nil
|
|
168
|
+
end
|
|
169
|
+
if parsed.is_a?(Hash)
|
|
170
|
+
keys = %w[short_error message error status code]
|
|
171
|
+
return nonblank_strings(keys.map { |k| parsed[k] }).first || line
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
line
|
|
175
|
+
end
|
|
176
|
+
private_class_method :agy_error_line
|
|
177
|
+
|
|
178
|
+
# The reason a failed result payload gives, or nil if it gives none.
|
|
179
|
+
# Falls back to finished_reason when error is blank.
|
|
180
|
+
def self.error_reason(result)
|
|
181
|
+
error = nonblank_text(result['error'])&.strip
|
|
182
|
+
return error if error
|
|
183
|
+
|
|
184
|
+
reason = nonblank_text(result['finished_reason'])&.strip
|
|
185
|
+
"stopped early (reason: #{reason})" if reason
|
|
186
|
+
end
|
|
187
|
+
private_class_method :error_reason
|
|
188
|
+
|
|
189
|
+
def self.missing_reason(result)
|
|
190
|
+
return 'the result event has no status' unless nonblank_text(result['status'])
|
|
191
|
+
|
|
192
|
+
'the agent failed and gave no reason'
|
|
193
|
+
end
|
|
194
|
+
private_class_method :missing_reason
|
|
195
|
+
|
|
196
|
+
# Why an agent that exited nonzero failed. Antigravity explains failures
|
|
197
|
+
# (unknown model, interruption, auth/quota errors) in a result event with
|
|
198
|
+
# status != "SUCCESS", so that comes first; otherwise an AGY_ERROR line
|
|
199
|
+
# on stderr or stdout, then stderr's first line, then any stream-level
|
|
200
|
+
# error (e.g. a blank result), else NO_ERROR_OUTPUT.
|
|
201
|
+
def self.exit_detail(stdout, stderr)
|
|
202
|
+
result = result_event(stdout)
|
|
203
|
+
reason = error_reason(result) if result && result['status'] != 'SUCCESS'
|
|
204
|
+
return reason if reason
|
|
205
|
+
|
|
206
|
+
agy_error_line(stderr) ||
|
|
207
|
+
agy_error_line(stdout) ||
|
|
208
|
+
first_line(stderr) ||
|
|
209
|
+
(error_message(stdout) if result) ||
|
|
210
|
+
NO_ERROR_OUTPUT
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Warnings about an agent, succeeded or not: the tool calls Antigravity
|
|
214
|
+
# soft-denied because headless mode cannot prompt for approval, reported
|
|
215
|
+
# in the result event's denied_actions list.
|
|
216
|
+
def self.warnings(jsonl)
|
|
217
|
+
result = result_event(jsonl)
|
|
218
|
+
denials = result && result['denied_actions']
|
|
219
|
+
return [] unless denials.is_a?(Array) && !denials.empty?
|
|
220
|
+
|
|
221
|
+
actions = denied_action_names(result)
|
|
222
|
+
[listing("Antigravity refused #{denials.size} tool call#{'s' unless denials.size == 1}",
|
|
223
|
+
actions, MAX_LISTED_ACTIONS)]
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Distinct refused actions named in a warning, so an agent refused many
|
|
227
|
+
# times still gets a warning of a readable length.
|
|
228
|
+
MAX_LISTED_ACTIONS = 5
|
|
229
|
+
|
|
230
|
+
# Distinct labels for a result event's denied_actions list, in order.
|
|
231
|
+
def self.denied_action_names(result)
|
|
232
|
+
denials = result && result['denied_actions']
|
|
233
|
+
return [] unless denials.is_a?(Array)
|
|
234
|
+
|
|
235
|
+
denials.map { |denial| denied_action(denial) }.uniq
|
|
236
|
+
end
|
|
237
|
+
private_class_method :denied_action_names
|
|
238
|
+
|
|
239
|
+
# A refused action's label: its display_name (e.g. "Bash"), else its
|
|
240
|
+
# action key (e.g. "command"), else "unknown tool".
|
|
241
|
+
def self.denied_action(denial)
|
|
242
|
+
return 'unknown tool' unless denial.is_a?(Hash)
|
|
243
|
+
|
|
244
|
+
nonblank_strings([denial['display_name'], denial['action']]).first || 'unknown tool'
|
|
245
|
+
end
|
|
246
|
+
private_class_method :denied_action
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
end
|
|
@@ -41,6 +41,14 @@ module AgentCouncil
|
|
|
41
41
|
{}
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
+
# The bytes run_agent pipes to the harness's stdin for prompt; by
|
|
45
|
+
# default the prompt itself. A harness whose CLI takes structured input
|
|
46
|
+
# on stdin (or has no system-prompt flag for the scaffolding) overrides
|
|
47
|
+
# this.
|
|
48
|
+
def self.stdin_data(prompt)
|
|
49
|
+
prompt
|
|
50
|
+
end
|
|
51
|
+
|
|
44
52
|
# The agent's token usage as AgentCouncil records it, summed over all
|
|
45
53
|
# its requests: integer 'input' (excluding cached input), 'output',
|
|
46
54
|
# 'cache_read', and 'cache_write', plus 'cost' in US dollars when the
|
|
@@ -46,8 +46,8 @@ module AgentCouncil
|
|
|
46
46
|
|
|
47
47
|
# Variables for the agent's process, beside TMPDIR:
|
|
48
48
|
# - OPENCODE_DB, a database in the scratch dir, so the session is
|
|
49
|
-
# deleted with it when the agent finishes (
|
|
50
|
-
# save none), and concurrent agents don't share one database.
|
|
49
|
+
# deleted with it when the agent finishes (pi, Claude Code, and Codex
|
|
50
|
+
# save none either), and concurrent agents don't share one database.
|
|
51
51
|
# - OPENCODE_CONFIG_CONTENT, which OpenCode merges over the user's and
|
|
52
52
|
# the project's config (replacing a user's own value):
|
|
53
53
|
# - the scaffolding, as an instructions file;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# AgentCouncil::Harnesses.scaffold_text — the read-only scaffolding every
|
|
4
|
-
# harness
|
|
4
|
+
# harness gives its agents (appended to the system prompt, or prepended to
|
|
5
|
+
# the user message for Antigravity). Required by Harness
|
|
5
6
|
# (harnesses/harness.rb), so each harness has it without the harness
|
|
6
7
|
# registry (lib/agent_council/harnesses.rb), which requires the harnesses.
|
|
7
8
|
|
|
8
9
|
module AgentCouncil
|
|
9
10
|
module Harnesses
|
|
10
|
-
# Scaffolding
|
|
11
|
+
# Scaffolding given to every harness's agents (appended to the system
|
|
12
|
+
# prompt, or prepended to the user message for Antigravity), identical for
|
|
11
13
|
# every agent. It names the scratch dir as $TMPDIR, not by path: Claude
|
|
12
14
|
# Code's sandbox makes the dir itself read-only and points TMPDIR at a
|
|
13
15
|
# writable dir inside it.
|
|
@@ -12,10 +12,13 @@ require_relative 'harnesses/pi_harness'
|
|
|
12
12
|
require_relative 'harnesses/claude_code_harness'
|
|
13
13
|
require_relative 'harnesses/codex_harness'
|
|
14
14
|
require_relative 'harnesses/opencode_harness'
|
|
15
|
+
require_relative 'harnesses/antigravity_harness'
|
|
15
16
|
|
|
16
17
|
module AgentCouncil
|
|
17
18
|
module Harnesses
|
|
18
|
-
BY_NAME = [
|
|
19
|
+
BY_NAME = [
|
|
20
|
+
PiHarness, ClaudeCodeHarness, CodexHarness, OpenCodeHarness, AntigravityHarness
|
|
21
|
+
].to_h do |harness|
|
|
19
22
|
[harness::NAME, harness]
|
|
20
23
|
end.freeze
|
|
21
24
|
|
|
@@ -15,7 +15,7 @@ module AgentCouncil
|
|
|
15
15
|
# the grace period for the workers to finish, and SIGKILLs agents still
|
|
16
16
|
# running. The commands an agent's shell tool started run in process
|
|
17
17
|
# groups of their own, which these signals don't reach; pi, Claude
|
|
18
|
-
# Code, and
|
|
18
|
+
# Code, Codex, and Antigravity stop them on SIGTERM, but OpenCode doesn't, and an
|
|
19
19
|
# agent that is SIGKILLed can't, so they may keep running. A second
|
|
20
20
|
# trapped signal other than HUP SIGKILLs them at once. Any HUP after the first signal is
|
|
21
21
|
# ignored: a closing terminal can deliver two at once (one forwarded by the
|
data/lib/agent_council.rb
CHANGED
|
@@ -179,11 +179,12 @@ module AgentCouncil
|
|
|
179
179
|
scratch_dir = Dir.mktmpdir('agent-council-')
|
|
180
180
|
argv = harness.argv(provider, model)
|
|
181
181
|
env = agent_env(scratch_dir, harness)
|
|
182
|
+
stdin = harness.stdin_data(prompt)
|
|
182
183
|
(stdout, stderr, status), elapsed = timed do
|
|
183
184
|
if pool
|
|
184
|
-
pool.capture3(env, *argv, stdin_data:
|
|
185
|
+
pool.capture3(env, *argv, stdin_data: stdin, tag: label)
|
|
185
186
|
else
|
|
186
|
-
Open3.capture3(env, *argv, stdin_data:
|
|
187
|
+
Open3.capture3(env, *argv, stdin_data: stdin)
|
|
187
188
|
end
|
|
188
189
|
end
|
|
189
190
|
# Harness output is UTF-8. WorkerPool#capture3 already returns it as such,
|
|
@@ -247,9 +248,9 @@ module AgentCouncil
|
|
|
247
248
|
|
|
248
249
|
# The harness's warnings about an agent: what the harness kept it
|
|
249
250
|
# from doing, or errors it hit without failing (see
|
|
250
|
-
# ClaudeCodeHarness.warnings, CodexHarness.warnings,
|
|
251
|
-
# OpenCodeHarness.warnings), which a report
|
|
252
|
-
# why the agent failed. Advisory only: failing to read them must not
|
|
251
|
+
# ClaudeCodeHarness.warnings, CodexHarness.warnings,
|
|
252
|
+
# OpenCodeHarness.warnings, and AntigravityHarness.warnings), which a report
|
|
253
|
+
# may lack, or which may be why the agent failed. Advisory only: failing to read them must not
|
|
253
254
|
# fail an agent whose report is saved, so that becomes a warning too.
|
|
254
255
|
# Each is a plain_line, so wherever it goes (console, report, run.json,
|
|
255
256
|
# and so anything that prints run.json's values) it can't carry a
|
|
@@ -350,8 +351,9 @@ module AgentCouncil
|
|
|
350
351
|
[fields, match.post_match]
|
|
351
352
|
end
|
|
352
353
|
|
|
353
|
-
# The
|
|
354
|
-
#
|
|
354
|
+
# The substantive prompt for each analyst harness (piped verbatim unless the
|
|
355
|
+
# harness overrides stdin_data): the user's prompt, less one trailing
|
|
356
|
+
# newline, then a blank line and the report-format addendum.
|
|
355
357
|
module_function def compose_analyst_prompt(prompt, addendum)
|
|
356
358
|
"#{prompt.chomp}\n\n#{addendum}"
|
|
357
359
|
end
|
|
@@ -581,8 +583,8 @@ module AgentCouncil
|
|
|
581
583
|
<<~TABLE
|
|
582
584
|
### Sources
|
|
583
585
|
|
|
584
|
-
| Source | Duration | Input | Cached | Output | Cost |
|
|
585
|
-
| :----- | -------: | ----: | -----: | -----: |
|
|
586
|
+
| Source | Duration | Input | Cached | Output | Est. Cost |
|
|
587
|
+
| :----- | -------: | ----: | -----: | -----: | --------: |
|
|
586
588
|
#{rows.join("\n")}
|
|
587
589
|
TABLE
|
|
588
590
|
end
|
|
@@ -792,7 +794,7 @@ module AgentCouncil
|
|
|
792
794
|
[result, Process.clock_gettime(Process::CLOCK_MONOTONIC) - started]
|
|
793
795
|
end
|
|
794
796
|
|
|
795
|
-
RESULT_HEADINGS =
|
|
797
|
+
RESULT_HEADINGS = ['Ok', 'Duration', 'Agent', 'In', 'Cached', 'Out', 'Est. Cost'].freeze
|
|
796
798
|
# The usage columns, right-aligned so their figures line up.
|
|
797
799
|
RIGHT_ALIGNED_COLUMNS = (3..6)
|
|
798
800
|
|
|
@@ -1030,6 +1032,7 @@ module AgentCouncil
|
|
|
1030
1032
|
agent-council --consolidate RUN_DIR
|
|
1031
1033
|
Repository: #{PROJECT_URL}
|
|
1032
1034
|
Documentation (Local): #{File.join(PROJECT_ROOT, 'README.md')}
|
|
1035
|
+
Cautions (Local): #{File.join(PROJECT_ROOT, 'CAUTIONS.md')}
|
|
1033
1036
|
Examples (Local): #{EXAMPLES_DIR}
|
|
1034
1037
|
Version: #{VERSION}
|
|
1035
1038
|
-------------------------------------------------------------------------------
|
|
@@ -1040,6 +1043,8 @@ module AgentCouncil
|
|
|
1040
1043
|
RUN_DIR With --consolidate, a finished run's directory (no PROMPT_FILE or CONFIG_FILE)
|
|
1041
1044
|
|
|
1042
1045
|
Agents analyze the current directory: run from the project to be analyzed.
|
|
1046
|
+
agent-council does not sandbox agents; they get shell access and send what
|
|
1047
|
+
they read to providers. Costs are rough estimates. Read CAUTIONS.md first.
|
|
1043
1048
|
|
|
1044
1049
|
Options:
|
|
1045
1050
|
BANNER
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: agent-council
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Keith R. Bennett
|
|
@@ -11,13 +11,13 @@ date: 1980-01-02 00:00:00.000000000 Z
|
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: |-
|
|
13
13
|
AgentCouncil runs the same prompt through several AI coding agents on your
|
|
14
|
-
project, under the pi, OpenCode, Claude Code, or
|
|
14
|
+
project, under the pi, OpenCode, Claude Code, Codex, or Antigravity harness, with any mix of harnesses,
|
|
15
15
|
providers, and models, and saves each agent's final response as a
|
|
16
16
|
Markdown report. A consolidating agent then combines the reports into a
|
|
17
17
|
findings report of consensus findings, unique findings, and
|
|
18
18
|
contradictions, ready to paste into an AI chat, and a companion report
|
|
19
19
|
that assesses each agent's work and lists its duration, token usage, and
|
|
20
|
-
cost.
|
|
20
|
+
estimated cost.
|
|
21
21
|
email:
|
|
22
22
|
- keithrbennett@gmail.com
|
|
23
23
|
executables:
|
|
@@ -27,6 +27,7 @@ executables:
|
|
|
27
27
|
extensions: []
|
|
28
28
|
extra_rdoc_files: []
|
|
29
29
|
files:
|
|
30
|
+
- CAUTIONS.md
|
|
30
31
|
- DESIGN.md
|
|
31
32
|
- INSTALL.md
|
|
32
33
|
- LICENSE.txt
|
|
@@ -34,6 +35,7 @@ files:
|
|
|
34
35
|
- RELEASE_NOTES.md
|
|
35
36
|
- RUNAWAY_AGENTS.md
|
|
36
37
|
- USE_CASES.md
|
|
38
|
+
- examples/configs/antigravity.yml
|
|
37
39
|
- examples/configs/consolidated.yml
|
|
38
40
|
- examples/configs/mixed-harness.yml
|
|
39
41
|
- examples/configs/single.yml
|
|
@@ -51,6 +53,7 @@ files:
|
|
|
51
53
|
- exe/pi-models
|
|
52
54
|
- lib/agent_council.rb
|
|
53
55
|
- lib/agent_council/harnesses.rb
|
|
56
|
+
- lib/agent_council/harnesses/antigravity_harness.rb
|
|
54
57
|
- lib/agent_council/harnesses/claude_code_harness.rb
|
|
55
58
|
- lib/agent_council/harnesses/codex_harness.rb
|
|
56
59
|
- lib/agent_council/harnesses/harness.rb
|
|
@@ -73,7 +76,7 @@ licenses:
|
|
|
73
76
|
metadata:
|
|
74
77
|
source_code_uri: https://github.com/keithrbennett/agent-council
|
|
75
78
|
changelog_uri: https://github.com/keithrbennett/agent-council/blob/main/RELEASE_NOTES.md
|
|
76
|
-
documentation_uri: https://github.com/keithrbennett/agent-council/tree/v0.
|
|
79
|
+
documentation_uri: https://github.com/keithrbennett/agent-council/tree/v0.5.0
|
|
77
80
|
bug_tracker_uri: https://github.com/keithrbennett/agent-council/issues
|
|
78
81
|
rubygems_mfa_required: 'true'
|
|
79
82
|
rdoc_options: []
|
|
@@ -95,5 +98,5 @@ specification_version: 4
|
|
|
95
98
|
summary: Run one prompt through several AI coding agents on your project and get a
|
|
96
99
|
consolidated report of their consensus findings, unique findings, and contradictions.
|
|
97
100
|
A companion report assesses each agent's work and lists its duration, token usage,
|
|
98
|
-
and cost. Each agent's own report is saved too.
|
|
101
|
+
and estimated cost. Each agent's own report is saved too.
|
|
99
102
|
test_files: []
|