Logo de Amsc Python Client

Amsc Python Client

Organização
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.

Visão geral

Publicado porAI-ModCon
Repositóriogenesis-skills
Nome da habilidadeamsc-python-client
Estrelas
37
Forks
16
Arquivos incluídos
9
LicençaBSD-2-Clause
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    Habilidades de IA são Markdown simples, não código específico de um provedor, por isso funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • 9 arquivos incluídos

    Scripts, modelos de documentos e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente leitura e nunca são executados.

  • Código aberto

    Publicada por AI-ModCon no GitHub. Leia o conteúdo-fonte antes de instalar.

Instalação

Instale a habilidade de IA Amsc Python Client no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL da pasta da habilidade exibida abaixo e confirme.
    https://github.com/AI-ModCon/genesis-skills/tree/main/skills/amsc-skills/amsc-python-client
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Nova habilidade → Via URL GitHub, depois cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse 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
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Amsc Python Client em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Amsc Python Client automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Amsc Python Client não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu 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/.

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Amsc Python Client faz?

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 que usar Amsc Python Client no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. Amsc Python Client é escrito em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. O TypingMind usa suas próprias chaves de API, então o pagamento é feito diretamente aos provedores, em vez de uma assinatura por licença de usuário, e suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Amsc Python Client no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/AI-ModCon/genesis-skills/tree/main/skills/amsc-skills/amsc-python-client. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Amsc Python Client?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Amsc Python Client?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Amsc Python Client com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Amsc Python Client é gratuita?

Sim. A habilidade é publicada no GitHub por AI-ModCon sob a licença BSD-2-Clause. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, modelos de documento ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas para chamar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA fornece conhecimento e um processo ao modelo: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇