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.3.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.3-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for llmproc-0.6.3.tar.gz
Algorithm Hash digest
SHA256 08fa767b64dac63414826fe781ce556d2ec23bf59af9d834f584875c50077421
MD5 69497d5d396379bd43a52b9dddfbd53f
BLAKE2b-256 17e5f94f697605cc00ba1c19d61a55cb24d16e1fc89172ef953c829d9e1f8d48

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmproc-0.6.3.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.6.3-py3-none-any.whl.

File metadata

  • Download URL: llmproc-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 25.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.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5428bb72aa0a2a31c09896f5ddf4b868e28c0eafa21528f8517f94bf56a07a5a
MD5 654ac5306f338bc28417a1ca324a0e8c
BLAKE2b-256 6c98658081a06e1d8f98eb51d1b95f46e4301ffa5fc3b53eccba41141761355e

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmproc-0.6.3-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