iri-api
Skill30 starsChanged 50 days agoBSD-2-ClauseView on GitHub
Use this skill to work with IRI API deployments at NERSC (https://api.iri.nersc.gov) and ALCF (https://api.alcf.anl.gov) via reproducible scripts, including Globus token lifecycle management (status, refresh, interactive login) and OpenAPI-driven endpoint execution for facility/status/account/compute/filesystem/task workflows. Trigger this skill when the task mentions IRI API, openapi.json-driven calls, authenticated endpoint access, job submission/status/cancel, file operations, task polling/cleanup, or running jobs on Perlmutter or Polaris.
In this repository30 other files it gives its agents.
- skills/academy/agents.mdAGENTS.md
- academySkill
- amsc-data-movement-apiSkill
- amsc-magSkill
- amsc-python-clientSkill
- globus-computeSkill
- i2-apiSkill
- skill-explorerSkill
- croissant-validatorSkill
- datacard-generatorSkill
- hdmf-schema-builderSkill
- skill-creatorSkill
- well-convertSkill
- card-eval-updaterSkill
- agentic-vulnerabilities-scanSkill
- ai-fingerprintSkill
- battleprintSkill
- fingerprintingSkill
- uncertainty-quantificationSkill
- uq-metrics-evaluatorSkill
- skill-searchSkill
- auroraSkill
- frontierSkill
- pbsSkill
- perlmutterSkill
- slurmSkill
- literature-searchSkill
- multi-agent-systemsSkill
- gkeyllSkill
- gs2Skill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 2 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Use scripted workflows. Prefer the bundled scripts over hand-written curl commands.
- Very specific: line 21
Use the unified token manager for both sites.
- Distinctive: line 43
Ensure a usable token for authenticated endpoints:
- Very specific: line 48
If the IRI API still returns 401, force a fresh identity-provider login:
- Very specific: line 59
Call an endpoint by operationId:
- Very specific: line 67
Use scripts/token_manager.py for all token lifecycle actions.
- Very specific: line 102
Default token file: ~/.globus/auth_tokens.json
- Very specific: line 107
If validation reports empty session_info.authentications, re-run with --force-login --prompt-login and complete the flow in a Chrome …
- Very specific: line 111
Use scripts/iri_api_call.py for all API calls.
- Very specific: line 135
Use --ensure-token so calls auto-refresh/login if needed.
- Very specific: line 203
Prefer --operation-id over manual --method/--path.
- Very specific: line 211
Use --facility nersc or --facility alcf on scripts/iri_api_call.py so the API server and bearer token selection stay aligned.
- Distinctive: line 215
Before generating a compute job request, check whether the user wants any of the following:
- Very specific: line 220
If any of those are needed, use a pre_launch or post_launch script to carry that logic instead of trying to force it into a single launch …
- Very specific: line 223
Do not include #SBATCH or #PBS directives in pre_launch or post_launch.
- Very specific: line 225
Put extra srun or mpiexec lines, affinity settings, environment setup, and teardown logic in those scripts as plain shell commands.
- Very specific: line 245
Use templates from references/examples/:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
IRI API
Use scripted workflows. Prefer the bundled scripts over hand-written curl commands.
Deployments
| Site | Base URL | Auth script | Reference |
| NERSC (Perlmutter) | https://api.iri.nersc.gov (default) | scripts/token_manager.py ensure --facilities nersc | references/NERSC.md |
| ALCF (Polaris) | https://api.alcf.anl.gov | scripts/token_manager.py ensure --facilities alcf | references/ALCF.md |
Before doing any work, read the reference file for the relevant site. Do not proceed from memory.
Use the unified token manager for both sites. By default it can manage both NERSC and ALCF tokens together, but when the user is focused on one site, scope it with --facilities nersc or --facilities alcf.
--facility is a global flag on iri_api_call.py and must come before the subcommand:
# Correct
python3 scripts/iri_api_call.py --facility nersc call --operation-id getProjects --ensure-token
python3 scripts/iri_api_call.py --facility alcf call --operation-id launchJob ...
# Wrong
python3 scripts/iri_api_call.py call --facility nersc --operation-id getProjects--base-url and --openapi-url follow the same rule: they are global flags and must also come before the subcommand.
Quick Start
- Check token state:
python3 scripts/token_manager.py status --json- Ensure a usable token for authenticated endpoints:
python3 scripts/token_manager.py ensure --min-ttl 300If the IRI API still returns 401, force a fresh identity-provider login:
python3 scripts/token_manager.py ensure --force-login --prompt-login --validate-iri- List available operations from OpenAPI:
python3 scripts/iri_api_call.py --facility nersc list-operations
python3 scripts/iri_api_call.py --facility alcf list-operations- Call an endpoint by
operationId:
python3 scripts/iri_api_call.py --facility nersc call --operation-id getResources
python3 scripts/iri_api_call.py --facility alcf call --operation-id getResourcesToken Management
Use scripts/token_manager.py for all token lifecycle actions.
- Check token state:
python3 scripts/token_manager.py status --json
python3 scripts/token_manager.py status --facilities nersc --json
python3 scripts/token_manager.py status --facilities alcf --json- Ensure usable tokens:
python3 scripts/token_manager.py ensure --min-ttl 300
python3 scripts/token_manager.py ensure --facilities nersc --min-ttl 300
python3 scripts/token_manager.py ensure --facilities alcf --min-ttl 300- Refresh or login for selected facilities only:
python3 scripts/token_manager.py ensure --facilities nersc --refresh-only
python3 scripts/token_manager.py ensure --facilities alcf --refresh-only- Validate the facility token against the matching API:
python3 scripts/token_manager.py ensure --facilities nersc --validate-iri --validate-facility nersc
python3 scripts/token_manager.py ensure --facilities alcf --validate-iri --validate-facility alcf- Print selected facility access tokens:
python3 scripts/token_manager.py ensure --print-token
python3 scripts/token_manager.py ensure --facilities alcf --print-tokenNotes:
- Default token file:
~/.globus/auth_tokens.json - The saved file preserves the full Globus token response, including
other_tokens. - The usable IRI API bearer token is extracted from
other_tokens, not the top-level Globus Auth token. - Required scopes are enforced by script validation.
globus-sdkis required for refresh/login operations.- If validation reports empty
session_info.authentications, re-run with--force-login --prompt-loginand complete the flow in a Chrome incognito window.
Endpoint Execution
Use scripts/iri_api_call.py for all API calls.
Operation Discovery
- List all operations:
python3 scripts/iri_api_call.py --facility nersc list-operations
python3 scripts/iri_api_call.py --facility alcf list-operations- See generated static reference:
references/operations.md
Public Endpoints (No Token Required)
Examples:
python3 scripts/iri_api_call.py --facility nersc call --operation-id getFacility
python3 scripts/iri_api_call.py --facility nersc call --operation-id getIncidents
python3 scripts/iri_api_call.py --facility nersc call --operation-id getResource --path-param resource_id=perlmutterAuthenticated Endpoints (Token Required)
Use --ensure-token so calls auto-refresh/login if needed.
- Account / project context:
python3 scripts/iri_api_call.py --facility nersc call --operation-id getProjects --ensure-token
python3 scripts/iri_api_call.py --facility alcf call --operation-id getProjects --ensure-token- Submit compute job (request body from file):
python3 scripts/iri_api_call.py --facility nersc call \
--operation-id launchJob \
--path-param resource_id=perlmutter \
--json-file /path/to/job.json \
--ensure-token- Query one job:
python3 scripts/iri_api_call.py --facility nersc call \
--operation-id getJob \
--path-param resource_id=perlmutter \
--path-param job_id=12345 \
--ensure-token- Cancel job:
python3 scripts/iri_api_call.py --facility nersc call \
--operation-id cancelJob \
--path-param resource_id=perlmutter \
--path-param job_id=12345 \
--ensure-token- Filesystem list/view:
python3 scripts/iri_api_call.py --facility nersc call \
--operation-id ls \
--path-param resource_id=perlmutter \
--query path=/global/cfs/cdirs \
--ensure-token
python3 scripts/iri_api_call.py --facility nersc call \
--operation-id view \
--path-param resource_id=perlmutter \
--query path=/path/to/file.txt \
--ensure-token- Upload file:
python3 scripts/iri_api_call.py --facility nersc call \
--operation-id upload \
--path-param resource_id=perlmutter \
--query path=/path/on/resource/target.dat \
--upload-file /local/path/source.dat \
--ensure-token- Poll task state:
python3 scripts/iri_api_call.py --facility nersc call --operation-id getTasks --ensure-token
python3 scripts/iri_api_call.py --facility nersc call --operation-id getTask --path-param task_id=<task_id> --ensure-tokenShared Parameter Rules
- Prefer
--operation-idover manual--method/--path. - Provide required path params via repeated
--path-param key=value. - Provide query params via repeated
--query key=value. - Use one of:
--json-file /path/to/body.json--json-body '{"key":"value"}'--upload-file /path/to/local.filefor multipart endpoints
- For binary or large outputs, use
--output-file /path/to/out.bin. - Use
--facility nerscor--facility alcfonscripts/iri_api_call.pyso the API server and bearer token selection stay aligned.
Job Construction Guidance
Before generating a compute job request, check whether the user wants any of the following:
- A multistep job with multiple
srunormpiexeclines. - Additional job-control behavior that is not covered by the API
attributesfields. - Explicit affinity or binding control beyond the basic resource request.
If any of those are needed, use a pre_launch or post_launch script to carry that logic instead of trying to force it into a single launch line or into unsupported attributes.
Rules for these scripts:
- Do not include
#SBATCHor#PBSdirectives inpre_launchorpost_launch. - The scheduler directives belong in the batch script generated by the API server, not inside the pre/post scripts.
- Put extra
srunormpiexeclines, affinity settings, environment setup, and teardown logic in those scripts as plain shell commands. - For NERSC-oriented launch structure and Slurm examples, use
https://docs.nersc.gov/jobs/examples/. - For ALCF-oriented launch structure and PBS examples, use
https://docs.alcf.anl.gov/running-jobs/example-job-scripts/#cpu-mpi-openmp-examples.
Reproducibility and Reference Refresh
Regenerate endpoint reference after OpenAPI updates:
python3 scripts/generate_operation_reference.py \
--openapi references/openapi.json \
--output references/operations.mdRegenerate request payload templates:
python3 scripts/generate_examples.pyUse templates from references/examples/:
compute-launch-job.jsoncompute-status-filters.jsonfilesystem-mkdir.jsonfilesystem-mv.jsonfilesystem-cp.jsonfilesystem-compress.jsonfilesystem-extract.jsonfilesystem-chmod.jsonfilesystem-chown.json
Example calls using generated templates:
python3 scripts/iri_api_call.py --facility nersc call \
--operation-id launchJob \
--path-param resource_id=perlmutter \
--json-file references/examples/compute-launch-job.json \
--ensure-token
python3 scripts/iri_api_call.py --facility nersc call \
--operation-id mkdir \
--path-param resource_id=perlmutter \
--json-file references/examples/filesystem-mkdir.json \
--ensure-tokenUseful Endpoint Groups
- Facility + status (public): infrastructure metadata and incident visibility.
- Account (auth): user projects and allocation hierarchy.
- Compute (auth): submit/update/status/cancel jobs.
- Filesystem (auth): list/read/write/upload/download and file operations.
- Task (auth): check asynchronous task progress and cleanup.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

