Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
d15ce2e
feat: add sync workflow
avi-alpert Mar 5, 2026
7d35986
fix: formatting
avi-alpert Mar 5, 2026
2acb841
fix: only sync to main branch
avi-alpert Mar 9, 2026
05258f3
fix: codeql permissions
avi-alpert Mar 9, 2026
216140f
Merge pull request #1 from aws/aalpert/workflow
avi-alpert Mar 9, 2026
c6099d4
chore: sync main with public/main
github-actions[bot] Mar 9, 2026
c2bef91
Merge remote-tracking branch 'public/main'
avi-alpert Mar 11, 2026
1a361af
chore: sync main with public/main
github-actions[bot] Mar 12, 2026
cc83d81
chore: sync main with public/main
github-actions[bot] Mar 13, 2026
6054e95
chore: sync main with public/main
github-actions[bot] Mar 13, 2026
11ec86e
chore: sync main with public/main
github-actions[bot] Mar 18, 2026
1d64fd8
chore: sync main with public/main
github-actions[bot] Mar 19, 2026
4c2c674
chore: sync main with public/main
github-actions[bot] Mar 19, 2026
ee71ff3
Merge remote-tracking branch 'origin/main'
notgitika Mar 23, 2026
cfd1cdb
chore: sync main with public/main
github-actions[bot] Mar 24, 2026
93d7bbc
chore: sync main with public/main
jariy17 Mar 25, 2026
d0c495f
chore: sync main with public/main
github-actions[bot] Mar 31, 2026
c2121ec
chore: sync main with public/main
github-actions[bot] Mar 31, 2026
d3f6c81
Merge remote-tracking branch 'public/main'
notgitika Apr 8, 2026
37a0ff8
fix(ci): exclude .github/workflows/ from public repo sync (#54)
aidandaly24 Apr 8, 2026
584fd0e
chore: sync main with public/main
github-actions[bot] Apr 8, 2026
832a5c3
chore: sync main with public/main
github-actions[bot] Apr 8, 2026
5af06f5
chore: sync main with public/main
github-actions[bot] Apr 9, 2026
493e1f9
chore: sync main with public/main
github-actions[bot] Apr 9, 2026
63e05fd
chore: sync main with public/main v0.8.0
notgitika Apr 9, 2026
08872f5
chore: sync main with public/main
github-actions[bot] Apr 10, 2026
e9ab06e
chore: sync main with public/main
github-actions[bot] Apr 11, 2026
5d4bd38
chore: sync main with public/main
github-actions[bot] Apr 11, 2026
b1f9711
chore: sync main with public/main
github-actions[bot] Apr 13, 2026
50b389a
chore: sync main with public/main
github-actions[bot] Apr 14, 2026
ff86dc1
chore: sync main with public/main
github-actions[bot] Apr 14, 2026
eeb444c
chore: sync main with public/main
github-actions[bot] Apr 15, 2026
7877ead
chore: sync main with public/main
github-actions[bot] Apr 15, 2026
874814a
chore: sync main with public/main
github-actions[bot] Apr 17, 2026
d3ad7f8
chore: sync main with public/main
github-actions[bot] Apr 17, 2026
89fed85
feat: add shared SigV4 API client and Harness HTTP operations (#84)
notgitika Apr 17, 2026
c5e80ca
chore: sync main with public/main
github-actions[bot] Apr 17, 2026
9151a14
feat(schema): add Harness primitive schema definitions (#85)
tejaskash Apr 17, 2026
62c432c
fix: make harnesses field optional in AgentCoreProjectSpec (#86)
tejaskash Apr 17, 2026
49932f2
chore: sync main with public/main
github-actions[bot] Apr 19, 2026
cf762bd
feat: harness deploy support (#87)
tejaskash Apr 20, 2026
e77dc2d
feat: harness create/add with deploy and bug fixes (#90)
tejaskash Apr 20, 2026
c87c8af
feat: add harness invoke support to CLI and TUI (#89)
notgitika Apr 20, 2026
9eab540
feat(schema): add harnesses[] registry to AgentCoreProjectSpec
tejaskash Apr 17, 2026
902c95c
chore(schema): regenerate JSON schema with harnesses registry
tejaskash Apr 17, 2026
08e4f2f
feat: add harness validation to validate command (#91)
tejaskash Apr 20, 2026
10d8dd8
feat: add container support to harness create/add (#93)
tejaskash Apr 20, 2026
7a5305c
feat: display harnesses in status screen (#96)
notgitika Apr 20, 2026
765f9d5
feat: add --harness support to traces and logs commands (#98)
notgitika Apr 20, 2026
47882d0
fix: harness deploy bugfixes and model update (#99)
tejaskash Apr 20, 2026
7e836e4
chore: sync main with public/main
github-actions[bot] Apr 21, 2026
5046f61
Merge remote-tracking branch 'origin/main' into feat/harness-implemen…
tejaskash Apr 21, 2026
2ea3b6b
Merge origin/feat/harness-implementation and fix eslint errors
tejaskash Apr 21, 2026
26ea7b1
feat: add tool management commands for harnesses (#100)
notgitika Apr 21, 2026
c1d97f8
feat: add session storage support for harnesses (#102)
notgitika Apr 21, 2026
202b7e9
feat: auto-deploy resources before dev server starts (#101)
tejaskash Apr 21, 2026
d9d1f81
fix: add default memory strategies to harness memory creation (#108)
tejaskash Apr 21, 2026
25466d3
feat: add --with-invoke-script and tools in TUI wizard (#105)
notgitika Apr 21, 2026
c2e206e
fix: TUI deploy not persisting deployed state (#110)
tejaskash Apr 21, 2026
5d625a5
fix: add harness to TUI remove flow and CLI status output (#112)
notgitika Apr 21, 2026
ddfbfdb
fix: harness TUI copy and usability improvements (#113)
tejaskash Apr 21, 2026
fc764a6
feat: skip deploy when project config unchanged (#111)
notgitika Apr 21, 2026
aa4e8b9
avi harness progress (#114)
avi-alpert Apr 21, 2026
54b3f4e
feat: add Custom JWT inbound auth support for harnesses (#109)
tejaskash Apr 21, 2026
dd2c8b1
fix(tui): polish harness wizard ordering, help text, and summary (#115)
tejaskash Apr 21, 2026
971004c
removing bad files
tejaskash Apr 21, 2026
df03fe5
fix: auto-populate aws-targets.json on dev deploy (#117)
notgitika Apr 22, 2026
b8691c3
feat: make update command aware of preview dist-tag (#118)
tejaskash Apr 22, 2026
1c74d43
fix: harness add bugs - no deploy, project name prefix, interactive m…
tejaskash Apr 22, 2026
06deb79
feat: remove inline_function tool approval — all tools execute automa…
notgitika Apr 22, 2026
4fe3ab7
fix: add deploy hash check to CLI deploy path (#120)
notgitika Apr 22, 2026
5917220
Move Memory out of Advanced settings in harness wizard (#121)
tejaskash Apr 22, 2026
969cfe6
fix: avoid double JSON parse in harness invocation, extract parseTool…
avi-alpert Apr 22, 2026
3115e02
fix: harness bug bash fixes — status duplicate, provider names, sessi…
notgitika Apr 22, 2026
1a1de9b
docs: add harness documentation and fix inline_function help text (#124)
notgitika Apr 22, 2026
34b7639
fix: align harness model config with Smithy API and add invoke overri…
tejaskash Apr 22, 2026
5f6f98c
fix: align harness networkConfiguration with Smithy model (#126)
tejaskash Apr 22, 2026
7889e84
fix: show tools in harness review screen and wire up invoke --tools (…
tejaskash Apr 22, 2026
2c42299
chore: bump version to 1.0.0-preview.0 and pin agentcore-cdk to alpha…
tejaskash Apr 22, 2026
34b41e7
fix: revert vended CDK dep to ^0.1.0-alpha.19 (#910)
jesseturner21 Apr 22, 2026
e850c9e
fix: use nullish coalescing operator in CreateScreen (#918)
tejaskash Apr 22, 2026
35ec0c1
feat: upgrade @aws/agentinspector to 0.2.0 (#919)
avi-alpert Apr 22, 2026
1bde086
fix: update asset snapshots and fix useDevDeploy skip test (#921)
notgitika Apr 22, 2026
05570b9
chore: bump version to 1.0.0-preview.1.0 (#922)
github-actions[bot] Apr 22, 2026
b28a542
chore: merge main into feat/harness-implementation
tejaskash Apr 22, 2026
454967a
Revert "chore: bump version to 1.0.0-preview.1.0 (#922)"
tejaskash Apr 22, 2026
6e929a3
chore: bump version to 1.0.0-preview.1 (#923)
github-actions[bot] Apr 22, 2026
3cec11c
fix: build and push Dockerfile for harnesses on deploy (#927) (#929)
tejaskash Apr 23, 2026
c1c92f6
fix: preserve harness deployed state on early deploy errors (#933)
tejaskash Apr 23, 2026
69dbc79
Merge remote-tracking branch 'origin/main' into preview
tejaskash Apr 23, 2026
502e089
chore: bump version to 1.0.0-preview.2 (#939)
github-actions[bot] Apr 23, 2026
07b7430
fix: use dnsSuffix() for multi-partition endpoint support
tejaskash Apr 23, 2026
4a90975
Revert "chore: bump version to 1.0.0-preview.2 (#939)"
tejaskash Apr 23, 2026
c8ea8b4
fix: update asset snapshots after version revert
tejaskash Apr 23, 2026
27c47ca
chore: bump version to 1.0.0-preview.2 (#942)
github-actions[bot] Apr 23, 2026
398dc50
feat: add agentcore-cli User-Agent to all API calls (#960)
notgitika Apr 27, 2026
57ee733
Remove inline container build from vended cdk-stack.ts (#954)
tejaskash Apr 27, 2026
a19fc8f
feat: add project-name option to preview create (#970)
tejaskash Apr 27, 2026
3fd6668
Merge main into preview
tejaskash Apr 28, 2026
8a4ea58
fix(tests): fix 2 test failures on preview branch
tejaskash Apr 28, 2026
a8e9224
chore: bump version to 1.0.0-preview.3 (#1004)
github-actions[bot] Apr 28, 2026
3e7e15b
chore: merge main into preview (#1013)
avi-alpert Apr 29, 2026
1c726d8
sync-preview: merge main into preview (#1017)
github-actions[bot] Apr 29, 2026
553a520
chore: merge main into preview
aidandaly24 Apr 29, 2026
8c4d6eb
Merge pull request #1018 from aws/sync-preview/real-merge-main-20260429
aidandaly24 Apr 29, 2026
fc1cd56
ci: run all PR and merge workflows on preview branch (#1023)
tejaskash Apr 29, 2026
c44d8c1
chore: merge main into preview
aidandaly24 Apr 29, 2026
451868a
Merge pull request #1035 from aws/sync-preview/merge-main-20260429-v2
tejaskash Apr 29, 2026
a951aed
chore: merge main into preview
aidandaly24 Apr 29, 2026
7f315c6
Merge pull request #1037 from aws/sync-preview/merge-main-20260429-v3
aidandaly24 Apr 29, 2026
01b3b7d
fix(ci): install uv in release workflow prepare steps (#1038) (#1039)
aidandaly24 Apr 29, 2026
ecda10c
chore: merge main into preview
aidandaly24 Apr 29, 2026
dd76d17
Merge pull request #1040 from aws/sync-preview/merge-main-20260429-v5
aidandaly24 Apr 29, 2026
626872f
feat(tests): add E2E and integration tests for Harness primitive (#1021)
tejaskash Apr 29, 2026
4c9c31a
chore: bump version to 1.0.0-preview.4
github-actions[bot] Apr 29, 2026
352c79c
Merge pull request #1041 from aws/release/v1.0.0-preview.4
aidandaly24 Apr 29, 2026
d8b8bd3
chore: merge main into preview
aidandaly24 Apr 29, 2026
ae3f90f
Merge pull request #1045 from aws/sync-preview/merge-main-20260429-v6
aidandaly24 Apr 29, 2026
845225a
fix: restore ^ caret prefix on @aws/agentcore-cdk dependency
notgitika Apr 29, 2026
05c5385
fix: update snapshot to match restored caret prefix
notgitika Apr 29, 2026
370ee84
Merge pull request #1046 from notgitika/fix/restore-cdk-caret
aidandaly24 Apr 29, 2026
9f2702a
chore: merge main into preview
aidandaly24 Apr 30, 2026
26b1c4c
Merge pull request #1053 from aws/sync-preview/merge-main-20260430
avi-alpert Apr 30, 2026
6e01e4e
chore: merge main into preview
aidandaly24 Apr 30, 2026
7590650
chore: merge main into preview
aidandaly24 Apr 30, 2026
18fa2c9
Merge pull request #1057 from aws/sync-preview/merge-main-20260430-v2
aidandaly24 Apr 30, 2026
1277430
chore: bump version to 1.0.0-preview.5 (#1060)
github-actions[bot] Apr 30, 2026
14c9003
feat(agent-inspector): feat: add allowedTools and tools overrides to …
avi-alpert May 1, 2026
aeb796a
chore: sync main into preview — evo features (#1077)
notgitika May 1, 2026
b873a49
fix: restore preview-specific package.json, lock, and changelog (#1084)
notgitika May 1, 2026
f818286
feat: replace credentialProviderName with outboundAuth for harness ga…
aidandaly24 May 1, 2026
3c0fe63
chore: bump version to 1.0.0-preview.6
github-actions[bot] May 1, 2026
4fa7b6f
Merge pull request #1085 from aws/release/v1.0.0-preview.6
aidandaly24 May 1, 2026
c9c0d07
Merge pull request #1081 from avi-alpert/aalpert/harness-tools-inspector
avi-alpert May 1, 2026
f72c986
fix: add --system-prompt, --tools, and gateway CLI flags to add harness
notgitika May 4, 2026
ec1d18c
fix: add validation for --tools and gateway flags on add harness
notgitika May 4, 2026
8fa4e6a
Merge pull request #1098 from aws/fix/add-harness-system-prompt-tools…
aidandaly24 May 4, 2026
6837467
fix: add batch eval and recommendation IAM permissions to docs
notgitika May 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 8 additions & 3 deletions .github/harness/prompts/review.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ Review this GitHub PR: {pr_url}
You have tools to fetch the PR diff, read files, search the web, and post comments on the PR.

You have these repos cloned locally for context:

- /opt/workspace/agentcore-cli — aws/agentcore-cli
- /opt/workspace/agentcore-l3-cdk-constructs — aws/agentcore-l3-cdk-constructs

Before reviewing, read all existing comments on the PR to understand what has already been discussed. Do not repeat or re-post issues that have already been raised in existing comments.
Before reviewing, read all existing comments on the PR to understand what has already been discussed. Do not repeat or
re-post issues that have already been raised in existing comments.

Review the PR. If there are any serious issues that require code changes before merging, post a comment on the PR for each issue explaining the problem. If there are multiple ways to fix an issue, list the options so the author can choose. Skip style nits and minor suggestions — only flag things that actually need to change.
Review the PR. If there are any serious issues that require code changes before merging, post a comment on the PR for
each issue explaining the problem. If there are multiple ways to fix an issue, list the options so the author can
choose. Skip style nits and minor suggestions — only flag things that actually need to change.

If all serious issues have already been raised in existing comments, or if you found no new issues, post a single comment on the PR saying it looks good to merge (or that all issues have already been flagged).
If all serious issues have already been raised in existing comments, or if you found no new issues, post a single
comment on the PR saying it looks good to merge (or that all issues have already been flagged).
10 changes: 7 additions & 3 deletions .github/harness/prompts/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ This workspace contains two repos for developing and testing the AgentCore CLI.

### agentcore-cli/ (`aws/agentcore-cli`)

The terminal experience for creating, developing, and deploying AI agents to AgentCore. Node.js/TypeScript CLI built with Ink (React-based TUI).
The terminal experience for creating, developing, and deploying AI agents to AgentCore. Node.js/TypeScript CLI built
with Ink (React-based TUI).

### agentcore-l3-cdk-constructs/ (`aws/agentcore-l3-cdk-constructs`)

AWS CDK L3 constructs for declaring and deploying AgentCore infrastructure. Used by agentcore-cli to vend CDK projects when users run `agentcore create`.
AWS CDK L3 constructs for declaring and deploying AgentCore infrastructure. Used by agentcore-cli to vend CDK projects
when users run `agentcore create`.

## How they relate

`agentcore-cli` is the main product. It vends CDK projects using constructs from `agentcore-l3-cdk-constructs`.

## Testing with a bundled distribution

Run `npm run bundle` in `agentcore-cli/` to create a tar distribution that includes the packaged `agentcore-l3-cdk-constructs`. You can then install it globally with `npm install -g <path-to-tar>` to test the CLI end-to-end.
Run `npm run bundle` in `agentcore-cli/` to create a tar distribution that includes the packaged
`agentcore-l3-cdk-constructs`. You can then install it globally with `npm install -g <path-to-tar>` to test the CLI
end-to-end.
13 changes: 13 additions & 0 deletions .github/scripts/prompts/review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Review this GitHub PR: {pr_url}

You have tools to fetch the PR diff, read files, search the web, and post comments on the PR.

You have these repos cloned locally for context:
- /opt/workspace/agentcore-cli — aws/agentcore-cli
- /opt/workspace/agentcore-l3-cdk-constructs — aws/agentcore-l3-cdk-constructs

Before reviewing, read all existing comments on the PR to understand what has already been discussed. Do not repeat or re-post issues that have already been raised in existing comments.

Review the PR. If there are any serious issues that require code changes before merging, post a comment on the PR for each issue explaining the problem. If there are multiple ways to fix an issue, list the options so the author can choose. Skip style nits and minor suggestions — only flag things that actually need to change.

If all serious issues have already been raised in existing comments, or if you found no new issues, post a single comment on the PR saying it looks good to merge (or that all issues have already been flagged).
21 changes: 21 additions & 0 deletions .github/scripts/prompts/system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# AgentCore CLI Development Workspace

This workspace contains two repos for developing and testing the AgentCore CLI.

## Repositories

### agentcore-cli/ (`aws/agentcore-cli`)

The terminal experience for creating, developing, and deploying AI agents to AgentCore. Node.js/TypeScript CLI built with Ink (React-based TUI).

### agentcore-l3-cdk-constructs/ (`aws/agentcore-l3-cdk-constructs`)

AWS CDK L3 constructs for declaring and deploying AgentCore infrastructure. Used by agentcore-cli to vend CDK projects when users run `agentcore create`.

## How they relate

`agentcore-cli` is the main product. It vends CDK projects using constructs from `agentcore-l3-cdk-constructs`.

## Testing with a bundled distribution

Run `npm run bundle` in `agentcore-cli/` to create a tar distribution that includes the packaged `agentcore-l3-cdk-constructs`. You can then install it globally with `npm install -g <path-to-tar>` to test the CLI end-to-end.
217 changes: 217 additions & 0 deletions .github/scripts/python/harness_review.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
"""Invoke Bedrock AgentCore Harness to review a GitHub PR.

Reads PR_URL from the environment. Streams harness output to stdout.
Uses raw HTTP with SigV4 signing — no custom service model needed.
"""

import json
import os
import sys
import time
import uuid

import boto3
from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest
from botocore.eventstream import EventStreamBuffer
from urllib.parse import quote
import urllib3

# ANSI color codes
CYAN = "\033[36m"
YELLOW = "\033[33m"
GREEN = "\033[32m"
RED = "\033[31m"
DIM = "\033[2m"
RESET = "\033[0m"

SCRIPTS_DIR = os.path.join(os.path.dirname(__file__), "..")


def read_prompt(filename):
"""Read a prompt template from the prompts directory."""
path = os.path.join(SCRIPTS_DIR, "prompts", filename)
with open(path) as f:
return f.read()


def invoke_harness(harness_arn, body, region):
"""Send a SigV4-signed request to the harness invoke endpoint. Returns a streaming response.

InvokeHarness is not in standard boto3, so we call the REST API directly.
boto3 is only used to resolve AWS credentials (from env vars, OIDC, etc.)
and sign the request with SigV4. The response is an AWS binary event stream.
"""
session = boto3.Session(region_name=region)
credentials = session.get_credentials().get_frozen_credentials()
url = f"https://bedrock-agentcore.{region}.amazonaws.com/harnesses/invoke?harnessArn={quote(harness_arn, safe='')}"
request = AWSRequest(method="POST", url=url, data=body, headers={
"Content-Type": "application/json",
"Accept": "application/vnd.amazon.eventstream",
})
SigV4Auth(credentials, "bedrock-agentcore", region).add_auth(request)
return urllib3.PoolManager().urlopen(
"POST", url, body=body,
headers=dict(request.headers),
preload_content=False,
timeout=urllib3.Timeout(connect=10, read=600),
)


def parse_events(http_response):
"""Yield (event_type, payload) tuples from the harness binary event stream.

The response arrives as raw bytes in AWS binary event stream format.
EventStreamBuffer reassembles complete events from the 4KB chunks,
and we decode each event's JSON payload before yielding it.
"""
event_buffer = EventStreamBuffer()
for chunk in http_response.stream(4096):
event_buffer.add_data(chunk)
for event in event_buffer:
if event.headers.get(":message-type") == "exception":
payload = json.loads(event.payload.decode("utf-8"))
print(f"\n{RED}ERROR: {payload}{RESET}", file=sys.stderr)
sys.exit(1)
event_type = event.headers.get(":event-type", "")
if event.payload:
yield event_type, json.loads(event.payload.decode("utf-8"))


def print_stream(http_response):
"""Display harness events with GitHub Actions log groups.

The harness streams events as the agent works:
contentBlockStart — a new block begins (text or tool call)
contentBlockDelta — incremental chunks of text or tool input JSON
contentBlockStop — block complete, we now have full tool input to display
messageStop — agent finished
internalServerException — server error

Tool calls are wrapped in ::group::/::endgroup:: for collapsible sections
in the GitHub Actions log UI. Agent reasoning text is printed inline in dim.
"""
start_time = time.time()
iteration = 0
tool_name = None
tool_input = ""
tool_start = 0.0
in_group = False
text_buffer = ""

def close_group():
nonlocal in_group
if in_group:
print("::endgroup::", flush=True)
in_group = False

def flush_text():
nonlocal text_buffer
if text_buffer:
for line in text_buffer.splitlines():
print(f"{DIM}{line}{RESET}", flush=True)
text_buffer = ""

for event_type, payload in parse_events(http_response):

if event_type == "contentBlockStart":
start = payload.get("start", {})
if "toolUse" in start:
tool_name = start["toolUse"].get("name", "unknown")
tool_input = ""
tool_start = time.time()
iteration += 1

elif event_type == "contentBlockDelta":
delta = payload.get("delta", {})
if "text" in delta:
close_group()
text_buffer += delta["text"]
if "toolUse" in delta:
tool_input += delta["toolUse"].get("input", "")

elif event_type == "contentBlockStop":
flush_text()
if tool_name:
elapsed = time.time() - tool_start
try:
parsed = json.loads(tool_input)
except (json.JSONDecodeError, TypeError):
parsed = tool_input

close_group()

cmd = parsed.get("command") if isinstance(parsed, dict) else None
header = f"{CYAN}[{iteration}]{RESET} {YELLOW}{tool_name}{RESET} {DIM}({elapsed:.1f}s){RESET}"
if cmd:
header += f": $ {cmd}"

print(f"::group::{header}", flush=True)
in_group = True

if isinstance(parsed, dict):
for k, v in parsed.items():
if k != "command":
print(f" {DIM}{k}:{RESET} {str(v)[:300]}", flush=True)

tool_name = None
tool_input = ""

elif event_type == "messageStop":
flush_text()
close_group()
if payload.get("stopReason") == "end_turn":
total = time.time() - start_time
print(f"\n\n{GREEN}{'=' * 50}", flush=True)
print(f" Done ({int(total // 60)}m {int(total % 60)}s)", flush=True)
print(f"{'=' * 50}{RESET}", flush=True)

elif event_type == "internalServerException":
close_group()
print(f"\n{RED}ERROR: {payload}{RESET}", file=sys.stderr)
sys.exit(1)

close_group()
total = time.time() - start_time
print(f"\n{GREEN}Review complete.{RESET} {DIM}({iteration} tool calls, {int(total)}s total){RESET}")


# --- Main ---

# All config comes from environment variables (set via GitHub secrets/workflow)
MODEL_ID = os.environ.get("HARNESS_MODEL_ID", "us.anthropic.claude-opus-4-7")
HARNESS_ARN = os.environ.get("HARNESS_ARN", "")
PR_URL = os.environ.get("PR_URL", "")

for name, val in [("HARNESS_ARN", HARNESS_ARN), ("PR_URL", PR_URL)]:
if not val:
print(f"{RED}ERROR: {name} environment variable is required{RESET}", file=sys.stderr)
sys.exit(1)

# Extract region from the ARN (arn:aws:bedrock-agentcore:{region}:{account}:harness/{id})
REGION = HARNESS_ARN.split(":")[3]
SESSION_ID = str(uuid.uuid4()).upper()

print(f"{CYAN}Session:{RESET} {SESSION_ID}")
print(f"{CYAN}PR:{RESET} {PR_URL}")
print(f"{CYAN}Harness:{RESET} {HARNESS_ARN}")
print()

SYSTEM_PROMPT = read_prompt("system.md")
REVIEW_PROMPT = read_prompt("review.md").format(pr_url=PR_URL)

request_body = json.dumps({
"runtimeSessionId": SESSION_ID,
"systemPrompt": [{"text": SYSTEM_PROMPT}],
"messages": [{"role": "user", "content": [{"text": REVIEW_PROMPT}]}],
"model": {"bedrockModelConfig": {"modelId": MODEL_ID}},
})

http_response = invoke_harness(HARNESS_ARN, request_body, REGION)

if http_response.status != 200:
error = http_response.read().decode("utf-8")
print(f"{RED}ERROR: HTTP {http_response.status}: {error}{RESET}", file=sys.stderr)
sys.exit(1)

print_stream(http_response)
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: Build and Test

on:
push:
branches: ['main']
branches: ['main', 'preview']
pull_request:
branches: ['main']
branches: ['main', 'preview']

permissions:
contents: read

# Cancel in-progress runs for PRs; never cancel runs on main (merges should not abort each other)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/preview' }}

jobs:
build:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@ name: CodeQL

on:
push:
branches: ['main']
branches: ['main', 'preview']
pull_request:
branches: ['main']
branches: ['main', 'preview']
pull_request_target:
branches: ['main']
branches: ['main', 'preview']

# Cancel in-progress runs for PRs; never cancel runs on main (merges should not abort each other)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/preview' }}

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
actions: read
security-events: write
contents: read

Expand Down
Loading
Loading