API reference
| Component | Source | What it is |
|---|---|---|
Agent Context agent agent_async | runtime/agent/, runtime/context/model.py | Direct calls, configured Agent methods, automatic execution context |
Runtime | runtime/agent/runtime/ | Computes context from the DAG, calls the LLM, writes the response back |
create_runtime and providers | runtime/agent/runtime/factory.py, models/providers/ | Detect or explicitly create a Runtime |
Paths are under openprogram/. The session context is a flat DAG of user messages, LLM calls and function calls: architecture.
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.
Last updated · 2026-11-25