OpenProgram Docs

Agent classes, Programs and tools

from openprogram import Agent

def prepare(text):                                   # plain Python, no DAG node
    return text.strip()

class Researcher(Agent):
    model = "configured-model"
    method_options = {"research": {"tool": True}}    # registers this method as a tool

    def research(self, question):                    # recorded in the DAG
        answer = self(prepare(question))             # one model call
        if "TODO" in answer:                         # a check written in code
            answer = self(f"Finish this answer: {answer}")
        return answer

result = Researcher().research("A topic")
ThingRule
AgentHolds configuration only: model, effort, instructions, tools. Owns no conversation; the execution scope decides whether history continues
Agent methodEvery function on the subclass. No decorator: calling it enters a scope, records it in the session DAG and derives Context for model calls inside it
self(...)One model call. Branches, loops, retries and checks around it are plain Python
ContextParent inheritance, named content, evaluation, history visibility
method_optionsPer method: tool=True, public name, description, input form, visibility, entry metadata, durable steps (resumable). A method without options is still recorded, but is not a tool
ProgramA package of such classes and functions. Registered sources list public entries in PROGRAM_ENTRIES; explicit metadata preserves names and input forms
@function toolDeterministic, same registry. Authorization is separate from call recording and history visibility
SkillInstructions only; creates no executable entry
Module-level helperNormal Python: signatures, returns, exceptions and imports unchanged, no DAG node

Implemented in openprogram/runtime/agent/agent_class.py and agent_method.py. Class API, execution lifetime and verification status: Agent and Context contract, status.

Function calling

Last updated · 2026-11-25