API Reference PtcRunner v#0.9.0

Copy Markdown View Source

Modules

BEAM-native Programmatic Tool Calling (PTC) library.

Text chunking utilities for RLM preprocessing.

Manages context, memory, and tools for program execution.

Interactive trace tree widget for Livebook.

Behaviour and convenience API for LLM adapters.

Built-in LLM adapter using req_llm.

Execute PTC programs written in Lisp DSL (Clojure subset).

AST node types for PTC-Lisp

Validates and desugars RawAST into CoreAST.

Pattern analysis and destructuring for let bindings and function parameters.

Predicate analysis for where clauses and predicate combinators.

Analyzer for short function syntax (#()).

Validates PTC-Lisp programs against Babashka/Clojure.

Core, validated AST for PTC-Lisp.

Convert Core AST (the analyzed/desugared representation) back to PTC-Lisp source strings.

Static analysis to extract data keys accessed by a PTC-Lisp program.

Builds the initial environment with builtins for PTC-Lisp.

Evaluates CoreAST into values.

Function application dispatch for Lisp evaluation.

Evaluation context for the Lisp interpreter.

Shared helper functions for Lisp evaluation.

Pattern matching for let bindings in Lisp evaluation.

Where predicates and comparison helpers for Lisp evaluation.

Exception used to signal execution errors during Lisp evaluation.

Format PTC-Lisp values for human/LLM display.

Serialize PTC-Lisp AST to source code string.

Language specification compositions for PTC-Lisp.

NimbleParsec-based parser for PTC-Lisp.

Helper functions for parser reductions

Built-in functions for PTC-Lisp.

Dispatch helper for calling Lisp functions from Collection operations.

Collection operations for PTC-Lisp runtime.

Flexible key access helpers for PTC-Lisp runtime.

Simulated Java interop for PTC-Lisp.

Map operations for PTC-Lisp runtime.

Arithmetic operations for PTC-Lisp runtime.

Type predicates, numeric predicates, and logic operations for PTC-Lisp runtime.

Minimal, safe Regex support for PTC-Lisp. Uses Erlang's :re directly with match limits for ReDoS protection.

Unified handling for IEEE 754 special values (Infinity, NaN) in PTC-Lisp.

String manipulation and parsing operations for PTC-Lisp runtime.

Validates PTC-Lisp specification against implementation.

Counts unique user-defined symbols and keywords in a parsed Lisp AST.

Generate and repair execution plans for multi-agent workflows.

Standalone Mustache template parser and expander.

Parsed execution plan for multi-agent workflows.

Adversarial review of execution plans before they run.

Execute plans with automatic replanning support.

Execute parsed plans with SubAgents.

Real-time terminal visualization for PlanExecutor events.

Compile-time utilities for loading prompt templates from files.

Centralized prompt loading for PtcRunner.

Executes programs in isolated BEAM processes with resource limits.

Declarative schema module that defines all DSL operations.

Result of executing a PTC program or SubAgent mission.

Agentic loop for LLM-driven PTC-Lisp execution.

Chaining functions for SubAgent pipelines.

A compiled SubAgent with pre-derived PTC-Lisp logic.

Compilation logic for SubAgents.

Behaviour for message history compression strategies.

Default compression strategy that coalesces all context into a single USER message.

Debug helpers for visualizing SubAgent execution.

Extracts JSON from LLM responses, handling common formatting quirks.

Normalizes map keys from hyphens to underscores at the tool boundary.

LLM resolution and invocation for SubAgents.

LLM-powered tools for classification, evaluation, and judgment.

Core agentic loop that manages LLM↔tool cycles.

Shared JSON response handling for text mode variants.

LLM retry logic with configurable backoff strategies.

Telemetry, tracing, and usage metrics for SubAgent execution.

Response parsing and validation for LLM responses.

Return type validation for SubAgent execution.

Unified execution loop for text output mode.

Tool preparation and wrapping for SubAgent execution.

Turn feedback formatting for SubAgent execution.

Renders namespaces for the USER message (REPL with Prelude model).

Renders the data/ namespace section.

Renders tool call history and println output.

Renders available tools for the USER message namespace section.

Converts Elixir values to human-readable type labels.

Renders the user/ namespace section (LLM-defined functions and values).

Renders a markdown checklist from plan steps and summaries.

Template string expansion with placeholder validation.

Sigils for SubAgent templates.

Signature parsing and validation for SubAgents.

Coerce values to expected types with warning generation.

NimbleParsec-based parser for signature strings.

Helper functions for signature parser AST building.

Renders signatures back to string representation.

Resolve paths against parsed signature types.

Validates data against signature type specifications.

Wraps a SubAgent as a callable tool for parent agents.

System prompt generation for SubAgent LLM interactions.

Expected output section generation for SubAgent prompts.

Telemetry event emission for SubAgent execution.

Converts Tool structs to OpenAI-format JSON Schema tool definitions.

Extract signature and description from Elixir function @spec and @doc.

Validates SubAgent options at construction time.

Exception raised by SubAgent.run!/2 and SubAgent.then!/2 when execution fails.

Represents a template with extracted placeholders.

Normalized tool definition for PTC-Lisp and SubAgent.

Exception raised when a tool execution fails.

Centralizes process dictionary access for tracing context.

Captures SubAgent execution events to JSONL files for offline analysis.

Offline analysis of trace log files.

GenServer that collects trace events and writes them to a JSONL file.

Handles safe JSON encoding for telemetry events.

Telemetry handler that captures SubAgent events for trace logging.

Immutable trace recorder for SubAgent execution.

Text-based timeline visualization for execution traces.

Captures a single LLM interaction cycle in a SubAgent execution.

Mix Tasks

Run the parallel workers (LLM-orchestrated map-reduce) example.

Installs Babashka for Clojure validation.

Starts an interactive REPL for testing PTC-Lisp expressions.

Runs .clj files through both PTC-Lisp and Babashka/Clojure, comparing results.

Regenerates the spec checksums file for drift detection.

Validates PTC-Lisp specification against implementation.