agentleFS
Microsoft AzureKnown publisherAzure/osdu-spi-stack/.github/skills/osdu-api/SKILL.md

osdu-api

Skill0 starsChanged 42 days agoApache-2.0View on GitHub

Call the OSDU APIs of the connected SPI Stack environment as the deploy, member, or no-access identity, or as yourself. Use to query records, search, list schemas or legal tags, check entitlements, compare what two identities may do, or probe service versions.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run it again after spi up changes the ingress address or the partitions.

    line 24
  2. Very specific:

    Every command that sends a token takes --as, written after the subcommand.

    line 30
  3. Very specific:

    Use me when the question is about a person's permissions.

    line 41
  4. Very specific:

    Every service except indexer-queue answers GET <base>/info.

    line 108

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

OSDU API

scripts/osdu.py calls the OSDU APIs of the environment the current kubectl context points at. It reads the base URL, service paths, and partitions from spi info --json and gets every token from spi token --json, so it holds no endpoint or credential logic of its own. Standard library only.

osdu() { uv run .github/skills/osdu-api/scripts/osdu.py "$@"; }

osdu connect                                  # read the environment, check the token
osdu call GET /api/legal/v1/legaltags
osdu call POST /api/search/v2/query -d '{"kind":"*:*:*:*","query":"*","limit":10}'
osdu services --probe                         # version and commit of each service
osdu disconnect                               # clear local state

connect is optional: call, services, and token connect on first use. Run it again after spi up changes the ingress address or the partitions. Point at another environment with uv run spi connect; state is kept per kubectl context.

Identities

Every command that sends a token takes --as, written after the subcommand. connect --as sets the default for later commands and drops every cached token; call --as overrides the default for one call.

--asWhoHolds
deploy (default)The environment's deploy identityusers.datalake.ops: every API, as an operator
memberThe member test identityusers, the service user groups, storage admin; no schema or file access
no-accessThe no-access test identityNothing; entitlements answers 401
meThe person signed in to azThe role spi users add gave them

Use me when the question is about a person's permissions. A person is a member only after spi users add:

uv run spi users add --me --role viewer       # viewer, editor, admin (default), ops
osdu connect --as me
osdu call GET /api/entitlements/v2/groups

Compare identities by repeating one call:

osdu call GET /api/legal/v1/legaltags --as member
osdu call GET /api/legal/v1/legaltags --as no-access

spi users add changes entitlements membership. Run it only when the user asks for a role change; reading with an identity never needs it.

Making calls

osdu call <METHOD> <PATH> [options]
OptionMeaning
-d, --dataJSON body, @file.json to read one, or - for stdin
-q, --queryQuery string, for example 'limit=10&offset=0'
-p, --partitionPartition for this call; defaults to the primary, or osdu_DATA_PARTITION
--asIdentity for this call
--failExit 22 when the HTTP status is 400 or higher

The output is one JSON document: status, as, body, and a hint when a refusal has a known cause. An HTTP refusal exits 0 unless --fail is given; read status.

Environment values

Take these from the connect output; do not assume them.

  • Partition. partition is the primary. An environment may declare more.
  • ACL groups. <group>@<partition>.<entitlements_domain>, for example data.default.viewers@opendes.dataservices.energy.
  • Legal tag. partitions.<name>.legal_tag is the tag seeded for sample data. It is empty until the legal init Job has succeeded.

Service paths

services prints the paths this environment publishes. Any path under the gateway works with call.

ServiceBase pathCommon operations
Partition/api/partition/v1GET /partitions, GET /partitions/{id}; application tokens only
Entitlements/api/entitlements/v2GET /groups, GET /groups/{email}/members
Legal/api/legal/v1GET /legaltags, GET /legaltags/{name}, POST /legaltags
Schema/api/schema-service/v1GET /schema, GET /schema/{id}
Storage/api/storage/v2GET /records/{id}, PUT /records, POST /query/records:batch
Search/api/search/v2POST /query, POST /query_with_cursor
Indexer/api/indexer/v2POST /reindex
File/api/file/v2POST /files/uploadURL, GET /files/{id}/metadata
Workflow/api/workflow/v1GET /workflow
Unit/api/unit/v3GET /unit
CRS Catalog/api/crs/catalog/v2GET /info
CRS Conversion/api/crs/converter/v2GET /info

Every service except indexer-queue answers GET <base>/info; services --probe reports that one as no info endpoint.

Refusals

AnswerLayerWhat it means
401, plain text bodyMeshThe token was refused before any service saw it. Check its audience against azure.token_audience in spi info --json.
401, JSON bodyServiceNo group in this partition allows the call. When GET /api/entitlements/v2/groups answers 401 too, the caller is in no group at all: spi users add --me for a person, expected for no-access.
403 "Access Denied" from partitionPartitionThe partition API admits application tokens only. It answers a person 403 whatever their role, and answers every seeded identity, no-access included. Use --as deploy.
403 elsewhereServiceThe caller is known but lacks what the call requires. spi users list shows roles.
404 on a recordStorageAbsent, or the caller is in none of the record's ACL groups.

Script errors arrive on stderr as {"error": "..."} with exit 1:

ErrorFix
"kubectl has no current context"uv run spi connect
"no ingress address yet"The gateway is still provisioning; uv run spi status
"spi token --me failed"az login as a person in the environment's tenant
"spi token failed: ServiceAccount ... not found"spi up on a release that provisions the test identities

Local state

~/.cache/spi/osdu-api-<context>.json (mode 0600 on Linux and macOS) holds the environment facts and the bearer tokens minted so far, each reused until two minutes before it expires. disconnect deletes it. Never print a token into a reply, an issue, or a PR; status shows callers and lifetimes without them.

References

  • API reference: endpoints and request bodies per service
  • Search patterns: query syntax, sorting, paging, indexing delay
  • Record lifecycle: legal tag, create, read, update, delete

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.