Migrate agentcore-harness.ts from api-client to AWS SDK typed client
- Dominant language
- TypeScript
- Stars
- 283
- Forks
- 95
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 183
Description
## Context
`src/cli/aws/agentcore-harness.ts` currently uses the hand-rolled `api-client.ts` HTTP wrapper with manually defined TypeScript interfaces for harness CRUD and invoke operations. Now that harness is GA, `@aws-sdk/client-bedrock-agentcore` provides fully typed commands and interfaces that stay in sync with the API automatically.
## Problem
The local interfaces (`BedrockModelConfig`, `OpenAiModelConfig`, `GeminiModelConfig`, `HarnessModelConfiguration`) duplicate what the SDK already provides (`HarnessBedrockModelConfig`, `HarnessOpenAiModelConfig`, `HarnessGeminiModelConfig`, `HarnessModelConfiguration`). This duplication caused the bug fixed in #1287 — a local type drifted out of sync and silently dropped inference parameters.
## Proposed Change
Replace the custom HTTP calls in `agentcore-harness.ts` with SDK commands:
- `InvokeHarnessCommand` (with event stream handling for streaming)
- `CreateHarnessCommand` / `UpdateHarnessCommand` / `DeleteHarnessCommand` / `GetHarnessCommand`
This eliminates ~30 lines of local type definitions and removes the risk of type drift with the API.
## References
- PR #1287 discussion: https://github.com/aws/agentcore-cli/pull/1287#discussion_r3261564668
- SDK package already in dependencies: `@aws-sdk/client-bedrock-agentcore@^3.1020.0`
Contributor guide
Assessment
This issue has not been assessed yet.