aws / aws/agentcore-cli

feat: add ability to edit harness configuration after creation

Open
#1,102 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
283
Forks
95
Avg merge
1d 2h
Merged PRs (30d)
183

Description

### Description

There is no way to edit a harness's configuration after the initial `agentcore add harness` flow. If a user needs to change the system prompt, swap a model, add/remove tools, or fix a misconfigured gateway tool, they have no CLI-native path to do so.

This is especially painful for **gateway tools within a harness**. When a gateway is added during harness creation, the ARN and auth config are written to `app//harness.json` — a file users don't know exists. If the gateway ARN or OAuth config is wrong, deployments fail with no discoverable way to fix it from the CLI.

### Current Behavior

`HarnessPrimitive` only implements `add()` and `remove()`. All harness configuration is written once during `add()`:

- **Harness spec** → `app//harness.json` (via `configIO.writeHarnessSpec()`)
- **System prompt** → `app//system-prompt.md`
- **Project reference** → `agentcore/agentcore.json`

Properties that cannot be changed after creation:
- System prompt
- Model provider / model ID
- Tools (browser, code_interpreter, MCP servers, **gateway ARN + auth config**)
- Max iterations, max tokens, timeout
- Truncation strategy
- Network mode, subnets, security groups
- Container URI / Dockerfile path
- Authentication configuration

The only workarounds are:
1. Manually edit `app//harness.json` (undiscoverable)
2. `agentcore remove harness` + `agentcore add harness` (destructive — loses customizations)

### Expected Behavior

Users should be able to edit harness configuration after creation. For example:

```
agentcore edit harness
agentcore edit harness --name
```

This could re-enter the wizard with current values as defaults, or open the config in an editor, or support targeted flag-based edits — whatever fits the CLI's UX patterns best.

### Relevant Code

- **Harness spec written (once):** `src/cli/primitives/HarnessPrimitive.ts` line ~177
- **System prompt written (once):** `src/cli/primitives/HarnessPrimitive.ts` lines ~178-183
- **Gateway tool config built during add:** `src/cli/primitives/HarnessPrimitive.ts` lines 110-138
- **Harness spec file path:** `app//harness.json` (via `PathResolver.getHarnessConfigPath()`)
- **Tools passed to API unchanged on deploy:** `src/cli/operations/deploy/imperative/deployers/harness-mapper.ts` lines 248-254
- **No `update()` or `edit()` method on `HarnessPrimitive` or `BasePrimitive`**

### Impact

Harness iteration is a core development workflow. Users frequently need to tweak system prompts, swap models, fix gateway ARNs, or add/remove tools. Currently, any mistake during initial creation forces users out of the CLI workflow — either manually editing files they don't know about, or destroying and recreating the entire harness.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.