paper

A Category Theoretic Framework for Multi-Agent Workflows.

Abstract

ABSTRACT—As large language model (LLM) agents become increasingly modular, the orchestration of their components— such as discrete skills, model providers, and external data servers—presents a complex optimization problem. In this paper, we introduce a category theoretic framework for constructing and optimizing complex agent workflows. We define a strict monoidal category where objects are typed data streams and morphisms represent parameterized agent capabilities. By implementing this framework in Haskell using Generalized Algebraic Data Types (GADTs), we provide compile-time guarantees of well-formedness for agent topologies. Furthermore, we formalize the search for optimal agent configurations as a Bayesian Optimization problem over this categorical space, employing Pareto optimization to balance resource constraints against solution quality.