Caravan is a typed, self-documenting agentic CLI harness and LLM orchestration framework for OCaml.
Caravan is partitioned into three focused libraries:
Caravan: Core orchestration framework, agents, chains, sessions, trace, memory, types, and LISP engine.CaravanProviders: Pluggable LLM providers (Ollama, OpenAI, Llama.cpp, and OpenAI-compatible backends).CaravanTools: Built-in execution tools (Bash, File I/O, Web Search/Fetch, Delegate, Finish, Lisp).Caravan.Agent: Autonomous ReAct agent loops with turn budgets and budget-awareness nudges.Caravan.Chain: Composable typed LLM pipelines with monadic Result-binding (|>>), parallel execution, and retries.Caravan.Session: Multi-turn session state, system prompts, turn tracking, and history management.Caravan.Memory: Context window management and compaction strategies (Ring buffer, Summary, Hierarchical).Caravan.Compaction_policy: History compaction trigger rules and context budget thresholds.Caravan.Trace: Structured event streaming and audit logging (JSONL sink).Caravan.Types: Core message types (chat_message, role, result_with_meta, usage_stats).Caravan.Plugin: Spatiotemporal composability runtime — revertible effects, reactive service injection, component lifecycles, isolation realms, declarative reconciliation.Caravan.Plugin_host: Config-driven plugin composition ([plugins]), named builders, MCP mounts as revertible fibers, and the active-provider service.Caravan.Provider: Abstract LLM backend interface and packed existential provider wrapper.Caravan.Tool: First-class module tool interface (TOOL) and effect execution.Caravan.Subagent: Isolation and delegation of sub-tasks to dedicated worker subagents.Caravan.Permission: Security permission policies (auto, ask, readonly) and mutating tool guards.Caravan.Config: System & agent configuration loading (config.toml), validation, and default resolution.Caravan.Redis_store: Redis-backed persistent session storage for conversation history.Caravan.Caravan_error: Unified structural error types, exception handlers, and safe execution wrappers.Caravan.Lisp: Embedded Slip micro-LISP interpreter for programmatic tool composition.Caravan.Mcp: Model Context Protocol (MCP) server integration and client registry.Caravan.Prompt: Composable conversation building via a Writer monad.Caravan.Template: Variable substitution and chat template rendering engine.Caravan.Parser: Type-safe output parsers for model responses.Caravan.Tls: Verified TLS connection setup with system CA store integration.Caravan.Ui: Terminal rendering, spinners, and interactive TUI components.Caravan.Cli_resolve: CLI argument resolution and provider/model fallback logic.Caravan.Agent_output: Plain text and JSON formatting for agent run outputs.Caravan.Doctor: System environment, provider readiness, and configuration diagnostics.