paip-agent-sdk
v1.0.0
Published
An unofficial TS agent SDK for Palantir Foundry AIP LLM Proxy models.
Maintainers
Readme
PAIP-Agent-SDK
An unofficial TS agent SDK for Palantir Foundry AIP LLM Proxy models.
Install
pnpm add paip-agent-sdkConfigure
The SDK reads no environment variables automatically:
import { PalantirAgent } from "paip-agent-sdk";
const agent = new PalantirAgent({
baseURL: process.env.PALANTIR_AIP_URL!,
token: process.env.PALANTIR_AIP_API_TOKEN!,
// Optional:
attribution: ["ri.project.main.project.example"],
traceParent: "00-...",
traceState: "vendor=value",
});tokenmay also be an async function when an application needs to refresh Foundry OAuth access tokens.attributionassigns usage to Foundry project RIDs.traceParentandtraceStateare optional W3C distributed tracing headers.
OAuth applications must request the api:use-language-models-execute operation scope.
Usage
The main API remains callModel, either as a method on PalantirAgent or as a standalone function receiving a PalantirAIP client.
See examples/ for provider-specific examples covering configuration, model calls, streaming, typed tools, and multi-turn execution.
Provider Routing
The agent accepts Foundry model RIDs and selects the correct proxy endpoint:
- OpenAI RIDs use
/openai/v1/responses. - Anthropic RIDs use
/anthropic/v1/messages. - Gemini RIDs use
/google/v1/models/{model}:generateContent.
Anthropic and Google responses are normalized to the Responses-style objects used by the agent API. Foundry does not allow Claude or Gemini RIDs on the OpenAI Responses endpoint.
Environment
Tests and examples use:
PALANTIR_AIP_URL=https://example.palantirfoundry.com
PALANTIR_AIP_API_TOKEN=your-foundry-tokenCopy .env.example to .env and add credentials for this Foundry enrollment.
Vitest and examples both load the repository root .env.
Development
The package is ESM-only and requires Node.js 20 or newer.
pnpm install --ignore-scripts
pnpm build
pnpm test
pnpm test:e2e
pnpm typecheck:examples