migration changedmanaged-agents/migration
Nearest release: v2.1.304, published under an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+12added
Lines−88removed
From line
249
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits22to this page, all time
The whole hunk
from line 249, old and new numbered
/
from line 249
249249
250250**After** (Claude Managed Agents):
251251
252<CodeGroup>
253 ```bash cURL
254 agent=$(
255 curl --fail-with-body -sS "https://api.anthropic.com/v1/agents?beta=true" \
256 -H "x-api-key: ${ANTHROPIC_API_KEY}" \
257 -H "anthropic-version: 2023-06-01" \
258 -H "anthropic-beta: managed-agents-2026-04-01" \
259 --json '{
260 "name": "Task Runner",
261 "model": "claude-opus-5-5",
262 "tools": [{"type": "agent_toolset_20260401"}]
263 }'
264 )
265 agent_id=$(jq -r '.id' <<< "${agent}")
252<CodeGroup exclude="shell:cURL, shell:CLI">
253 <CodeGroupItem language="cURL">
254 This workflow needs more logic than a single shell command. Use the [Claude SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) to run it.
255 </CodeGroupItem>
266256
267 session_id=$(
268 curl --fail-with-body -sS "https://api.anthropic.com/v1/sessions?beta=true" \
269 -H "x-api-key: ${ANTHROPIC_API_KEY}" \
270 -H "anthropic-version: 2023-06-01" \
271 -H "anthropic-beta: managed-agents-2026-04-01" \
272 --json "$(jq -n --argjson a "${agent}" --arg env "${environment_id}" \
273 '{agent: {type: "agent", id: $a.id, version: $a.version}, environment_id: $env}')" \
274 | jq -r '.id'
275 )
276
277 # Open the SSE stream in the background, then send the user message.
278 stream_log=$(mktemp)
279 curl --fail-with-body -sS -N \
280 "https://api.anthropic.com/v1/sessions/${session_id}/events/stream?beta=true" \
281 -H "x-api-key: ${ANTHROPIC_API_KEY}" \
282 -H "anthropic-version: 2023-06-01" \
283 -H "anthropic-beta: managed-agents-2026-04-01" \
284 > "${stream_log}" &
285 stream_pid=$!
286
287 curl --fail-with-body -sS \
288 "https://api.anthropic.com/v1/sessions/${session_id}/events?beta=true" \
289 -H "x-api-key: ${ANTHROPIC_API_KEY}" \
290 -H "anthropic-version: 2023-06-01" \
291 -H "anthropic-beta: managed-agents-2026-04-01" \
292 --json "$(jq -n --arg text "${task}" \
293 '{events: [{type: "user.message", content: [{type: "text", text: $text}]}]}')" \
294 > /dev/null
295
296 # Wait for the session to go idle. grep exits at the first match, and
297 # reading via process substitution means the shell doesn't wait for
298 # tail (a foreground `tail -f | grep -m1` pipeline would hang: tail
299 # only dies on its next write, which never comes once the stream is idle).
300 grep -m1 '"session.status_idle"' <(tail -f -n +1 "${stream_log}") > /dev/null
301
302 kill "${stream_pid}" 2>/dev/null || true
303 ```
304
305 <CodeGroupItem>
306 ```bash CLI
307 ant apply agent.md
308
309 session_id=$(ant beta:sessions create \
310 --agent "{type: agent, id: $agent_id, version: $agent_version}" \
311 --environment-id "$environment_id" \
312 --transform id --raw-output)
313
314 # Open the stream first, then send the user message
315 exec {stream}< <(ant beta:sessions:events stream \
316 --session-id "$session_id" \
317 --transform type --raw-output)
318
319 ant beta:sessions:events send \
320 --session-id "$session_id" \
321 --event "{type: user.message, content: [{type: text, text: \"$task\"}]}" \
322 > /dev/null
323
324 # Wait for the session to go idle (grep exits at the first match)
325 grep -m1 -x 'session.status_idle' <&"$stream" > /dev/null
326 exec {stream}<&-
327 ```
328
329 <File filename="agent.md">
330 ```markdown
331 ---
332 name: Task Runner
333 model: claude-opus-5-5
334 tools:
335 - type: agent_toolset_20260401
336 ---
337 ```
338 </File>
257 <CodeGroupItem language="CLI">
258 This workflow needs more logic than a single shell command. Use the [Claude SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) to run it.
339259 </CodeGroupItem>
340260
341261 ```python Python
from line 1291
13711291 -H "x-api-key: $ANTHROPIC_API_KEY" \
13721292 -H "anthropic-version: 2023-06-01" \
13731293 -H "anthropic-beta: managed-agents-2026-04-01" \
1374 --json "$(jq -n --argjson version "$AGENT_VERSION" '{version: $version, model: "claude-opus-5-5"}')"
1294 -H "content-type: application/json" \
1295 -d '{
1296 "version": '"$AGENT_VERSION"',
1297 "model": "claude-opus-5-5"
1298 }'
13751299 ```
13761300
13771301 <CodeGroupItem>
No line in this hunk matches that.