# API reference

| Component | Source | What it is |
| --- | --- | --- |
| [`Agent` `Context` `agent` `agent_async`](https://fzkuji.github.io/OpenProgram/docs/reference/api/agent.html) | `runtime/agent/`, `runtime/context/model.py` | Direct calls, configured Agent methods, automatic execution context |
| [`Runtime`](https://fzkuji.github.io/OpenProgram/docs/reference/api/runtime.html) | `runtime/agent/runtime/` | Computes context from the DAG, calls the LLM, writes the response back |
| [`create_runtime` and providers](https://fzkuji.github.io/OpenProgram/docs/reference/api/providers.html) | `runtime/agent/runtime/factory.py`, `models/providers/` | Detect or explicitly create a Runtime |

Paths are under [`openprogram/`](https://github.com/Fzkuji/OpenProgram/tree/main/openprogram/). The session context is a flat DAG of user messages, LLM calls and function calls: [architecture](https://github.com/Fzkuji/OpenProgram/blob/main/openprogram/runtime/context/README.md).

## Imports

```
from openprogram import Agent, Context, agent, agent_async, Runtime, Session, decision
from openprogram import ChatAgent, TurnRequest, TurnResult
from openprogram.runtime.agent.runtime.factory import create_runtime
```

## Example

```
from openprogram import Agent

class Observer(Agent):
    tools = []

    def observe(self, task: str) -> str:
        """Identify the requested UI element."""
        return self(f"Find the UI element for: {task}. Reply with its label only.")

print(Observer().observe("login button"))
```

There are no meta functions like `create()` or `fix()`. Write, change and validate Agent methods and Program functions with ordinary file-editing tools.
