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.6.0.tar.gz (143.1 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.6.0-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llmproc-0.6.0.tar.gz
  • Upload date:
  • Size: 143.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.17

File hashes

Hashes for llmproc-0.6.0.tar.gz
Algorithm Hash digest
SHA256 dd263c63baa6538125e5e80b5d2d22834afb45b04217a69315ef3c7789a2da55
MD5 b869240d4f81432e31f5a67c097a5623
BLAKE2b-256 d611bfae3217bc8f35d2c4d3332253bbcab9e0fc554a36b878c67dbcaaf76040

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llmproc-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 25.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.17

File hashes

Hashes for llmproc-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd027112b33f6f345d239dd1e6a252535b0a8411d608ed4342747a84ad4f5cd3
MD5 645d970e9a92b57d9c41aadb7a7005c0
BLAKE2b-256 293bb96339a22ba397de1e5690e17d3d7c6aca23e73ddfedee0a2b0d44bd46be

See more details on using hashes here.

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