Skip to main content

A simple framework for LLM-powered applications

Project description

LLMProc

LLMProc Logo

License Status

LLMProc: A Unix-inspired operating system for language models. Like processes in an OS, LLMs execute instructions, make system calls, manage resources, and communicate with each other - enabling powerful multi-model applications with sophisticated I/O management.

Table of Contents

Installation

# Install with uv (recommended)
uv pip install llmproc               # Base package
uv pip install "llmproc[openai]"     # For OpenAI models
uv pip install "llmproc[anthropic]"  # For Anthropic models
uv pip install "llmproc[all]"        # All providers

See MISC.md for additional installation options and provider configurations.

Quick Start

Python usage

# Full example: examples/multiply_example.py
import asyncio
from llmproc import LLMProgram  # Optional: import register_tool for advanced tool configuration


def multiply(a: float, b: float) -> dict:
    """Multiply two numbers and return the result."""
    return {"result": a * b}  # Expected: π * e = 8.539734222677128


async def main():
    program = LLMProgram(
        model_name="claude-3-7-sonnet-20250219", 
        provider="anthropic",
        system_prompt="You're a helpful assistant.",
        parameters={"max_tokens": 1024},
        tools=[multiply],
    )
    process = await program.start()
    await process.run("Can you multiply 3.14159265359 by 2.71828182846?")
    
    print(process.get_last_message())


if __name__ == "__main__":
    asyncio.run(main())

CLI usage

# Start interactive session
llmproc-demo ./examples/anthropic.toml

# Single prompt
llmproc-demo ./examples/openai.toml -p "What is Python?"

# Read from stdin
cat questions.txt | llmproc-demo ./examples/anthropic.toml -n

# Use Gemini models
llmproc-demo ./examples/gemini.toml

Features

Supported Model Providers

  • OpenAI: GPT-4o, GPT-4o-mini, GPT-4.5
  • Anthropic: Claude 3 Haiku, Claude 3.5/3.7 Sonnet (direct API and Vertex AI)
  • Google: Gemini 1.5 Flash/Pro, Gemini 2.0 Flash, Gemini 2.5 Pro (direct API and Vertex AI)

LLMProc offers a Unix-inspired toolkit for building sophisticated LLM applications:

Process Management - Unix-like LLM Orchestration

Large Content Handling - Sophisticated I/O Management

  • File Descriptor System - Unix-like pagination for large outputs
  • Reference ID System - Mark up and reference specific pieces of content
  • Smart Content Pagination - Optimized line-aware chunking for content too large for context windows

Usage Examples

Additional Features

  • File Preloading - Enhance context by loading files into system prompts
  • Environment Info - Add runtime context like working directory
  • Prompt Caching - Automatic 90% token savings for Claude models (enabled by default)
  • Reasoning/Thinking models - Claude 3.7 Thinking and OpenAI Reasoning models (configured in anthropic.toml and openai.toml)
  • Token-efficient tools - Claude 3.7 optimized tool calling (configured in anthropic.toml)
  • MCP Protocol - Standardized interface for tool usage
  • Tool Aliases - Provide simpler, intuitive names for tools
  • Cross-provider support - Currently supports Anthropic, OpenAI, and Google Gemini

Demo Tools

LLMProc includes demo command-line tools for quick experimentation:

llmproc-demo

Interactive CLI for testing LLM configurations:

llmproc-demo ./examples/anthropic.toml  # Interactive session
llmproc-demo ./config.toml -p "What is Python?"    # Single prompt
cat questions.txt | llmproc-demo ./config.toml -n  # Pipe mode

Commands: exit or quit to end the session

llmproc-prompt

View the compiled system prompt without making API calls:

llmproc-prompt ./config.toml                 # Display to stdout
llmproc-prompt ./config.toml -o prompt.txt   # Save to file
llmproc-prompt ./config.toml -E              # Without environment info

Use Cases

  • Claude Code - A minimal Claude Code implementation, with support for preloading CLAUDE.md, spawning, MCP

Documentation

Documentation Index: Start here for guided learning paths

For advanced usage and implementation details, see MISC.md. For design rationales and API decisions, see FAQ.md.

Design Philosophy

LLMProc treats LLMs as processes in a Unix-inspired operating system framework:

  • LLMs function as processes that execute prompts and make tool calls
  • Tools operate at both user and kernel levels, with system tools able to modify process state
  • The Process abstraction naturally maps to Unix concepts like spawn, fork, goto, and IPC
  • This architecture provides a foundation for evolving toward a more complete LLM operating system

For in-depth explanations of these design decisions, see our API Design FAQ.

Roadmap

  • Persistent children & inter-process communication
  • llmproc mcp server
  • Streaming api support
  • Process State Serialization & Restoration
  • Feature parity for openai/gemini models

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llmproc-0.7.0.tar.gz (148.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llmproc-0.7.0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file llmproc-0.7.0.tar.gz.

File metadata

  • Download URL: llmproc-0.7.0.tar.gz
  • Upload date:
  • Size: 148.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llmproc-0.7.0.tar.gz
Algorithm Hash digest
SHA256 6ad6853c67b6e736255f1b6033c374bdb4d0c4a3c9a11cde1a5143dd122b3116
MD5 b97316605639c3afa36de97a1aa97533
BLAKE2b-256 1d0d8f58378f205bb0a43ef41655f8e076a857b916978bd5cabf9121e953b933

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmproc-0.7.0.tar.gz:

Publisher: release.yml on cccntu/llmproc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llmproc-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: llmproc-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llmproc-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c6039d3021bdc1b71370c3d3ba307ddefae1e0fea3f3168a92e04b95673d3db
MD5 d93e79a1c42989ada3ed9251194401ed
BLAKE2b-256 d202a8d56bf715b7ddfe1971947433bd3b3233648979b4c4213c6d73975f49d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmproc-0.7.0-py3-none-any.whl:

Publisher: release.yml on cccntu/llmproc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page