Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ce97a2b
feat(runtime): add IAM invoke vertical slice
aidandaly24 Jul 22, 2026
7d21c9e
test(runtime): include invoke in command hierarchy
aidandaly24 Jul 22, 2026
0ed12ad
feat(runtime): add persistent invoke console
aidandaly24 Jul 22, 2026
090ad0f
refactor(runtime): simplify invoke console tests
aidandaly24 Jul 22, 2026
c96217b
test(runtime): prove invoke history ownership
aidandaly24 Jul 22, 2026
e279d1d
test(runtime): prove response is not duplicated
aidandaly24 Jul 22, 2026
d0f73cc
fix(runtime): handle invoke console navigation errors
aidandaly24 Jul 22, 2026
6ce02e7
feat(runtime): add invoke request options and JWT
aidandaly24 Jul 22, 2026
e347c21
refactor(runtime): simplify invoke request flow
aidandaly24 Jul 22, 2026
647a52b
fix(runtime): keep invoke options at UI boundary
aidandaly24 Jul 22, 2026
a0c30cc
fix(runtime): protect invoke secrets and endpoint paths
aidandaly24 Jul 22, 2026
752b4eb
feat(runtime): add native invoke output
aidandaly24 Jul 22, 2026
d0fd5b2
test(runtime): consolidate invoke output coverage
aidandaly24 Jul 22, 2026
cb3c63b
fix(runtime): snapshot buffered response chunks
aidandaly24 Jul 23, 2026
00b0929
fix(runtime): preserve native output bytes
aidandaly24 Jul 23, 2026
d6def5c
refactor(runtime): consolidate invoke behavior
aidandaly24 Jul 23, 2026
e37e74c
fix(runtime): complete invoke contracts
aidandaly24 Jul 23, 2026
6ddb900
fix(runtime): preserve usage and cancellation contracts
aidandaly24 Jul 23, 2026
e36d841
fix(runtime): abort stdin and omit hidden MCP options
aidandaly24 Jul 23, 2026
e8906b9
docs(runtime): document invoke workflows
aidandaly24 Jul 23, 2026
2ab0779
docs(runtime): clarify MCP session invocation
aidandaly24 Jul 23, 2026
df700c3
fix(runtime): default MCP response types
aidandaly24 Jul 23, 2026
924c535
fix(runtime): protect target-scoped request secrets
aidandaly24 Jul 23, 2026
3075f0f
fix(runtime): close invoke review gaps
aidandaly24 Jul 23, 2026
caf19b7
test(runtime): preserve Core call recording shape
aidandaly24 Jul 23, 2026
bdd13ae
refactor(runtime): simplify invoke implementation
aidandaly24 Jul 23, 2026
f72a58d
refactor(runtime): remove redundant invoke guards
aidandaly24 Jul 23, 2026
1fe8f8f
fix(runtime): tighten invoke error handling
aidandaly24 Jul 23, 2026
049be16
fix(runtime): remove arbitrary header limits
aidandaly24 Jul 23, 2026
d404b33
refactor(runtime): simplify invoke validation and cleanup
aidandaly24 Jul 23, 2026
1f79e4d
chore(runtime): format invoke header flag
aidandaly24 Jul 23, 2026
a296cd0
test(runtime): complete invoke failure coverage
aidandaly24 Jul 24, 2026
e25c3db
test(core): simplify data client fixtures
aidandaly24 Jul 24, 2026
0a5a952
docs(core): explain abortable stream semantics
aidandaly24 Jul 24, 2026
cbd491b
refactor(core): generalize fetch dependency type
aidandaly24 Jul 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ agentcore # interactive TUI
├── runtime # inspect deployed AgentCore Runtimes
│ ├── get # fetch a Runtime by id
│ ├── list # list Runtimes (server-side paginated)
│ ├── invoke # invoke a Runtime headlessly or in a persistent console
│ ├── version
│ │ ├── get # get a specific Runtime version
│ │ └── list # list a Runtime's versions
Expand Down Expand Up @@ -116,6 +117,91 @@ agentcore identity api-key-credential-provider update --name my-provider --api-k
agentcore identity api-key-credential-provider delete --name my-provider
```

### Invoke a Runtime

Headless invocation accepts inline, file, or stdin payload bytes:

```bash
# Inline
agentcore runtime invoke \
--id <runtimeId> \
--payload '{"action":"status"}' \
--content-type application/json \
--accept text/event-stream

# File
agentcore runtime invoke --id <runtimeId> --payload file://request.json

# stdin
cat request.json | agentcore runtime invoke --id <runtimeId> --payload -
```

CUSTOM_JWT Runtimes require `--bearer-token`. The token accepts the same inline,
`file://`, or stdin sources as the payload; payload and token cannot both read
stdin.

```bash
agentcore runtime invoke \
--id <runtimeId> \
--payload file://request.json \
--bearer-token file://$HOME/.config/agentcore/runtime-token
```

For MCP Runtimes, initialize first, then pass the returned Runtime and MCP
session IDs to later methods. MCP requests accept both JSON and SSE responses.

```bash
agentcore runtime invoke \
--id <runtimeId> \
--payload '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"agentcore-cli","version":"1"}}}' \
--accept 'application/json, text/event-stream' \
--mcp-protocol-version 2025-03-26 \
--mcp-method initialize

agentcore runtime invoke \
--id <runtimeId> \
--payload '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
--accept 'application/json, text/event-stream' \
--session-id <returnedRuntimeSessionId> \
--mcp-session-id <returnedMcpSessionId> \
--mcp-protocol-version 2025-03-26 \
--mcp-method tools/list
```

Raw mode streams exact response bytes to stdout and writes response metadata to
stderr. Use `--output-file` for binary responses. `--json` instead buffers one
response and emits a metadata envelope without interpreting the customer body.

```bash
agentcore runtime invoke \
--id <runtimeId> \
--payload file://request.bin \
--content-type application/octet-stream \
--accept application/octet-stream \
--output-file response.bin

agentcore runtime invoke --id <runtimeId> --payload '{"action":"status"}' --json
# {"statusCode":200,"contentType":"application/json","bodyEncoding":"utf8","body":"{\"ok\":true}","complete":true}
```

Without `--payload`, Runtime Invoke opens a persistent console for repeated
requests. Bare invoke opens the Runtime and endpoint pickers; `--id` skips the
Runtime picker, and `--id` plus `--qualifier` opens the console directly.

| Shortcut | Action |
| -------- | -------------------------------------------- |
| `Ctrl+D` | Send the request |
| `Ctrl+O` | Open Request Options |
| `Ctrl+T` | Change Runtime or endpoint |
| `Ctrl+V` | Toggle raw and pretty completed JSON |
| `Esc` | Interrupt an active request or navigate back |
| ``/`` | Scroll response history |

Runtime Invoke accepts Runtime IDs from the current account only. It does not
accept ARNs, `--version`, `--interactive`, cross-account targets, or custom
request paths. All requests use the Runtime `/invocations` route, including MCP
Runtimes.

Bare Runtime branches and leaves require a TTY on stdin and stdout. Supplying
operation flags runs the command headlessly, and `--json` always suppresses TUI
rendering.
Expand Down
146 changes: 125 additions & 21 deletions bun.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"typescript": "^5"
},
"dependencies": {
"@aws-sdk/client-bedrock-agentcore": "^3.1079.0",
"@aws-sdk/client-bedrock-agentcore": "^3.1092.0",
"@aws-sdk/client-bedrock-agentcore-control": "^3.1079.0",
"@aws-sdk/client-iam": "^3.1080.0",
"@inkui-cli/data-table": "^0.2.0",
Expand Down
13 changes: 13 additions & 0 deletions src/components/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { RuntimeListEndpointsScreen } from "../handlers/runtime/endpoint/list/sc
import { RuntimeVersionScreen } from "../handlers/runtime/version/screen.tsx";
import { RuntimeGetVersionScreen } from "../handlers/runtime/version/get/screen.tsx";
import { RuntimeListVersionsScreen } from "../handlers/runtime/version/list/screen.tsx";
import { RuntimeInvokeScreen } from "../handlers/runtime/invoke/screen.tsx";
import { RootScreen, HelpScreen } from "../handlers/screen.tsx";
import type { Context } from "../router";

Expand Down Expand Up @@ -255,6 +256,18 @@ export function Root({ path, ctx, core, queryClient }: RootProps) {
path="agentcore/runtime/endpoint/list/:runtimeId"
element={<RuntimeListEndpointsScreen ctx={ctx} core={core} />}
/>
<Route
path="agentcore/runtime/invoke"
element={<RuntimeInvokeScreen ctx={ctx} core={core} />}
/>
<Route
path="agentcore/runtime/invoke/:runtimeId"
element={<RuntimeInvokeScreen ctx={ctx} core={core} />}
/>
<Route
path="agentcore/runtime/invoke/:runtimeId/:qualifier"
element={<RuntimeInvokeScreen ctx={ctx} core={core} />}
/>
<Route path="*" element={<HelpScreen ctx={ctx} core={core} />} />
</Routes>
</MemoryRouter>
Expand Down
4 changes: 3 additions & 1 deletion src/components/RuntimeEndpointPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface RuntimeEndpointPickerProps extends ScreenProps {
breadcrumb: string[];
description?: string;
onSelect: (qualifier: string) => void;
onEscape?: () => void;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to allow this to be overridden? My understanding is the esc consistently means go back to the last page right now in the tui, and by allowing an override we open the door to potentially unexpected behavior.

}

export function RuntimeEndpointPicker({
Expand All @@ -36,10 +37,11 @@ export function RuntimeEndpointPicker({
breadcrumb,
description,
onSelect,
onEscape,
}: RuntimeEndpointPickerProps) {
const opts = coreOptsFromCtx(ctx);
const navigate = useNavigate();
const goBack = () => navigate(-1);
const goBack = onEscape ?? (() => navigate(-1));

return (
<PaginatedTablePicker
Expand Down
4 changes: 3 additions & 1 deletion src/components/RuntimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface RuntimePickerProps extends ScreenProps {
breadcrumb: string[];
description?: string;
onSelect: (runtimeId: string) => void;
onEscape?: () => void;
}

export function RuntimePicker({
Expand All @@ -35,10 +36,11 @@ export function RuntimePicker({
breadcrumb,
description,
onSelect,
onEscape,
}: RuntimePickerProps) {
const opts = coreOptsFromCtx(ctx);
const navigate = useNavigate();
const goBack = () => navigate("/" + breadcrumb.slice(0, -1).join("/"));
const goBack = onEscape ?? (() => navigate("/" + breadcrumb.slice(0, -1).join("/")));

return (
<PaginatedTablePicker
Expand Down
32 changes: 32 additions & 0 deletions src/core/abortable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Relays `source` while making an in-flight read reject as soon as `signal` aborts.
*
* Aborts use `signal.reason` or an `AbortError` fallback. The rejection remains
* observed when no read is pending, and source cleanup is fire-and-forget because
* a stalled stream may also stall `iterator.return()`.
*/
export async function* abortable<T>(
source: AsyncIterable<T>,
signal: AbortSignal,
): AsyncGenerator<T> {
let abort = () => {};
const aborted = new Promise<never>((_, reject) => {
abort = () =>
reject(signal.reason ?? new DOMException("The operation was aborted", "AbortError"));
if (signal.aborted) abort();
else signal.addEventListener("abort", abort, { once: true });
});
aborted.catch(() => {});

const iterator = source[Symbol.asyncIterator]();
try {
for (;;) {
const result = await Promise.race([iterator.next(), aborted]);
if (result.done) return;
yield result.value;
}
} finally {
signal.removeEventListener("abort", abort);
void iterator.return?.()?.catch(() => {});
}
}
Loading
Loading