# 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")
```

| Thing | Rule |
| --- | --- |
| Agent | Holds configuration only: `model`, `effort`, `instructions`, `tools`. Owns no conversation; the execution scope decides whether history continues |
| Agent method | Every 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 |
| Context | Parent inheritance, named content, evaluation, history visibility |
| `method_options` | Per 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 |
| Program | A package of such classes and functions. Registered sources list public entries in `PROGRAM_ENTRIES`; explicit metadata preserves names and input forms |
| `@function` tool | Deterministic, same registry. Authorization is separate from call recording and history visibility |
| Skill | Instructions only; creates no executable entry |
| Module-level helper | Normal 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](https://fzkuji.github.io/OpenProgram/docs/reference/design/integrations/nooa.html#contract), [status](https://fzkuji.github.io/OpenProgram/docs/reference/design/integrations/nooa.html#implementation).

[Function calling](https://fzkuji.github.io/OpenProgram/docs/reference/design/function/calling-unification.html)
