The whole hunk
from line 56, old and new numbered
/
lines
from line 56
5656
5757<CodeGroup>
5858 ```bash cURL
59 rubric=$(curl -fsSL https://api.anthropic.com/v1/files \
59 curl -fsSL https://api.anthropic.com/v1/files \
6060 -H "x-api-key: $ANTHROPIC_API_KEY" \
6161 -H "anthropic-version: 2023-06-01" \
6262 -H "anthropic-beta: managed-agents-2026-04-01" \
63 -F file=@/tmp/rubric.md)
64 rubric_id=$(jq -r '.id' <<<"$rubric")
65 printf 'Uploaded rubric: %s\n' "$rubric_id"
63 -F file=@/tmp/rubric.md
6664 ```
6765
6866 ```bash CLI
69 RUBRIC_ID=$(ant files upload \
70 --file /tmp/rubric.md \
71 --transform id --raw-output)
67 ant files upload --file /tmp/rubric.md
7268 ```
7369
7470 ```python Python
from line 293
297293 -H "anthropic-beta: managed-agents-2026-04-01" \
298294 --json @- <<EOF
299295 {
300 "agent": "$agent_id",
301 "environment_id": "$environment_id",
296 "agent": "$AGENT_ID",
297 "environment_id": "$ENVIRONMENT_ID",
302298 "title": "Financial analysis on Costco"
303299 }
304300 EOF
305301 )
306 session_id=$(jq -r '.id' <<<"$session")
302 SESSION_ID=$(jq -r '.id' <<<"$session")
307303
308304 # Define the outcome — agent starts working on receipt
309 curl -fsSL "https://api.anthropic.com/v1/sessions/$session_id/events" \
305 curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \
310306 -H "x-api-key: $ANTHROPIC_API_KEY" \
311307 -H "anthropic-version: 2023-06-01" \
312308 -H "anthropic-beta: managed-agents-2026-04-01" \
from line 318
322318 ]
323319 }
324320 EOF
325 # or: "rubric": {"type": "file", "file_id": "$rubric_id"}
321 # or: "rubric": {"type": "file", "file_id": "$RUBRIC_ID"}
326322 # "max_iterations" is optional; default 3, max 20
327323 ```
328324
from line 623
627623
628624<CodeGroup>
629625 ```bash cURL
630 session=$(curl -fsSL "https://api.anthropic.com/v1/sessions/$session_id" \
626 curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID" \
631627 -H "x-api-key: $ANTHROPIC_API_KEY" \
632628 -H "anthropic-version: 2023-06-01" \
633 -H "anthropic-beta: managed-agents-2026-04-01")
634
635 jq -r '.outcome_evaluations[] | "\(.outcome_id): \(.result)"' <<<"$session"
636 # outc_01a...: satisfied
629 -H "anthropic-beta: managed-agents-2026-04-01"
637630 ```
638631
639632 ```bash CLI
640 ant beta:sessions retrieve --session-id "$SESSION_ID" \
641 --transform 'outcome_evaluations' --format yaml
633 ant beta:sessions retrieve --session-id "$SESSION_ID"
642634 ```
643635
644636 ```python Python
from line 708
716708 ```bash cURL
717709 # List files produced by this session
718710 # scope_id filtering requires the managed-agents beta
719 files=$(curl -fsSL "https://api.anthropic.com/v1/files?scope_id=$session_id" \
711 curl -fsSL "https://api.anthropic.com/v1/files?scope_id=$SESSION_ID" \
720712 -H "x-api-key: $ANTHROPIC_API_KEY" \
721713 -H "anthropic-version: 2023-06-01" \
722 -H "anthropic-beta: managed-agents-2026-04-01")
723 jq -r '.data[] | "\(.id) \(.filename)"' <<<"$files"
714 -H "anthropic-beta: managed-agents-2026-04-01"
724715
725716 # Download a file
726 file_id=$(jq -r '.data[0].id // empty' <<<"$files")
727 if [[ -n $file_id ]]; then
728 curl -fsSL "https://api.anthropic.com/v1/files/$file_id/content" \
717 FILE_ID=$(curl -fsSL "https://api.anthropic.com/v1/files?scope_id=$SESSION_ID" \
718 -H "x-api-key: $ANTHROPIC_API_KEY" \
719 -H "anthropic-version: 2023-06-01" \
720 -H "anthropic-beta: managed-agents-2026-04-01" | jq -r '.data[0].id // empty')
721 if [[ -n $FILE_ID ]]; then
722 curl -fsSL "https://api.anthropic.com/v1/files/$FILE_ID/content" \
729723 -H "x-api-key: $ANTHROPIC_API_KEY" \
730724 -H "anthropic-version: 2023-06-01" \
731725 -H "anthropic-beta: managed-agents-2026-04-01" \