How an FDE Uses AI FDE: Ontology Functions
This Palantir Foundry video demonstrates leveraging AIP FDE (AFDE) to automate the creation, testing, and deployment of TypeScript Ontology functions within a "Climbing Gym Ontology" example. AFDE guides users through defining function specifications, automatically generating code by exploring the ontology, and interactively debugging via function previews before merging changes and deploying them to applications.
In this video, "How an FDE Uses AI FDE: Ontology Functions" by Ontologize, a Palantir Forward Deployed Engineer (FDE) demonstrates how to leverage AIP FDE (AFDE) to automatically write, test, and deploy TypeScript Ontology functions in Palantir Foundry [00:00].
The walkthrough uses a Climbing Gym Ontology dataset (containing objects like Gym, Member, Route, Send, Visit, and Membership) to author three operational functions and deploy them into a user-facing Palantir Workshop application [00:46].
Step-by-Step Guidance: Authoring & Deploying Functions with AFDE
1. Initialize AFDE & Define Prompts
└── Open AFDE (Ctrl + J) ──> Specify target project/folder ──> Prompt 3 function specs
2. Automated Exploration & Code Generation
└── Mode switch (Explore) ──> TypeScript v2 selection ──> Branch & SDK setup ──> File creation
3. Interactive Testing & Diagnostic Fixes
└── Function Preview execution ──> Primary key / schema fix ──> Commit & Publish
4. Merging PRs & Ontology Proposals
└── Code Repository PR (Squash & Merge) ──> Ontology Manager Global Proposal Merge
5. Application Building in Palantir Workshop
└── Object Table ──> Function-backed Property ──> Sort & Visualize
- Initialize AFDE and Define Clear Prompts: Specify inputs, business logic, and output shapes precisely.
- Open AFDE by pressing
Ctrl + Jin Palantir Foundry and searching for AFDE [01:06]. - Point AFDE to a project folder where it has permissions to create repositories and code files [08:28].
- Provide precise prompts detailing expected function inputs, data relationships, edge cases, and output schemas [02:22]:
- Occupancy Percent (
gymOccupancyPercent): Takes aGymobject andstart/endtimestamps; calculates overlappingVisitdurations over gym capacity [02:45]. - Projector Count (
projectorCount): Takes aRouteobject set and returns a map of distinct members whoseSendhistory hasattemptstatuses but no completed sends [04:20]. - Renew Membership (
renewMembership): Takes aMemberobject, membership tier, and duration; resolves previous active/frozen memberships, updates pricing, and generates a new active record [06:12].
-
Automated Exploration and Code Generation: Allow AFDE to inspect schemas before writing code.
-
AFDE automatically enters Exploration Mode to inspect linked object types and schemas across the target ontology [09:01].
-
Select the target runtime environment (e.g., TypeScript v2) [09:47].
-
AFDE creates a local development branch, generates SDK packages, and scaffolds the TypeScript source files [09:52].
-
Interactive Testing and Self-Correction: Validate previews and resolve schema mismatches.
-
Approve tool permissions for running Function Previews against live sample data [10:55].
-
Observe AFDE as it detects diagnostic errors (e.g., primary key formatting mismatches like
-vs_) and automatically corrects its logic [11:14]. -
Confirm successful execution previews for each function [11:30].
-
Merge Code PRs and Ontology Proposals: Deploy changes from branches to main.
-
Open the generated Pull Request (PR) in the code repository, review checks, and perform a Squash and Merge into
main[13:24]. -
Navigate to the Ontology Proposal generated for function-backed action types (Global Branch) and click Merge Proposal [14:13].
-
Integrate Functions into Workshop Applications: Expose logic to end-users.
-
Launch Workshop via
Ctrl + Jand create a blank module [14:30]. -
Add an Object Table populated with
Routeobjects [15:15]. -
Add a Function-Backed Property column selecting
projectorCountto render the derived property per row [15:46]. -
Sort table columns by projector count to give operational staff real-time visibility into high-difficulty routes [16:20].
Use Case Analysis: Climbing Gym Operational Management
The video illustrates how AI FDE converts raw operational ontology data into actionable business tools across three core operational patterns:
| Function / Action | Function Type | Business Objective | Palantir Workshop Implementation |
|---|---|---|---|
gymOccupancyPercent | Computed Metric | Measures capacity utilization over a custom time window by checking overlapping visitor check-in/checkout intervals [02:45]. | Backs numeric KPI summary widgets and time-series metric cards for facility managers [16:48]. |
projectorCount | Derived Property (Map) | Identifies climbing routes where members are struggling (high attempt count without success) [04:20]. | Populates custom derived columns in Object Tables and drives conditional map/chart formatting [15:46]. |
renewMembership | Function-Backed Action | Automates membership state transitions, price calculations, and frozen state expirations [06:12]. | Backs user action buttons and inline forms within operational workflows [16:54]. |
Key Takeaways for Forward Deployed Engineers (FDEs)
- Prompt Precision: FDEs must clearly define input/output structures, domain edge cases (e.g., handling frozen memberships before creating new ones), and boundary math [02:22].
- Feedback Loop: AFDE relies on live code execution previews to test assumptions against actual ontology data before submitting code [10:55].
- Human-in-the-Loop Governance: AI handles boilerplate writing, SDK setup, and diagnostic fixes, while the engineer approves executions, audits code, and merges PRs [12:20].
Authoring TypeScript v2 Ontology Functions manually without AI FDE involves working directly within Palantir Foundry’s Code Repositories module and consuming them via Workshop.
The workflow breaks down into repository setup, coding patterns, testing/publishing, and Workshop wiring.
Manual Authoring & Deployment Workflow
-
Create a Code Repository: Initialize repo with TypeScript v2 Functions template.
-
In Foundry, navigate to your target folder, click + New, and select Code Repository.
-
Choose TypeScript Functions as the language/template, and select TypeScript v2 as the SDK/version.
-
Branch off
mainto create a working feature branch (e.g.,feature/my-ontology-functions). -
Configure Ontology Dependencies: Generate SDK bindings for required Object Types.
-
Open the repository's Ontology Dependencies or SDK Packages tab on the left sidebar.
-
Search for and select the Object Types needed (e.g.,
Gym,Member,Route,Send). -
Click Save and Regenerate SDK so
@osdk/functionsand@ontology/sdkgenerate typed imports for your data schema. -
Write the Function Logic: Decorators, maps, and edit types. In
src/index.ts(or individual.tsfiles), import your generated objects and decorators from@foundry/functions-apior@osdk/functions:
- Computed Metric / Query Function:
import { Function, Integer } from "@foundry/functions-api";
import { Gym, Visit } from "@ontology/sdk";
export class GymAnalytics {
@Function()
public async gymOccupancyPercent(
gym: Gym,
startTime: Date,
endTime: Date
): Promise<Double> {
const visits = await gym.visits.getAsync();
// Perform boundary math...
return averageOccupancy;
}
}
- Derived Property (Map for Workshop Object Tables):
import { Function, TwoDimensionalAggregation } from "@foundry/functions-api";
import { ObjectSet, Route } from "@ontology/sdk";
export class RouteFunctions {
@Function()
public async projectorCount(
routes: ObjectSet<Route>
): Promise<FunctionsMap<Route, Integer>> {
const result = new FunctionsMap<Route, Integer>();
// Map routes to member attempt counts...
return result;
}
}
- Ontology Edits (Function-Backed Action):
import { Edits } from "@osdk/functions";
import { Member, Membership } from "@ontology/sdk";
type MemberEdits = Edits.Create<Membership> | Edits.Update<Member>;
export class MembershipActions {
@Function()
public async renewMembership(
member: Member,
tier: string,
durationMonths: Integer
): Promise<MemberEdits> {
// Construct edit payload or staged write
return edits;
}
}
-
Test in Code Repositories: Execute previews with live data before committing.
-
Open the Functions Helper / Preview panel on the right side of Code Repositories.
-
Select your function name and supply mock or live Ontology object primary keys as parameter inputs.
-
Click Run Preview to evaluate the code and inspect the raw return payload or TypeScript errors directly in the console.
-
Tag, Release, and Propose: PR, Merge, and Action Type Configuration.
-
Merge Code PR: Submit a Pull Request and merge your feature branch into
main. The repository automatically tags and publishes a release version. -
Configure Action Type (If writing Edit functions):
- Open Ontology Manager.
- Create a new Action Type (e.g.,
Renew Membership). - Under Logic, select Function-backed and choose your published
renewMembershipfunction. - Map the action parameters to the function arguments and save/publish the proposal.
- Consume in Palantir Workshop: Wire the published functions into UI components.
- Launch Workshop and open your module.
- For Derived Table Columns: Add an Object Table, edit columns $\rightarrow$ Add Column $\rightarrow$ Function-backed Property, and select your
projectorCountfunction. - For Action Buttons: Add a Button / Button Group widget $\rightarrow$ Set On-Click action to Action Type $\rightarrow$ Select your function-backed action.
- For Variables: Add a variable $\rightarrow$ Type: Function-backed $\rightarrow$ Select your metric or Object Set returning function.
Key Differences: Manual vs. AI FDE
| Aspect | Manual Authoring | With AI FDE (AFDE) |
|---|---|---|
| SDK Scaffolding | Manual import search in Ontology settings & manual compilation. | Automatically detects objects and triggers SDK builds. |
| Diagnostics & Types | Manually reading TypeScript runtime errors in the editor. | Automatically catches schema mismatches (e.g., _ vs - in keys) and self-corrects. |
| Action Type Creation | Must switch to Ontology Manager to manually construct logic bindings. | Generates a Global Branch proposal for the Action Type directly in chat. |