aws / aws/agentcore-cli

Migrate agentcore-harness.ts from api-client to AWS SDK typed client

Open
#1,295 0 comments 0 reactions 0 assignees View on GitHub
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

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.