Skip to main content

Documentation Index

Fetch the complete documentation index at: https://simplellmfunc.cn/llms.txt

Use this file to discover all available pages before exploring further.

SimpleLLMFunc

LLM calls as typed Python functions. Context compiled from prompts, history, and runtime patches. Prompts as code. SimpleLLMFunc is a framework for building LLM-powered agents where every LLM interaction is a normal Python function call — typed, testable, and composable. No chains, no graphs, no YAML. Just functions.

Choose Your Path

Start Building

Get a working agent in 5 minutes. Install, configure, run.

Understand the Model

Learn why SimpleLLMFunc works the way it does. Three short essays on design philosophy.

API Reference

Jump straight to signatures, types, and parameters.

What Makes This Different

LLM is Function

@llm_function(llm_interface=llm)
async def analyze(text: str) -> SentimentReport:
    """Classify sentiment. Return structured report."""
    pass

result = await analyze("Great product, terrible shipping.")
print(result.sentiment)  # "mixed"
No SDK boilerplate. No message list construction. The decorator handles context compilation, type parsing, and structured output extraction. You write a function signature and a docstring.

Context-Centric

Every LLM call is compiled into a provider-facing message list. The compiler combines invocation configuration (docstrings, template values, tool guidance), the base transcript/history, and internal runtime patches. Those patches are represented as mutations so LLM calls, tools, SelfRef, and abort handling do not directly edit the live transcript.

Prompt as Code

Your docstring IS the system prompt. It lives next to the code that uses it, versions with git, and benefits from IDE tooling. No separate prompt files, no template engines, no drift between what you wrote and what the model sees.

The Stack at a Glance

┌─────────────────────────────────────────┐
│         Your Agent Code                  │
│   @llm_function / @llm_chat / @tool     │
├─────────────────────────────────────────┤
│         Compile Boundary                 │
│   Config + Transcript + Patches → LLM   │
├─────────────────────────────────────────┤
│         ReAct Runtime                    │
│   Event stream, tool scheduling, abort  │
├─────────────────────────────────────────┤
│         Interface Layer                  │
│   OpenAICompatible / ResponsesCompatible│
└─────────────────────────────────────────┘

Ready to build?

Start with a 5-minute quickstart that gets you from zero to a working LLM function call.