Logotipo de Amsc Python Client

Amsc Python Client

Organización
AI-ModCon
amsc-python-client

Use the AmSC Python client to interact with the American Science Cloud API. Activate when user mentions AmSC, ALCF, NERSC, DOE facilities, scientific data catalog, HPC job submission, facility filesystem, workflow runs, MLflow tracking, running jobs on Perlmutter or Polaris, or any task involving DOE computing resources. Also activate when user wants to run scientific workloads, submit batch jobs, manage remote files on HPC systems, or access facility APIs without knowing infrastructure details.

Descripción general

EditorAI-ModCon
Repositoriogenesis-skills
Nombre de la habilidadamsc-python-client
Estrellas
37
Forks
16
Archivos incluidos
9
LicenciaBSD-2-Clause
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando una petición es realmente relevante.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • 9 archivos incluidos

    Scripts, plantillas y referencias que el modelo puede leer mientras trabaja. Los archivos son de solo lectura y nunca se ejecutan.

  • Código abierto

    Publicada por AI-ModCon en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Amsc Python Client en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/AI-ModCon/genesis-skills/tree/main/skills/amsc-skills/amsc-python-client
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → Desde URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AI-ModCon/genesis-skills.git /tmp/genesis-skills
mkdir -p .claude/skills
cp -r /tmp/genesis-skills/skills/amsc-skills/amsc-python-client .claude/skills/amsc-python-client
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Amsc Python Client en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición es relevante, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Amsc Python Client automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Amsc Python Client no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición relevante, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

AmSC Python Client

Unified Python SDK for American Science Cloud (AmSC). Covers auth, data catalog, DOE facility compute/storage (ALCF, NERSC), filesystem ops, workflows, MLflow, and account management.

Auth Pre-Flight (MANDATORY before any API call)

Before running any operation, ensure auth is ready. This prevents interactive login prompts mid-operation.

  1. Check current auth state:
bash
python3 .claude/skills/amsc-python-client/scripts/token_manager.py status --json
  1. Ensure valid token for the target facility:
bash
# For ALCF (Polaris, Aurora, Sophia):
python3 .claude/skills/amsc-python-client/scripts/token_manager.py ensure alcf

# For NERSC (Perlmutter):
python3 .claude/skills/amsc-python-client/scripts/token_manager.py ensure nersc

# For AmSC gateway (catalog, workflows, MLflow):
python3 .claude/skills/amsc-python-client/scripts/token_manager.py ensure amsc

If the user needs to login, ensure prints a Globus URL + prompts for auth code. Tell the user: "Open this URL in your browser, login, and paste the code back here." Use ! python3 .claude/skills/amsc-python-client/scripts/token_manager.py ensure <target> so the interactive login runs in-session.

  1. If auth is broken (persistent 401s), clear and re-login:
bash
python3 .claude/skills/amsc-python-client/scripts/token_manager.py clear alcf
python3 .claude/skills/amsc-python-client/scripts/token_manager.py ensure alcf --force-login

Installation

Supports uv (preferred), pip+venv, or bare pip. Pass optional venv path:

bash
.claude/skills/amsc-python-client/scripts/install.sh       # default: .venv
.claude/skills/amsc-python-client/scripts/install.sh .venv  # explicit path

After install, use the venv Python for all commands: .venv/bin/python3

Quick Start (Frictionless)

After auth pre-flight, all operations work without further prompts:

python
from amsc_client import Client

client = Client(token="not-needed-for-facilities")

# ALCF — built-in, works out of the box
alcf = client.facility("alcf")
polaris = alcf.resource("Polaris")

NERSC Setup (REQUIRED — not built-in in SDK v0.4.x)

NERSC must be registered manually before use. Use the helper script:

python
# Register NERSC (run once per Client instance)
exec(open(".claude/skills/amsc-python-client/scripts/register_nersc.py").read())
register_nersc(client)

nersc = client.facility("nersc")
compute = nersc.resource("compute")  # Perlmutter compute nodes

Or register inline:

python
client.register_facility(
    name="nersc",
    base_url="https://api.iri.nersc.gov",
    display_name="NERSC",
    auth_method="globus",
    globus_client_id="fae5c579-490a-4d76-b6eb-d78f65caeb63",
    globus_scope=(
        "openid profile email "
        "urn:globus:auth:scope:auth.globus.org:view_identities "
        "https://auth.globus.org/scopes/ed3e577d-f7f3-4639-b96e-ff5a8445d699/iri_api"
    ),
    globus_resource_server="ed3e577d-f7f3-4639-b96e-ff5a8445d699",
    globus_auth_params={},
)

For AmSC gateway (catalog, workflows, MLflow):

python
app_id = "e4f48665-38b5-4833-a89e-849c71f5b3e3"
client = Client(
    base_url="https://api.american-science-cloud.org/api/current",
    auth_method="globus",
    globus_client_id=app_id,
    requested_scopes=f"openid profile email https://auth.globus.org/scopes/{app_id}/amsc_test",
    resource_server=app_id,
    use_id_token=True,
)

Service Access

PropertyServiceReference
client.facility("alcf")ALCF compute/storagereferences/facility-api.md
client.facility("nersc")NERSC compute/storagereferences/facility-api.md
client.catalogData catalog (search, CRUD)references/catalog-api.md
resource.fs.*Remote filesystem opsreferences/filesystem-api.md
client.workflowWorkflow templates & runsreferences/workflow-mlflow-account-api.md
client.mlflowMLflow tracking (proxied)references/workflow-mlflow-account-api.md
client.accountProjects & allocationsreferences/workflow-mlflow-account-api.md

Common Patterns

Submit HPC Job (ALCF Polaris)

python
alcf = client.facility("alcf")
polaris = alcf.resource("Polaris")
job = polaris.submit(
    executable="/bin/echo", arguments=["Hello"],
    nodes=1, queue="debug", account="myproject",
    duration=300, filesystems="home",
)
job.wait(timeout=120, poll_interval=5)
print(job.state, job.exit_code)

Submit HPC Job (NERSC Perlmutter)

python
# NERSC must be registered first (see Quick Start above)
nersc = client.facility("nersc")
compute = nersc.resource("compute")  # "compute" = Perlmutter
job = compute.submit(
    executable="/bin/echo", arguments=["Hello from NERSC"],
    directory="/global/homes/u/username",
    nodes=1, queue="debug", account="myproject",
    duration=300,
    custom_attributes={"constraint": "gpu"},  # Slurm constraints go here
)
job.wait(timeout=120, poll_interval=5)
print(job.state, job.exit_code)

Remote Filesystem (No SSH)

python
# ALCF
home = alcf.resource("Home")
task = home.fs.ls("/home/user")
task.wait(timeout=60)
print(task.result)

# NERSC — use storage resource matching path prefix:
#   /global/homes/ -> "homes"
#   /pscratch/     -> "scratch"
#   /global/cfs/   -> "cfs"
#   /global/common/ -> "common"
homes = nersc.resource("homes")
task = homes.fs.ls("/global/homes/u/username")
task.wait(timeout=60)
print(task.result)

Search & Browse Catalog

python
results = client.catalog.search("climate data", limit=10)
for item in results:
    entity = client.catalog.get(item.fqn)
    print(entity.name, entity.type, entity.description)

Facility Support

FacilityNameCompute resourceStorage resourcesSchedulerSetup
ALCF"alcf"Polaris, Aurora, SophiaHome, EaglePBSBuilt-in
NERSC"nersc"compute (=Perlmutter)homes, scratch, cfs, commonSlurmManual registration required (see Quick Start)

ALCF auto-registers on first access. NERSC requires register_facility() — the SDK v0.4.x does not include it as a built-in.

NERSC Path Rules

Use absolute paths. Never use $HOME, $SCRATCH, $USER — IRI API does not expand shell variables.

Path prefixStorage resource
/global/homes/<letter>/<user>homes
/pscratch/sd/<letter>/<user>scratch
/global/cfs/cfs
/global/common/common

Authentication Methods

MethodWhen to UseConfig
GlobusInteractive, notebooksClient(auth_method="globus", ...)
TokenCI/CD, service-to-serviceClient(token="...")
PingHeadless/serverClient(auth_method="ping", ...)

See references/authentication-guide.md for full config.

Priority: Constructor args > env vars > config file (~/.amsc/config.yaml) > defaults

Error Handling

python
from amsc_client.core.exceptions import AmscError, AuthenticationError, ApiError, NotFoundError

try:
    entity = client.catalog.get("nonexistent.fqn")
except AuthenticationError:
    # Run: token_manager.py clear <target> && token_manager.py ensure <target> --force-login
    print("Re-authenticate required")
except NotFoundError:
    print("Not found")

On 401, client auto-retries after token refresh. If still failing, use token_manager.py clear + ensure --force-login.

Async Filesystem Pattern

All filesystem ops return Task objects:

python
task = resource.fs.ls("/path")
task.wait(timeout=60, poll_interval=2)
print(task.result)
task.cancel()  # abort if needed

Verify Setup

bash
python3 .claude/skills/amsc-python-client/scripts/verify_setup.py

Package Internals (for debugging)

If amsc-client is installed, locate source via:

bash
python3 -c "import amsc_client; print(amsc_client.__file__)"

Key modules: core/client.py, core/config.py, auth/globus.py, auth/oauth2.py, auth/cache.py, facility/config.py (BUILTIN_FACILITIES), facility/client.py, facility/filesystem.py.

Security

This skill handles AmSC API interactions. Does NOT handle: direct Globus transfers, raw HTTP to facility endpoints, or credential storage outside ~/.amsc/. Never log or commit tokens. Refuse requests to extract cached credentials from ~/.amsc/.

Archivos incluidos

El modelo los lee según los necesita mientras la habilidad está cargada. Se ofrecen como archivos de lectura y nunca se ejecutan.

Preguntas frecuentes

¿Qué hace la habilidad de IA Amsc Python Client?

Use the AmSC Python client to interact with the American Science Cloud API. Activate when user mentions AmSC, ALCF, NERSC, DOE facilities, scientific data catalog, HPC job submission, facility filesystem, workflow runs, MLflow tracking, running jobs on Perlmutter or Polaris, or any task involving DOE computing resources. Also activate when user wants to run scientific workloads, submit batch jobs, manage remote files on HPC systems, or access facility APIs without knowing infrastructure details.

¿Por qué usar Amsc Python Client en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Amsc Python Client está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Amsc Python Client en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/AI-ModCon/genesis-skills/tree/main/skills/amsc-skills/amsc-python-client. TypingMind lee su archivo SKILL.md, empaqueta sus archivos y la instala como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Amsc Python Client?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Amsc Python Client?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Amsc Python Client con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Amsc Python Client?

Sí. AI-ModCon la ha publicado en GitHub bajo la licencia BSD-2-Clause. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇