Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 2.1 KB

File metadata and controls

49 lines (36 loc) · 2.1 KB

API Reference

Source: openprogram/

Core Components

Component Source File Description
agentic_function agentic_programming/function.py A decorator. Turns a plain function into an Agentic Function; each call is recorded as a node in the session DAG
Runtime agentic_programming/runtime.py The LLM runtime. Computes context from the DAG, calls the LLM, and writes the response back to the DAG
create_runtime and the built-in providers providers/ Automatically detect or explicitly create a Runtime; supports Anthropic / OpenAI / Gemini / CLI providers

The session context is a flat DAG (nodes = user messages / LLM calls / function calls); for the architecture see openprogram/context/README.md.

Writing Functions

There are no meta functions like create() / fix() — writing, modifying, and validating an @agentic_function is done directly with ordinary file-editing tools. The agentic function API defines the decorator and authoring contract.

Imports

from openprogram import agentic_function, Runtime, Session, decision
from openprogram.providers.registry import create_runtime

agentic_function, Runtime, Session, and decision are re-exported from the top-level openprogram package. Provider helpers such as create_runtime are imported from their full paths.

Quick Example

from openprogram import agentic_function
from openprogram.agentic_programming import llm
from openprogram.providers.registry import create_runtime

@agentic_function
def observe(task: str, runtime) -> str:
    """Report the UI element on screen that matches a task."""
    return llm([
        {"type": "text", "text": (
            f"Find the UI element for: {task}. Reply with its label only."
        )},
    ])

rt = create_runtime()
print(observe(task="login button", runtime=rt))
rt.close()