Skip to content
OpenSmartRoute
Skillv1.0.0

palantir-core-workflow-b

Work with Palantir Foundry Ontology objects, actions, and queries via SDK. Use when querying objects, applying actions, linking objects, or building Ontology-driven applications. Trigger with phrases

by jeremylongshore(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from jeremylongshore/tons-of-skills-marketplace (skills/.curated/palantir-core-workflow-b/SKILL.md). Install upstream with npx skills add jeremylongshore/tons-of-skills-marketplace --skill palantir-core-workflow-b. Copyright stays with the author (MIT).

Palantir Core Workflow B — Ontology Objects & Actions

Overview

Query, filter, and mutate Ontology objects using the Foundry Platform SDK and OSDK. Covers listing objects with property filters, following links between object types, applying actions, and aggregating object data. This is the primary workflow for Ontology-driven applications.

Prerequisites

  • Completed palantir-install-auth setup
  • An Ontology with configured object types, link types, and actions
  • Familiarity with palantir-core-workflow-a (data pipelines feed the Ontology)

Instructions

Step 1: List and Filter Objects (REST API)

import os, foundry

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

ONTOLOGY = "my-company"

# List employees in Engineering, sorted by hire date
result = client.ontologies.OntologyObject.list(
    ontology=ONTOLOGY,
    object_type="Employee",
    page_size=20,
    order_by="hireDate:asc",
    properties={"department": "Engineering"},
)

for obj in result.data:
    p = obj.properties
    print(f"{p['fullName']} | {p['department']} | hired {p['hireDate']}")

Step 2: Search Objects with Filters

# Search with complex filters using the search endpoint
search_result = client.ontologies.OntologyObject.search(
    ontology=ONTOLOGY,
    object_type="Employee",
    where={
        "type": "and",
        "value": [
            {"type": "eq", "field": "department", "value": "Engineering"},
            {"type": "gte", "field": "salary", "value": 100000},
        ],
    },
    page_size=50,
)
print(f"Found {len(search_result.data)} matching employees")

Step 3: Follow Links Between Objects

# Get all projects linked to an employee
employee_rid = "ri.ontology.main.object.employee-001"

linked_projects = client.ontologies.OntologyObject.list_linked_objects(
    ontology=ONTOLOGY,
    object_type="Employee",
    primary_key="EMP-001",
    link_type="assignedProjects",
)

for project in linked_projects.data:
    print(f"  Project: {project.properties['name']}{project.properties['status']}")

Step 4: Apply Actions to Modify Objects

# Promote an employee — triggers validation rules defined in Ontology
result = client.ontologies.Action.apply(
    ontology=ONTOLOGY,
    action_type="promoteEmployee",
    parameters={
        "employeeId": "EMP-001",
        "newTitle": "Senior Engineer",
        "newSalary": 150000,
        "effectiveDate": "2026-04-01",
    },
)
print(f"Validation: {result.validation}")  # VALID or INVALID with reasons

Step 5: Aggregate Object Data

# Aggregate salary by department
aggregation = client.ontologies.OntologyObject.aggregate(
    ontology=ONTOLOGY,
    object_type="Employee",
    aggregation=[
        {"type": "avg", "name": "avgSalary", "field": "salary"},
        {"type": "count", "name": "headcount"},
    ],
    group_by=[{"field": "department", "type": "exact"}],
)

for bucket in aggregation.data:
    grp = bucket.group
    vals = bucket.metrics
    print(f"{grp['department']}: {vals['headcount']} people, avg ${vals['avgSalary']:,.0f}")

Step 6: TypeScript OSDK (Generated SDK)

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

// Type-safe queries with auto-completion
const engineers = await client(Employee)
  .where({ department: { $eq: "Engineering" } })
  .orderBy(e => e.hireDate.asc())
  .fetchPage({ pageSize: 20 });

for (const emp of engineers.data) {
  console.log(`${emp.fullName} — ${emp.title}`);
}

// Apply action with type-safe parameters
await client(Employee).applyAction("promoteEmployee", {
  employeeId: "EMP-001",
  newTitle: "Senior Engineer",
});

Output

  • Filtered and sorted Ontology object queries
  • Cross-object navigation via link types
  • Action application with validation feedback
  • Server-side aggregations grouped by properties

Error Handling

Error Cause Solution
ObjectTypeNotFound Wrong api_name Check Ontology Manager for exact type names
PropertyNotFound Wrong property name Properties are camelCase in API, may differ from UI
ActionValidationFailed Business rule violation Read result.validation.messages for details
LinkTypeNotFound Invalid link type name Verify link type in Ontology Manager
PermissionDenied Missing Ontology scope Add api:ontology-read scope to your app

Examples

Batch Action Application

employee_ids = ["EMP-001", "EMP-002", "EMP-003"]
for eid in employee_ids:
    result = client.ontologies.Action.apply(
        ontology=ONTOLOGY,
        action_type="markReviewed",
        parameters={"employeeId": eid, "reviewDate": "2026-03-22"},
    )
    status = "OK" if result.validation == "VALID" else "FAILED"
    print(f"  {eid}: {status}")

Resources

Next Steps

  • Handle errors systematically: palantir-common-errors
  • Optimize query performance: palantir-performance-tuning
  • Secure object access with RBAC: palantir-enterprise-rbac

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/jeremylongshore-tons-of-skills-marketplace-palantir-core-79789c/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

jeremylongshore-tons-of-skills-marketplace-palantir-core-79789c.ocm.jsonjson
{
  "ocm": "1",
  "id": "jeremylongshore-tons-of-skills-marketplace-palantir-core-79789c",
  "kind": "skill",
  "name": "palantir-core-workflow-b",
  "description": "Work with Palantir Foundry Ontology objects, actions, and queries via SDK. Use when querying objects, applying actions, linking objects, or building Ontology-driven applications. Trigger with phrases like \"palantir ontology\", \"foundry objects\", \"palantir actions\", \"ontology query\", \"OSDK objects\".",
  "publisher": "jeremylongshore",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "data_analysis"
    ],
    "tags": [
      "skill-md",
      "saas",
      "palantir",
      "foundry",
      "ontology",
      "osdk",
      "actions",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Work with Palantir Foundry Ontology objects, actions, and queries via SDK. Use when querying objects, applying actions, linking objects, or building Ontology-driven applications. Trigger with phrases like \"palantir ontology\", \"foundry objects\", \"palantir actions\", \"ontology query\", \"OSDK objects\"."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/jeremylongshore/tons-of-skills-marketplace",
      "path": "skills/.curated/palantir-core-workflow-b/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/HEAD/skills/.curated/palantir-core-workflow-b/SKILL.md",
      "key": "jeremylongshore/tons-of-skills-marketplace/skills/.curated/palantir-core-workflow-b/SKILL.md"
    },
    "compatibility": "Designed for Claude Code",
    "allowed_tools": [
      "Read,",
      "Write,",
      "Edit,",
      "Bash(pip:*),",
      "Bash(npm:*),",
      "Grep"
    ],
    "license": "MIT"
  },
  "instructions": "# Palantir Core Workflow B — Ontology Objects & Actions\n\n## Overview\n\nQuery, filter, and mutate Ontology objects using the Foundry Platform SDK and OSDK. Covers listing objects with property filters, following links between object types, applying actions, and aggregating object data. This is the primary workflow for Ontology-driven applications.\n\n## Prerequisites\n\n- Completed `palantir-install-auth` setup\n- An Ontology with configured object types, link types, and actions\n- Familiarity with `palantir-core-workflow-a` (data pipelines feed the Ontology)\n\n## Instructions\n\n### Step 1: List and Fil",
  "cost": {
    "context_tokens": 1402
  }
}

Fetch it by URL: GET /api/v1/registry/jeremylongshore-tons-of-skills-marketplace-palantir-core-79789c/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.