agentsclimarketplace

Palantir hello world

Skill jeremylongshore/claude-code-plugins-plus-skills/plugins/saas-packs/palantir-pack/skills/palantir-hello-world

'Create a minimal working Palantir Foundry example querying Ontology objects.From its SKILL.md

Install
npx -y skills add jeremylongshore/claude-code-plugins-plus-skills --skill palantir-hello-world

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

5.2 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

Palantir Hello World

Overview

Build a minimal working example that connects to Palantir Foundry, queries Ontology objects via the REST API, reads a dataset, and applies an action. Uses real foundry-platform-sdk Python API calls.

Prerequisites

  • Completed palantir-install-auth setup
  • Valid bearer token or OAuth2 credentials
  • At least one Ontology with object types configured in your Foundry enrollment

Instructions

Step 1: List Available Ontologies

import os
import foundry

client = foundry.FoundryClient(
    auth=foundry.UserTokenAuth(
        hostname=os.environ["FOUNDRY_HOSTNAME"],
        token=os.environ["FOUNDRY_TOKEN"],
    ),
    hostname=os.environ["FOUNDRY_HOSTNAME"],
)

# List all ontologies you have access to
for ont in client.ontologies.Ontology.list():
    print(f"Ontology: {ont.api_name}  RID: {ont.rid}")

Step 2: Query Ontology Objects

# List objects of type "Employee" from the default ontology
# The object type api_name comes from your Ontology configuration
ONTOLOGY = "your-ontology-api-name"
OBJECT_TYPE = "Employee"

objects = client.ontologies.OntologyObject.list(
    ontology=ONTOLOGY,
    object_type=OBJECT_TYPE,
    page_size=5,
)

for obj in objects.data:
    props = obj.properties
    print(f"  {props.get('fullName', 'N/A')} — {props.get('department', 'N/A')}")

Step 3: Get a Single Object by Primary Key

employee = client.ontologies.OntologyObject.get(
    ontology=ONTOLOGY,
    object_type=OBJECT_TYPE,
    primary_key="EMP-001",
)
print(f"Found: {employee.properties}")

Step 4: Read a Dataset

# Read rows from a Foundry dataset (tabular)
DATASET_RID = "ri.foundry.main.dataset.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

# Get dataset metadata
dataset = client.datasets.Dataset.get(dataset_rid=DATASET_RID)
print(f"Dataset: {dataset.name}, Path: {dataset.path}")

# Read rows from the dataset (CSV format)
content = client.datasets.Dataset.read(
    dataset_rid=DATASET_RID,
    branch_id="master",
    format="arrow",  # or "csv"
)
print(f"Read {len(content)} bytes of data")

Step 5: Apply an Ontology Action

# Actions modify objects — e.g., updating an employee's department
result = client.ontologies.Action.apply(
    ontology=ONTOLOGY,
    action_type="updateDepartment",
    parameters={
        "employeeId": "EMP-001",
        "newDepartment": "Engineering",
    },
)
print(f"Action result: {result.validation}")

Step 6: Run and Verify

set -euo pipefail
python hello_foundry.py
# Expected output:
# Ontology: my-company  RID: ri.ontology.main.ontology.xxx
# Employee: Jane Doe — Engineering
# Action result: VALID

Output

  • Authenticated connection to Palantir Foundry
  • Listed ontologies and object types
  • Retrieved objects with property values
  • Read dataset content
  • Applied an action to modify an object

Error Handling

ErrorCauseSolution
ObjectTypeNotFoundWrong api_nameCheck Ontology Manager for exact object type names
ObjectNotFoundInvalid primary keyVerify the key exists; keys are case-sensitive
ActionValidationFailedMissing required paramsCheck action definition for required parameters
DatasetNotFoundWrong RID or no accessVerify RID in Foundry UI; check project permissions
401 UnauthorizedToken expiredRegenerate in Developer Console

Examples

Using the REST API Directly (curl)

# List objects via REST
curl -s -H "Authorization: Bearer $FOUNDRY_TOKEN" \
  "https://$FOUNDRY_HOSTNAME/api/v2/ontologies/my-ontology/objects/Employee?pageSize=5" \
  | python -m json.tool

TypeScript OSDK Equivalent

import { createClient } from "@osdk/client";
import { Employee } from "@my-app/sdk";  // generated from OSDK

const employees = await client(Employee)
  .where({ department: "Engineering" })
  .fetchPage({ pageSize: 10 });

employees.data.forEach(emp => console.log(emp.fullName));

Resources

Next Steps

  • Set up iterative development: palantir-local-dev-loop
  • Build data pipelines with transforms: palantir-core-workflow-a
  • Query and link objects: palantir-core-workflow-b

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,144. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.