Palantir Foundry AIP

Public Defender Intelligence System

Six autonomous agents and a six-object ontology for case analysis, risk assessment, and precedent discovery on Palantir Foundry AIP

Overview

PDIS is a five-tab Workshop application built entirely on Palantir Foundry AIP. The system combines six autonomous agents with a six-object semantic ontology to enable public defenders to instantly retrieve case information, assess risk, discover applicable precedent, and predict outcomes with 93% grounding accuracy and 2.1-second end-to-end latency.

System Architecture

Six-Object Semantic Ontology

Five Workspaces

Six Autonomous Agents

Each agent is implemented as an AIP Action—a long-running, stateful workflow that chains Query Objects, Transform, Filter, Aggregate, and Join operations. Agents communicate via message passing through Foundry's event system.

Case Lookup Agent

Retrieves full case record by case_id. Executes JOIN across Case, Client, Charges, Evidence, Outcome. Returns denormalized view: case metadata, defendant history, all linked objects. Caches result for 60 minutes. Invoked first by every downstream agent.

Charge Assessment Agent

Classifies charge severity (MISDEMEANOR / FELONY) from statute code. Fetches statute text and prior conviction counts. Identifies applicable sentencing guidelines. Flags enhancements. Returns severity, applicable range, and prior-record context for risk scoring.

Evidence Synthesis Agent

Groups evidence by type (physical, testimonial, documentary, digital), validates chain of custody completeness, and assesses admissibility via field + rule-based heuristics. Ranks by impact (DNA > testimony > documentary). Invokes Risk Scoring Agent if gaps detected.

Precedent Discovery Agent

Performs hybrid search: structured match on applicability_tags + court level, semantic similarity on synopsis embeddings (0.75 threshold, 2x boost for tag matches). Ranks by composite score (0.4 × tags + 0.6 × similarity). Adapts threshold to 0.65 if fewer than 3 results.

Risk Scoring Agent

Computes numeric risk score (0–100) via: (prior_record × 0.30) + (charge_severity × 0.30) + (evidence_quality × 0.20) + (historical_outcome × 0.20). Derives confidence from k=5 nearest neighbors. Returns component breakdown and confidence interval. Every component traces back to ontology objects for explainability.

Outcome Prediction Agent

Identifies k=5 similar cases via semantic search, aggregates: P(guilty) = % of neighbors with guilty verdict. Estimates sentence via weighted median. Compares to risk scores; flags discrepancies for human review. Returns distribution with confidence intervals.

Inter-Agent Coordination

Agents communicate via message passing through Foundry's AIP event system. Example flow: User queries for outcome prediction → Outcome Prediction Agent invokes Case Lookup Agent (fetches case data) → Outcome Prediction Agent invokes Precedent Discovery Agent (finds relevant case law) → Outcome Prediction Agent invokes Risk Scoring Agent (computes risk factors) → agents aggregate results and return to Deal Room UI. Each agent call is logged with timestamp and input/output for auditability.

Deal Room Chatbot Integration

Users query via natural language in the Deal Room chat panel. NLU layer interprets intent and extracts entities (case_id, charge_type, etc.). Chatbot orchestrates agent invocation: if user says "What's the risk on this case?", chatbot passes case_ID to Risk Scoring Agent. If user says "Find similar cases", chatbot invokes Outcome Prediction Agent's similarity engine. Agents receive correct case context on every invocation via explicit case_ID parameter passing.

Technical Implementation

Platform: Palantir Foundry AIP

PDIS is built entirely within Foundry using:

SQL-Over-Embeddings Retrieval Architecture

Hybrid Query Engine: PDIS combines traditional SQL with vector similarity operations. The query planner chooses execution strategy based on predicate type:

-- Example 1: Structured query (felonies filed this year) SELECT c.case_id, ch.statute, c.filing_date, cl.client_id FROM Case c JOIN Charge ch ON c.case_id = ch.case_id JOIN Client cl ON c.client_id = cl.client_id WHERE ch.severity = 'FELONY' AND YEAR(c.filing_date) = 2026 AND c.jurisdiction = 'CA' ORDER BY c.filing_date DESC -- Example 2: Vector similarity (find precedents similar to this case) SELECT p.precedent_id, p.citation, p.court, COSINE_SIMILARITY(p.synopsis_embedding, EMBED('case_narrative_text')) AS relevance FROM Precedent p WHERE COSINE_SIMILARITY(p.synopsis_embedding, EMBED(...)) > 0.75 ORDER BY relevance DESC LIMIT 10 -- Example 3: Hybrid (cases with similar fact patterns + matching statute) WITH similar_cases AS ( SELECT c.case_id, COSINE_SIMILARITY(c.case_narrative_embedding, EMBED(?)) AS sim FROM Case c WHERE COSINE_SIMILARITY(c.case_narrative_embedding, EMBED(?)) > 0.70 ) SELECT sc.case_id, ch.statute, o.verdict, o.sentence_months FROM similar_cases sc JOIN Charge ch ON sc.case_id = ch.case_id JOIN Outcome o ON sc.case_id = o.case_id WHERE ch.statute IN ('187 PC', '245 PC') ORDER BY sc.sim DESC

Embedding & Performance

Batch Embeddings: At ingest, new Case/Precedent objects trigger batch embedding via OpenAI Batch API (not real-time, for cost efficiency). Vectors (1536-dim) are stored back to ontology objects. Foundry auto-indexes embedding fields with ANN search (faiss), enabling sub-100ms similarity queries on millions of vectors.

Agent Caching

Each agent maintains thread-safe LRU cache (1000 entries, TTL-based eviction). On cache miss, agents query Foundry and cache results.

// Agent-level LRU cache class AgentCache: def get(self, key, ttl_minutes=60): if key in cache and not expired: return cache[key] # MRU move-to-end return None def set(self, key, value): cache[key] = (value, NOW()) if len(cache) > max_size: del oldest_entry def hit_rate(self): return hits / (hits + misses) if total > 0 else 0

Latency Optimization: 4.2s → 2.1s (50% Reduction)

Results & Validation

Grounding Accuracy (93%)

Test set: 15 representative cases across charge types (felony assault, theft, drug possession, DUI). For each case, agents executed in sequence:

  1. Case Lookup Agent returned correct Client, Charges, Evidence, Outcome.
  2. Charge Assessment Agent classified severity correctly and retrieved statutes.
  3. Evidence Synthesis Agent flagged admissibility issues matching discovery documents.
  4. Precedent Discovery Agent returned citations actually applicable to the charges.
  5. Risk Scoring Agent computed factors matching expert assessment.
  6. Outcome Prediction Agent produced distributions within 10% of actual verdict/sentence.

Failure modes (7% of predictions): Precedent misses when cases involved niche statutes without sufficient training precedent. Evidence synthesis sometimes over-flagged admissibility in complex chains. Risk scoring occasionally missed nuanced mitigating factors.

Latency: 2.1 Seconds

End-to-end: case selection → query → agent execution → display. Median 2.1s across 100 queries. P95: 3.2s, P99: 4.1s.

User Impact

Deployment Status

Deployed to Foundry staging environment for evaluation. Five-tab Workshop live and tested with domain experts. Agentic workflows fully functional. Ready for integration into production public defender case management systems.

Technical Highlights