@@ -58,6 +58,7 @@ agentcore # interactive TUI
5858├── runtime # inspect deployed AgentCore Runtimes
5959│ ├── get # fetch a Runtime by id
6060│ ├── list # list Runtimes (server-side paginated)
61+ │ ├── invoke # invoke a Runtime
6162│ ├── version
6263│ │ ├── get # get a specific Runtime version
6364│ │ └── list # list a Runtime's versions
@@ -162,6 +163,85 @@ Source-aware values: any field flag documented as such accepts the value inline,
162163` file:// ` convention). A command reads stdin from at most one flag. For example,
163164` --instructions file://order-quality.txt ` or ` --instructions - ` .
164165
166+ ### Invoke a Runtime
167+
168+ Runtime invocation accepts inline, file, or stdin payload bytes:
169+
170+ ``` bash
171+ # Inline
172+ agentcore runtime invoke \
173+ --id < runtimeId> \
174+ --payload ' {"action":"status"}' \
175+ --content-type application/json \
176+ --accept text/event-stream
177+
178+ # File
179+ agentcore runtime invoke --id < runtimeId> --payload file://request.json
180+
181+ # stdin
182+ cat request.json | agentcore runtime invoke --id < runtimeId> --payload -
183+ ```
184+
185+ CUSTOM_JWT Runtimes require ` --bearer-token ` . The token accepts the same inline,
186+ ` file:// ` , or stdin sources as the payload; payload and token cannot both read
187+ stdin.
188+
189+ ``` bash
190+ agentcore runtime invoke \
191+ --id < runtimeId> \
192+ --payload file://request.json \
193+ --bearer-token file://$HOME /.config/agentcore/runtime-token
194+ ```
195+
196+ For MCP Runtimes, initialize first, then pass the returned Runtime and MCP
197+ session IDs to later methods. MCP requests accept both JSON and SSE responses.
198+
199+ ``` bash
200+ agentcore runtime invoke \
201+ --id < runtimeId> \
202+ --payload ' {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"agentcore-cli","version":"1"}}}' \
203+ --accept ' application/json, text/event-stream' \
204+ --mcp-protocol-version 2025-03-26 \
205+ --mcp-method initialize
206+
207+ agentcore runtime invoke \
208+ --id < runtimeId> \
209+ --payload ' {"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
210+ --accept ' application/json, text/event-stream' \
211+ --session-id < returnedRuntimeSessionId> \
212+ --mcp-session-id < returnedMcpSessionId> \
213+ --mcp-protocol-version 2025-03-26 \
214+ --mcp-method tools/list
215+ ```
216+
217+ Raw stdout always streams exact response bytes as they arrive, regardless of
218+ content type. ` --output-file ` streams the same bytes directly to disk. Binary or
219+ unknown responses require ` --output-file ` or ` --json ` when stdout is a terminal.
220+ Response metadata is written to stderr.
221+
222+ ` --json ` buffers the complete response, including streaming representations, and
223+ emits one metadata envelope without interpreting the customer body. If a raw or
224+ file response fails, bytes already written remain available and the stderr
225+ summary reports ` complete=false ` . A failed JSON response emits no partial
226+ envelope.
227+
228+ ``` bash
229+ agentcore runtime invoke \
230+ --id < runtimeId> \
231+ --payload file://request.bin \
232+ --content-type application/octet-stream \
233+ --accept application/octet-stream \
234+ --output-file response.bin
235+
236+ agentcore runtime invoke --id < runtimeId> --payload ' {"action":"status"}' --json
237+ # {"statusCode":200,"contentType":"application/json","bodyEncoding":"utf8","body":"{\"ok\":true}","complete":true}
238+ ```
239+
240+ Runtime Invoke accepts Runtime IDs from the current account only. It does not
241+ accept ARNs, ` --version ` , ` --interactive ` , cross-account targets, or custom
242+ request paths. All requests use the Runtime ` /invocations ` route, including MCP
243+ Runtimes.
244+
165245Bare Runtime branches and leaves require a TTY on stdin and stdout. Supplying
166246operation flags runs the command headlessly, and ` --json ` always suppresses TUI
167247rendering.
0 commit comments