Manuscript Offprint

arXiv:2608.27790

Credo: Reusable Declarative Primitives for Agentic Workflows

Duo Lu, Andrew Crotty, Uğur Çetintemel

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

An LLM application depends on both a model and a harness: the program that determines what each call sees, how many calls to make, and which answers to trust. Coding agents can now discover strong harnesses by searching over candidate programs, but the resulting artifact is an opaque block of imperative code whose logical steps, runtime signals, physical execution decisions, and prompt strategies remain implicit and task-specific, forcing subsequent tasks to start the harness search process from scratch.

The potential for reuse, however, is substantial. A searched harness encodes significant knowledge, such as the logical steps that work, the signals that matter, the physical operator decisions that adapt execution, and the prompt strategies that are effective, yet this knowledge is buried in imperative code with no inspectable or reusable structure, nor does it carry any provenance or metadata.

CREDO addresses this problem by recovering a structured declarative description of a searched harness, tagging each extracted primitive with relevant metadata, and cataloguing all of it with provenance. A compiler can then bind stored primitives to generate harnesses for new tasks without having to start the search over from scratch. This paper provides preliminary results demonstrating the potential of our approach and lays out a related research agenda that the database community is well-positioned to tackle, including cost-based compilation over declarative catalogs and catalog maintenance under model and workload drift.

1 Introduction

The behavior of an LLM application depends heavily on its harness, which determines the sequence of model and tool calls, the information supplied to each call, and the conditions under which an answer is accepted. For example, a harness may begin with a small model, estimate confidence in the resulting answer, and invoke a larger model only when that estimate falls below a threshold. Thus, both quality and cost depend on program-level choices that can extend well beyond the model itself.

Recently, agentic harness search has become an effective way to make these choices. A search agent proposes candidate harnesses and executes them against a benchmark, using the observed accuracy and cost to guide subsequent iterations [16][16], following the evolutionary pattern coding agents apply to programs more generally [22][22]. The final program encodes one successful combination of decisions as a single monolithic output, such that the logical sequence of operations, intermediate signals, conditional implementation choices, and prompt strategies all appear mixed together, along with constants and conventions specific to the benchmark. As a result, knowledge that might be generalizable to other tasks is lost among the mess.

Database systems have faced a similar problem in the past. For decades, user-defined functions (UDFs) remained as black boxes that could not be optimized or reasoned about, but work on UDF introspection and recovery of declarative expressions from procedural code has exposed opportunities that were previously hidden from the optimizer [8, 25]. We therefore argue for a similar approach for LLM harnesses, such that their internals can be decomposed into reusable declarative primitives.

CREDO applies these lessons to LLM harnesses by attempting to recover a typed declarative description as primitives of four kinds: (1) skeleton steps forming the logical plan; (2) beliefs as derived attributes that inform physical operator selection; (3) policies as the rules that select physical implementations using belief values; and (4) prompt templates as the parametric natural language specifications discovered at each step. Every primitive is stored with provenance and relevant metadata, allowing a compiler to synthesize harnesses for new tasks from the catalog by reusing extracted primitives. The key insight is that declarative descriptions of agentic execution are portable and durable, meaning they can be recovered once during harness search and then compiled into new harnesses across new domains, accumulating in a catalog that grows more valuable with every new task. Our preliminary results demonstrate the promise of our proposed approach, which achieves more than an order of magnitude in cost savings over agentic harness search. We also outline our vision for a broader research agenda this line of work opens up for the database community.

References (19)