Skip to main content
Back to Engineering Blog
AI & Autonomous Agents•8 min read•2026-10-15

Hardening Function Calling in Desktop AI Agents

Preventing privilege escalation, directory traversal, and command injection when language models trigger system-level function calls.

C
Castov Engineering
Core Platform & DevSecOps Team

Strict Schema Enforcement with Zod

Every argument emitted by an LLM function call must be parsed through a strict validation schema before being passed to underlying APIs.

import { z } from 'zod';

const SafeFileReadSchema = z.object({
  filePath: z.string()
    .refine(p => !p.includes('..'), 'Path traversal detected')
    .refine(p => p.startsWith('C:\\workspace\\'), 'Outside allowed sandbox')
});
Local-First & Zero-Telemetry Computing

Automate Your Development Workflows Without Cloud Telemetry

Castov provides 61+ client-side utilities, local secret vaults, and CLI tools that execute entirely in your browser or native Windows workstation. Zero tracking, zero tokens sent to third-party clouds.