Skip to content

Commit e6d2e49

Browse files
committed
docs(runtime): document invoke workflows
1 parent 880fb46 commit e6d2e49

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
@@ -116,6 +117,78 @@ agentcore identity api-key-credential-provider update --name my-provider --api-k
116117
agentcore identity api-key-credential-provider delete --name my-provider
117118
```
118119

120+
### Invoke a Runtime
121+
122+
Runtime invocation accepts inline, file, or stdin payload bytes:
123+
124+
```bash
125+
# Inline
126+
agentcore runtime invoke \
127+
--id <runtimeId> \
128+
--payload '{"action":"status"}' \
129+
--content-type application/json \
130+
--accept text/event-stream
131+
132+
# File
133+
agentcore runtime invoke --id <runtimeId> --payload file://request.json
134+
135+
# stdin
136+
cat request.json | agentcore runtime invoke --id <runtimeId> --payload -
137+
```
138+
139+
CUSTOM_JWT Runtimes require `--bearer-token`. The token accepts the same inline,
140+
`file://`, or stdin sources as the payload; payload and token cannot both read
141+
stdin.
142+
143+
```bash
144+
agentcore runtime invoke \
145+
--id <runtimeId> \
146+
--payload file://request.json \
147+
--bearer-token file://$HOME/.config/agentcore/runtime-token
148+
```
149+
150+
For MCP Runtimes, initialize first, then pass the returned Runtime and MCP
151+
session IDs to later methods. MCP requests accept both JSON and SSE responses.
152+
153+
```bash
154+
agentcore runtime invoke \
155+
--id <runtimeId> \
156+
--payload '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"agentcore-cli","version":"1"}}}' \
157+
--accept 'application/json, text/event-stream' \
158+
--mcp-protocol-version 2025-03-26 \
159+
--mcp-method initialize
160+
161+
agentcore runtime invoke \
162+
--id <runtimeId> \
163+
--payload '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
164+
--accept 'application/json, text/event-stream' \
165+
--session-id <returnedRuntimeSessionId> \
166+
--mcp-session-id <returnedMcpSessionId> \
167+
--mcp-protocol-version 2025-03-26 \
168+
--mcp-method tools/list
169+
```
170+
171+
Raw mode streams exact response bytes to stdout and writes response metadata to
172+
stderr. Use `--output-file` for binary responses. `--json` instead buffers one
173+
response and emits a metadata envelope without interpreting the customer body.
174+
175+
```bash
176+
agentcore runtime invoke \
177+
--id <runtimeId> \
178+
--payload file://request.bin \
179+
--content-type application/octet-stream \
180+
--accept application/octet-stream \
181+
--output-file response.bin
182+
183+
agentcore runtime invoke --id <runtimeId> --payload '{"action":"status"}' --json
184+
# {"statusCode":200,"contentType":"application/json","bodyEncoding":"utf8","body":"{\"ok\":true}","complete":true}
185+
```
186+
187+
Runtime Invoke accepts Runtime IDs from the current account only. It does not
188+
accept ARNs, `--version`, `--interactive`, cross-account targets, or custom
189+
request paths. All requests use the Runtime `/invocations` route, including MCP
190+
Runtimes.
191+
119192
Bare Runtime branches and leaves require a TTY on stdin and stdout. Supplying
120193
operation flags runs the command headlessly, and `--json` always suppresses TUI
121194
rendering.

0 commit comments

Comments
 (0)