@cursor/july 0.1.5 → 0.1.7
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.
- package/dist/ab.d.ts +8 -95
- package/dist/ab.d.ts.map +1 -1
- package/dist/ab.js +9 -150
- package/dist/bin/agent-serve.js +41 -8
- package/dist/channels/slack/post-update-delivery.d.ts +85 -0
- package/dist/channels/slack/post-update-delivery.d.ts.map +1 -0
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.DabPG-io.js → app.COTN7wgo.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.B7UcKvIn.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.jmyr0bU0.js → VPLocalSearchBox.BW3TBdT0.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DysN9-VN.js → theme.BEJW0vE7.js} +2 -2
- package/dist/docs/assets/deployment.md.BtfEsc9S.js +55 -0
- package/dist/docs/assets/deployment.md.BtfEsc9S.lean.js +1 -0
- package/dist/docs/assets/example-agents_approval-buddy.md.8R5phXb5.js +10 -0
- package/dist/docs/assets/example-agents_approval-buddy.md.8R5phXb5.lean.js +1 -0
- package/dist/docs/assets/example-agents_benny.md.B0gjhI-p.js +7 -0
- package/dist/docs/assets/example-agents_benny.md.B0gjhI-p.lean.js +1 -0
- package/dist/docs/assets/example-agents_bugbot.md.DelIdhxB.js +11 -0
- package/dist/docs/assets/example-agents_bugbot.md.DelIdhxB.lean.js +1 -0
- package/dist/docs/assets/example-agents_codebase-wiki.md.DC6sgwn0.js +8 -0
- package/dist/docs/assets/example-agents_codebase-wiki.md.DC6sgwn0.lean.js +1 -0
- package/dist/docs/assets/example-agents_codeowners-review.md.Ku_tG2RY.js +8 -0
- package/dist/docs/assets/example-agents_codeowners-review.md.Ku_tG2RY.lean.js +1 -0
- package/dist/docs/assets/example-agents_concierge.md.4rQTSMXt.js +23 -0
- package/dist/docs/assets/example-agents_concierge.md.4rQTSMXt.lean.js +1 -0
- package/dist/docs/assets/example-agents_fsd.md.CzgUrDfi.js +15 -0
- package/dist/docs/assets/example-agents_fsd.md.CzgUrDfi.lean.js +1 -0
- package/dist/docs/assets/example-agents_index.md.CRqJlnIf.js +2 -0
- package/dist/docs/assets/example-agents_index.md.CRqJlnIf.lean.js +1 -0
- package/dist/docs/assets/example-agents_knowledge-base.md.BPJiVueF.js +11 -0
- package/dist/docs/assets/example-agents_knowledge-base.md.BPJiVueF.lean.js +1 -0
- package/dist/docs/assets/example-agents_security-reviewer.md.D2rtwDTO.js +19 -0
- package/dist/docs/assets/example-agents_security-reviewer.md.D2rtwDTO.lean.js +1 -0
- package/dist/docs/assets/example-agents_slack-agent.md.buLbgvBf.js +5 -0
- package/dist/docs/assets/example-agents_slack-agent.md.buLbgvBf.lean.js +1 -0
- package/dist/docs/assets/example-agents_weather-agent.md.C9Qv-W0o.js +24 -0
- package/dist/docs/assets/example-agents_weather-agent.md.C9Qv-W0o.lean.js +1 -0
- package/dist/docs/assets/index.md.COiu-1jL.js +20 -0
- package/dist/docs/assets/{index.md.Cylk70gg.lean.js → index.md.COiu-1jL.lean.js} +1 -1
- package/dist/docs/assets/reference_cli.md.D189RBCH.js +60 -0
- package/dist/docs/assets/reference_cli.md.D189RBCH.lean.js +1 -0
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +4 -4
- package/dist/docs/deployment.html +58 -17
- package/dist/docs/evals.html +4 -4
- package/dist/docs/example-agents/approval-buddy.html +34 -0
- package/dist/docs/example-agents/benny.html +31 -0
- package/dist/docs/example-agents/bugbot.html +35 -0
- package/dist/docs/example-agents/codebase-wiki.html +32 -0
- package/dist/docs/example-agents/codeowners-review.html +32 -0
- package/dist/docs/example-agents/concierge.html +47 -0
- package/dist/docs/example-agents/fsd.html +39 -0
- package/dist/docs/example-agents/index.html +26 -0
- package/dist/docs/example-agents/knowledge-base.html +35 -0
- package/dist/docs/example-agents/security-reviewer.html +43 -0
- package/dist/docs/example-agents/slack-agent.html +29 -0
- package/dist/docs/example-agents/weather-agent.html +48 -0
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-runtime.html +5 -5
- package/dist/docs/guides/github.html +4 -4
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/slack.html +4 -4
- package/dist/docs/guides/webhooks.html +4 -4
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +4 -4
- package/dist/docs/index.html +7 -7
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +4 -4
- package/dist/docs/reference/channels.html +4 -4
- package/dist/docs/reference/cli.html +52 -30
- package/dist/docs/reference/connections.html +4 -4
- package/dist/docs/reference/hooks.html +4 -4
- package/dist/docs/reference/http-api.html +4 -4
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +4 -4
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +4 -4
- package/dist/docs/scaffolding-agents.html +4 -4
- package/dist/docs/storage.html +4 -4
- package/dist/docs/troubleshooting.html +4 -4
- package/dist/evals.d.ts +5 -62
- package/dist/evals.d.ts.map +1 -1
- package/dist/evals.js +3 -66
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/ab-collector.d.ts +7 -5
- package/dist/internal/ab-collector.d.ts.map +1 -1
- package/dist/internal/ab-collector.js +3 -14
- package/dist/internal/ab-snapshot.d.ts +2 -4
- package/dist/internal/ab-snapshot.d.ts.map +1 -1
- package/dist/internal/cli-ax.d.ts +33 -5
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +428 -87
- package/dist/internal/cli-deploy.js +1 -1
- package/dist/internal/discovery.js +3 -3
- package/dist/internal/eval-run-store.d.ts +35 -30
- package/dist/internal/eval-run-store.d.ts.map +1 -1
- package/dist/internal/eval-run-store.js +88 -100
- package/dist/internal/evals-client.d.ts +96 -0
- package/dist/internal/evals-client.d.ts.map +1 -0
- package/dist/internal/evals-client.js +262 -0
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +1 -0
- package/dist/internal/persistence-coordinator.d.ts +127 -0
- package/dist/internal/persistence-coordinator.d.ts.map +1 -0
- package/dist/internal/playground-proxy.d.ts +5 -5
- package/dist/internal/playground-proxy.js +3 -3
- package/dist/internal/resolve-prod-target.d.ts +30 -0
- package/dist/internal/resolve-prod-target.d.ts.map +1 -1
- package/dist/internal/resolve-prod-target.js +74 -2
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +16 -5
- package/dist/internal/session-engine.d.ts +1 -2
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +14 -31
- package/dist/internal/storage-coordinator.d.ts +16 -15
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +73 -80
- package/dist/persistence.d.ts +184 -0
- package/dist/persistence.d.ts.map +1 -0
- package/dist/playground/assets/cursor-icons-16-CQ50JpfO.woff2 +0 -0
- package/dist/playground/assets/index-72vCOBWO.js +86 -0
- package/dist/playground/assets/index-BjnMwYoR.css +1 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage.d.ts +51 -10
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +27 -10
- package/docs/README.md +34 -5
- package/docs/deployment.md +352 -149
- package/docs/example-agents/approval-buddy.md +270 -0
- package/docs/example-agents/benny.md +186 -0
- package/docs/example-agents/bugbot.md +231 -0
- package/docs/example-agents/codebase-wiki.md +174 -0
- package/docs/example-agents/codeowners-review.md +195 -0
- package/docs/example-agents/concierge.md +205 -0
- package/docs/example-agents/fsd.md +330 -0
- package/docs/example-agents/index.md +102 -0
- package/docs/example-agents/knowledge-base.md +171 -0
- package/docs/example-agents/security-reviewer.md +296 -0
- package/docs/example-agents/slack-agent.md +146 -0
- package/docs/example-agents/weather-agent.md +302 -0
- package/docs/reference/cli.md +546 -147
- package/package.json +1 -1
- package/src/ab.ts +9 -261
- package/src/bin/agent-serve.ts +46 -7
- package/src/evals.ts +5 -119
- package/src/index.ts +2 -0
- package/src/internal/ab-collector.ts +12 -22
- package/src/internal/ab-snapshot.ts +2 -4
- package/src/internal/cli-ax.ts +551 -104
- package/src/internal/cli-deploy.ts +1 -1
- package/src/internal/discovery.ts +2 -2
- package/src/internal/eval-run-store.ts +91 -100
- package/src/internal/evals-client.ts +431 -0
- package/src/internal/init-project.ts +1 -0
- package/src/internal/playground-proxy.ts +5 -5
- package/src/internal/resolve-prod-target.ts +101 -3
- package/src/internal/server.ts +17 -3
- package/src/internal/session-engine.ts +9 -29
- package/src/internal/storage-coordinator.ts +109 -101
- package/src/storage.ts +79 -14
- package/dist/docs/assets/chunks/@localSearchIndexroot.QwK5BtEH.js +0 -1
- package/dist/docs/assets/deployment.md.DTKwE15Z.js +0 -14
- package/dist/docs/assets/deployment.md.DTKwE15Z.lean.js +0 -1
- package/dist/docs/assets/index.md.Cylk70gg.js +0 -20
- package/dist/docs/assets/reference_cli.md.Bv6pOxcF.js +0 -38
- package/dist/docs/assets/reference_cli.md.Bv6pOxcF.lean.js +0 -1
- package/dist/internal/json-dir-store.js +0 -100
- package/dist/playground/assets/cursor-icons-outline-BxTT_FVJ.woff2 +0 -0
- package/dist/playground/assets/index-BEauYlII.css +0 -1
- package/dist/playground/assets/index-BtM0wEGg.js +0 -319
- package/src/internal/json-dir-store.ts +0 -109
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Run staged security reviews from GitHub events"
|
|
3
|
+
description: "Orchestrate parallel reviewer agents, streamed triage, deterministic stages, live playground progress, durable sessions, and severity A/B metrics."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Run staged security reviews from GitHub events
|
|
7
|
+
|
|
8
|
+
Security Reviewer turns a pull request into a staged host-side review. One
|
|
9
|
+
tool prepares the diff and selects modules. A second fans out specialized
|
|
10
|
+
reviewers and triages candidates as they arrive. A third deduplicates the
|
|
11
|
+
confirmed findings, writes artifacts, and may publish a GitHub review.
|
|
12
|
+
|
|
13
|
+
Use this example when the workflow needs several model workers, but the host
|
|
14
|
+
must own orchestration, progress, artifacts, and the final write.
|
|
15
|
+
|
|
16
|
+
[Browse the Security Reviewer source.](../../examples/security-reviewer/)
|
|
17
|
+
|
|
18
|
+
## Run a three-stage host pipeline
|
|
19
|
+
|
|
20
|
+
Security Reviewer is a pipeline, not one long agent turn:
|
|
21
|
+
|
|
22
|
+
| Stage | Tool | Result |
|
|
23
|
+
| --- | --- | --- |
|
|
24
|
+
| Prepare | `prepare_review` | Fetch metadata and diff, create a `runId`, and select security modules. |
|
|
25
|
+
| Review and triage | `run_reviewers` | Run module reviewers in parallel and start triage as each candidate arrives. |
|
|
26
|
+
| Finalize | `finalize_review` | Apply thresholds, deduplicate findings, write artifacts, and optionally post a review. |
|
|
27
|
+
|
|
28
|
+
`run_triage` remains available as a compatibility stage. In the normal flow,
|
|
29
|
+
triage has already completed inside `run_reviewers`, so it reports existing
|
|
30
|
+
results. If candidates exist without triage output, it starts triage workers
|
|
31
|
+
and writes their state.
|
|
32
|
+
|
|
33
|
+
The configured root agent chooses and sequences tools in chat. The review
|
|
34
|
+
workers use a model selected by the host pipeline. They are
|
|
35
|
+
created programmatically with the agent SDK, not discovered from
|
|
36
|
+
`agent/subagents/`.
|
|
37
|
+
|
|
38
|
+
## Follow a GitHub wake
|
|
39
|
+
|
|
40
|
+
1. A non-draft `pull_request.opened` or `pull_request.synchronize` event
|
|
41
|
+
arrives for an allowlisted repository.
|
|
42
|
+
2. The GitHub channel returns a host `{ task }`, so the webhook gets a 202
|
|
43
|
+
response before the long review starts.
|
|
44
|
+
3. Host code tries to post a pending commit status and creates a playground
|
|
45
|
+
session.
|
|
46
|
+
4. The root model sends one acknowledgement. It doesn't run review tools on
|
|
47
|
+
this path.
|
|
48
|
+
5. The task calls `prepare_review`, `run_reviewers`, and `finalize_review`
|
|
49
|
+
deterministically inside that session.
|
|
50
|
+
6. Reviewer candidates stream into duplicate gating and triage.
|
|
51
|
+
7. Finalization writes artifacts and tries to post the GitHub review.
|
|
52
|
+
8. The host tries to set a success commit status when no findings remain, a
|
|
53
|
+
failure status when findings remain, or an error status when the pipeline
|
|
54
|
+
throws.
|
|
55
|
+
9. The final response is appended to the session as an assistant message.
|
|
56
|
+
|
|
57
|
+
The session records each stage as a normal tool event, even though host code
|
|
58
|
+
selected the tools.
|
|
59
|
+
|
|
60
|
+
Review and status posting are best-effort. The channel chooses its final
|
|
61
|
+
status from the finding count even when the review posting result says
|
|
62
|
+
`posted: false`.
|
|
63
|
+
|
|
64
|
+
## Map the framework features
|
|
65
|
+
|
|
66
|
+
| Capability | Source | Role |
|
|
67
|
+
| --- | --- | --- |
|
|
68
|
+
| Root agent | [`agent/agent.ts`](../../examples/security-reviewer/agent/agent.ts), [`agent/instructions.md`](../../examples/security-reviewer/agent/instructions.md) | Configure local chat and explain the three-stage contract. |
|
|
69
|
+
| Server tools | [`agent/tools/`](../../examples/security-reviewer/agent/tools/) | Expose each review stage to chat and host orchestration. |
|
|
70
|
+
| GitHub channel | [`agent/channels/github.ts`](../../examples/security-reviewer/agent/channels/github.ts) | Filter wakes, run background tasks, and publish status. |
|
|
71
|
+
| Progress channel | [`agent/channels/asr-progress.ts`](../../examples/security-reviewer/agent/channels/asr-progress.ts) | Serve live reviewer and triage state by `runId`. |
|
|
72
|
+
| Playground renderer | [`agent/playground/tools/run_reviewers.tsx`](../../examples/security-reviewer/agent/playground/tools/run_reviewers.tsx) | Replace the generic tool chip with live module rows. |
|
|
73
|
+
| SDK review pipeline | [`agent/lib/asr/`](../../examples/security-reviewer/agent/lib/asr/), [`review-stages.ts`](../../examples/security-reviewer/agent/lib/review-stages.ts) | Select modules, call model workers, triage, deduplicate, and write artifacts. |
|
|
74
|
+
| Storage | [`agent/storage.ts`](../../examples/security-reviewer/agent/storage.ts) | Persist framework sessions through a custom adapter with lazy restore. |
|
|
75
|
+
| A/B | [`agent/ab.ts`](../../examples/security-reviewer/agent/ab.ts), [`agent/ab.config.ts`](../../examples/security-reviewer/agent/ab.config.ts) | Compare all-severity versus high-only GitHub comments. |
|
|
76
|
+
| Eval | [`evals/`](../../examples/security-reviewer/evals/) | Check stage-tool presence against a pinned sample. |
|
|
77
|
+
|
|
78
|
+
There is no Slack channel, authored skill, discovered subagent, MCP
|
|
79
|
+
connection, schedule, reminder, hook, tool approval, or cloud runtime.
|
|
80
|
+
|
|
81
|
+
## Prepare the host
|
|
82
|
+
|
|
83
|
+
You need:
|
|
84
|
+
|
|
85
|
+
- Node 22.13 or newer.
|
|
86
|
+
- An agent-runtime credential for the root turn and review workers.
|
|
87
|
+
- GitHub read access for preparation.
|
|
88
|
+
- GitHub write access for webhook-driven reviews and commit statuses.
|
|
89
|
+
|
|
90
|
+
The pipeline exposes settings for:
|
|
91
|
+
|
|
92
|
+
- the worker model,
|
|
93
|
+
- reviewer and triage parallelism,
|
|
94
|
+
- reviewer, triage, duplicate-gate, and final-dedupe timeouts, and
|
|
95
|
+
- prior-comment loading.
|
|
96
|
+
|
|
97
|
+
The active names live beside the orchestration in
|
|
98
|
+
[`review-stages.ts`](../../examples/security-reviewer/agent/lib/review-stages.ts).
|
|
99
|
+
|
|
100
|
+
## Validate the discovered agent
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
agentkit validate --dir examples/security-reviewer
|
|
104
|
+
agentkit info --dir examples/security-reviewer --json
|
|
105
|
+
agentkit eval --dir examples/security-reviewer --list
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The manifest should show four server tools, two authored channels, one
|
|
109
|
+
storage definition, and one A/B experiment. The eval listing should show one
|
|
110
|
+
case.
|
|
111
|
+
|
|
112
|
+
## Know the chat path's write boundary
|
|
113
|
+
|
|
114
|
+
In chat, the root instructions ask the model to use this order:
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
prepare_review -> run_reviewers -> finalize_review
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
They also ask the model to set `postComment: true` only on request. This is
|
|
121
|
+
prompt policy, not a deterministic safety gate. The model chooses tool
|
|
122
|
+
arguments, and `finalize_review` has no human approval. Use the direct stage
|
|
123
|
+
calls below when a no-post proof must be enforced.
|
|
124
|
+
|
|
125
|
+
## Call stages directly without publishing
|
|
126
|
+
|
|
127
|
+
Call each stage and pass `postComment: false` yourself:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
agentkit call prepare_review \
|
|
131
|
+
--dir examples/security-reviewer \
|
|
132
|
+
--input '{"prUrl":"https://github.com/owner/repo/pull/123"}'
|
|
133
|
+
|
|
134
|
+
agentkit call run_reviewers \
|
|
135
|
+
--dir examples/security-reviewer \
|
|
136
|
+
--input '{"runId":"<run-id>"}'
|
|
137
|
+
|
|
138
|
+
agentkit call finalize_review \
|
|
139
|
+
--dir examples/security-reviewer \
|
|
140
|
+
--input '{"runId":"<run-id>","postComment":false}'
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Review state lives under the project's run-artifact directory, so later
|
|
144
|
+
stages can open the prepared `runId`.
|
|
145
|
+
|
|
146
|
+
> [!CAUTION]
|
|
147
|
+
> `finalize_review` with `postComment: true` writes to GitHub. The webhook
|
|
148
|
+
> path always requests that write. Chat instructions alone don't prevent it.
|
|
149
|
+
|
|
150
|
+
## Watch parallel work in the playground
|
|
151
|
+
|
|
152
|
+
Run the dev server:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
agentkit dev examples/security-reviewer
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Open the printed playground and start a review. The custom
|
|
159
|
+
`run_reviewers` renderer polls the progress channel's `GET /:runId` route.
|
|
160
|
+
|
|
161
|
+
It refreshes every 500 ms while the stage runs. Each row shows a reviewer
|
|
162
|
+
module's state, candidates, reviewed areas, and failure. A second section
|
|
163
|
+
shows triage jobs and confirmed or rejected counts.
|
|
164
|
+
|
|
165
|
+
This is an authored playground extension. Agentkit discovers it by the tool
|
|
166
|
+
name, so the generic `run_reviewers` chip becomes a domain-specific view
|
|
167
|
+
without changing the framework playground.
|
|
168
|
+
|
|
169
|
+
## Fan out reviewers while triage starts
|
|
170
|
+
|
|
171
|
+
Module selection uses repository and path rules. The current module set
|
|
172
|
+
covers:
|
|
173
|
+
|
|
174
|
+
- agent tooling trust boundaries,
|
|
175
|
+
- privileged service RPCs,
|
|
176
|
+
- product-specific security risks,
|
|
177
|
+
- dependency and supply-chain changes,
|
|
178
|
+
- deployment and infrastructure code,
|
|
179
|
+
- filesystem and workspace boundaries,
|
|
180
|
+
- privacy, and
|
|
181
|
+
- general security review.
|
|
182
|
+
|
|
183
|
+
Selected modules may run more than once. Candidates pass through a duplicate
|
|
184
|
+
gate, then bounded triage. Reviewer or triage failures can produce partial
|
|
185
|
+
results. A final dedupe failure stops finalization.
|
|
186
|
+
|
|
187
|
+
The pipeline writes JSONL journals as work completes. Final artifacts include
|
|
188
|
+
the review bundle, patch, reviewer outputs, candidates, triage decisions,
|
|
189
|
+
findings, accounting, and audit events.
|
|
190
|
+
|
|
191
|
+
## Separate session storage from review artifacts
|
|
192
|
+
|
|
193
|
+
`defineStorage` sends agentkit session and event records to a custom durable
|
|
194
|
+
store. Security Reviewer sets `restore: "off"` so startup doesn't load old
|
|
195
|
+
review sessions in bulk. A continuation lookup can still fetch a needed
|
|
196
|
+
session.
|
|
197
|
+
|
|
198
|
+
The staged review files are separate from session storage. Session-store
|
|
199
|
+
durability doesn't preserve those files. All stages for one `runId` must see
|
|
200
|
+
the same filesystem.
|
|
201
|
+
|
|
202
|
+
This split is useful when conversation history needs shared durability but
|
|
203
|
+
large review artifacts belong on attached storage or an object store.
|
|
204
|
+
|
|
205
|
+
## Compare live comment variants
|
|
206
|
+
|
|
207
|
+
The comment-severity experiment uses sticky session assignment with a 5%
|
|
208
|
+
holdout:
|
|
209
|
+
|
|
210
|
+
- `control` posts every finding.
|
|
211
|
+
- `treatment` posts only high and critical findings.
|
|
212
|
+
|
|
213
|
+
Finalization enforces the comment filter. The treatment also adds an
|
|
214
|
+
instruction overlay asking chat and playground summaries to lead with high
|
|
215
|
+
and critical findings. Full artifacts, `finalResponse`, finding counts, and
|
|
216
|
+
status still include every finding. Stage-tool counters appear in the
|
|
217
|
+
playground A/B view. Local sample and snapshot files persist under
|
|
218
|
+
`.agent-serve/`.
|
|
219
|
+
|
|
220
|
+
When a treatment session has only low or medium findings, the filtered review
|
|
221
|
+
body currently says no vulnerabilities were found even though artifacts and
|
|
222
|
+
status retain findings. Account for that mismatch before using this
|
|
223
|
+
experiment as a publishing policy.
|
|
224
|
+
|
|
225
|
+
Eval sessions skip A/B enrollment.
|
|
226
|
+
|
|
227
|
+
## Test the GitHub channel carefully
|
|
228
|
+
|
|
229
|
+
The channel currently accepts two configured repositories. It wakes on
|
|
230
|
+
`opened` and `synchronize`, skips drafts, and requests `pr-write` access.
|
|
231
|
+
|
|
232
|
+
Inspect its event surface:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
agentkit github events \
|
|
236
|
+
--dir examples/security-reviewer \
|
|
237
|
+
--json
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Replay reaches the full publishing path:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
TEST_PR_URL=https://github.com/your-org/allowlisted-test-repo/pull/123
|
|
244
|
+
agentkit github replay \
|
|
245
|
+
"$TEST_PR_URL" \
|
|
246
|
+
--dir examples/security-reviewer \
|
|
247
|
+
--action opened
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Set `TEST_PR_URL` to a PR in the channel's configured repository allowlist.
|
|
251
|
+
Run the command only against a PR intended for test reviews. It posts a commit
|
|
252
|
+
status and may post findings.
|
|
253
|
+
|
|
254
|
+
## Inspect the eval before running it
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
agentkit eval --dir examples/security-reviewer --list
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The case reads pinned metadata from the committed fixture and checks for all
|
|
261
|
+
three tool names. It doesn't assert their order. The current `prepare_review`
|
|
262
|
+
still fetches the live PR, so the case needs GitHub access and isn't fully
|
|
263
|
+
offline. It also doesn't assert finding location, severity, agreement with
|
|
264
|
+
`gold.json`, or `postComment: false`.
|
|
265
|
+
|
|
266
|
+
Don't use this committed case as a no-post proof with write-capable GitHub
|
|
267
|
+
credentials. The prompt asks for no comment, but the model can still pass
|
|
268
|
+
`postComment: true`.
|
|
269
|
+
|
|
270
|
+
When you adapt the pipeline, add assertions for confirmed findings and make
|
|
271
|
+
the prepare stage accept a materialized fixture if repeatable offline evals
|
|
272
|
+
matter.
|
|
273
|
+
|
|
274
|
+
## Build another staged pipeline
|
|
275
|
+
|
|
276
|
+
Use staged host orchestration when:
|
|
277
|
+
|
|
278
|
+
- each phase needs its own timeout and artifact,
|
|
279
|
+
- model workers should run in bounded parallel,
|
|
280
|
+
- later work can start as soon as partial results arrive,
|
|
281
|
+
- a webhook must acknowledge before the work finishes, or
|
|
282
|
+
- operators need live progress beyond one tool spinner.
|
|
283
|
+
|
|
284
|
+
Keep external writes in finalization. Pass a `runId` between stages, journal
|
|
285
|
+
progress before publishing, and make partial-worker failures visible in the
|
|
286
|
+
result.
|
|
287
|
+
|
|
288
|
+
## Where to go next
|
|
289
|
+
|
|
290
|
+
- [GitHub](../guides/github.md)
|
|
291
|
+
- [Tools](../reference/tools.md)
|
|
292
|
+
- [Channels](../reference/channels.md)
|
|
293
|
+
- [Playground](../reference/playground.md)
|
|
294
|
+
- [Storage](../storage.md)
|
|
295
|
+
- [Live A/B metrics](../ab.md)
|
|
296
|
+
- [Evals](../evals.md)
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Put a minimal agent in Slack"
|
|
3
|
+
description: "Use account-linked Slack routing, thread continuity, identity, and suggested prompts with one small channel."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Put a minimal agent in Slack
|
|
7
|
+
|
|
8
|
+
Slack agent is the smallest channel example. It has one runtime config, one
|
|
9
|
+
instruction file, and one authored channel. A teammate mentions the agent,
|
|
10
|
+
the local runtime harness runs a turn, and the answer
|
|
11
|
+
returns to the same Slack thread.
|
|
12
|
+
|
|
13
|
+
Use it to learn the minimum needed for a Slack agent before adding tools,
|
|
14
|
+
workflows, or a dedicated app.
|
|
15
|
+
|
|
16
|
+
[Browse the Slack agent source.](../../examples/slack-agent/)
|
|
17
|
+
|
|
18
|
+
## Keep the Slack channel small
|
|
19
|
+
|
|
20
|
+
Slack agent delegates transport details to the host connection. The authored
|
|
21
|
+
file selects the account-linked transport, gives the agent a single-token
|
|
22
|
+
router name and icon, and supplies suggested prompts.
|
|
23
|
+
|
|
24
|
+
The complete channel lives in
|
|
25
|
+
[`agent/channels/slack.ts`](../../examples/slack-agent/agent/channels/slack.ts).
|
|
26
|
+
The framework supplies message intake, thread-scoped sessions, delivery,
|
|
27
|
+
status updates, and suggested prompts.
|
|
28
|
+
|
|
29
|
+
## Follow a Slack message
|
|
30
|
+
|
|
31
|
+
1. A user mentions the agent or sends the host app a direct message naming
|
|
32
|
+
it.
|
|
33
|
+
2. The Slack relay selects this channel by its single-token `agentName`.
|
|
34
|
+
3. Agentkit maps the Slack channel and thread timestamp to a continuation
|
|
35
|
+
key.
|
|
36
|
+
4. The local harness runs with
|
|
37
|
+
[`instructions.md`](../../examples/slack-agent/agent/instructions.md).
|
|
38
|
+
5. The response returns to the triggering thread.
|
|
39
|
+
6. A later message in the same thread resumes the durable session.
|
|
40
|
+
|
|
41
|
+
The prompt asks for concise threaded replies. It doesn't define domain policy
|
|
42
|
+
or tool routing.
|
|
43
|
+
|
|
44
|
+
## Map the Slack agent files
|
|
45
|
+
|
|
46
|
+
| File | Purpose |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| [`package.json`](../../examples/slack-agent/package.json) | Declares the example package and agentkit dependency. |
|
|
49
|
+
| [`agent/agent.ts`](../../examples/slack-agent/agent/agent.ts) | Names the agent and selects the model. The omitted `runtime` defaults to local. |
|
|
50
|
+
| [`agent/instructions.md`](../../examples/slack-agent/agent/instructions.md) | Sets the always-on response style. |
|
|
51
|
+
| [`agent/channels/slack.ts`](../../examples/slack-agent/agent/channels/slack.ts) | Connects the signed-in host account to Slack. |
|
|
52
|
+
|
|
53
|
+
There are no authored tools, skills, MCP connections, subagents, schedules,
|
|
54
|
+
hooks, A/B experiments, or evals. This small surface is the lesson.
|
|
55
|
+
|
|
56
|
+
## Connect the host
|
|
57
|
+
|
|
58
|
+
You need:
|
|
59
|
+
|
|
60
|
+
- Node 22.13 or newer.
|
|
61
|
+
- An agent-runtime credential.
|
|
62
|
+
- Slack connected through the selected channel transport.
|
|
63
|
+
|
|
64
|
+
Sign in and confirm the active account:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
agentkit login
|
|
68
|
+
agentkit whoami
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The selected transport owns Slack credential setup. See the
|
|
72
|
+
[Slack guide](../guides/slack.md) for account-linked and dedicated-app
|
|
73
|
+
options.
|
|
74
|
+
|
|
75
|
+
## Validate and start the server
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
agentkit validate --dir examples/slack-agent
|
|
79
|
+
agentkit info --dir examples/slack-agent --json
|
|
80
|
+
agentkit dev examples/slack-agent
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The dev command prints the playground URL. It also mounts the Slack channel
|
|
84
|
+
and waits for relayed messages.
|
|
85
|
+
|
|
86
|
+
In Slack, address the configured host app and router name, then send:
|
|
87
|
+
|
|
88
|
+
> `<host-app mention> <router name>` Explain agentkit in three bullets.
|
|
89
|
+
|
|
90
|
+
Reply in the generated thread:
|
|
91
|
+
|
|
92
|
+
> Make the second bullet simpler.
|
|
93
|
+
|
|
94
|
+
The second message reaches the same session. You can open that session in the
|
|
95
|
+
playground to inspect the received message, model events, final reply, and
|
|
96
|
+
usage.
|
|
97
|
+
|
|
98
|
+
## Test without Slack
|
|
99
|
+
|
|
100
|
+
Every project gets the built-in HTTP channel even when no HTTP file exists.
|
|
101
|
+
Run a one-shot turn through it:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
agentkit run --dir examples/slack-agent \
|
|
105
|
+
--message "Explain agentkit simply."
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The same project also exposes an MCP endpoint. Since this agent has no server
|
|
109
|
+
tools, its MCP surface contains `ask` and `check`, but not `call_tool`.
|
|
110
|
+
|
|
111
|
+
These automatic surfaces let you test the prompt from the CLI and let another
|
|
112
|
+
agent delegate to it later. The authored Slack channel only changes how work
|
|
113
|
+
arrives and where replies go.
|
|
114
|
+
|
|
115
|
+
## Know when to add a dedicated app
|
|
116
|
+
|
|
117
|
+
An account-linked Slack transport is a fit for mentions, direct messages, thread
|
|
118
|
+
continuity, and agent-branded replies. Move to a dedicated Socket Mode channel
|
|
119
|
+
when you need:
|
|
120
|
+
|
|
121
|
+
- top-level channel watching,
|
|
122
|
+
- interactive approval buttons,
|
|
123
|
+
- a separate bot identity, or
|
|
124
|
+
- Slack app events unsupported by the account-linked relay.
|
|
125
|
+
|
|
126
|
+
Compare this example with [Playbook router](./benny.md), which adds allowlisted channel
|
|
127
|
+
watching, and [Weather agent](./weather-agent.md), which adds approval buttons
|
|
128
|
+
through a second Slack channel.
|
|
129
|
+
|
|
130
|
+
## Turn the channel into your own Slack agent
|
|
131
|
+
|
|
132
|
+
Copy the three authored files, then change:
|
|
133
|
+
|
|
134
|
+
- `name` in `agent.ts` for the harness identity,
|
|
135
|
+
- `agentName` in `slack.ts` for the single-token router name,
|
|
136
|
+
- the instructions for your domain, and
|
|
137
|
+
- suggested prompts for the tasks teammates should try.
|
|
138
|
+
|
|
139
|
+
Keep `agentName` free of whitespace. Use PascalCase for multiword names.
|
|
140
|
+
|
|
141
|
+
## Where to go next
|
|
142
|
+
|
|
143
|
+
- [Slack](../guides/slack.md)
|
|
144
|
+
- [Channels](../reference/channels.md)
|
|
145
|
+
- [Sessions and streaming](../reference/sessions.md)
|
|
146
|
+
- [Playground](../reference/playground.md)
|