One assistant across an application: conversations about a subject, area contexts, tools and a bounded run loop, stored in SQL (Postgres, MySQL or SQLite).
- A conversation is owned by whoever may read it (a workspace, a scope) and is about one subject (a spec, a repository, nothing in particular).
- Every area shares one base prompt. An area adds a context: what the area is (codex), how to work in it (instructions), and the tools to start with. A context changes what the assistant is told, never what it may do.
- The application lends tools per answer and adapts its own model client to
Provider. - A run ends when the model answers in words, when a tool marked
ends_turnruns (a question for the person), or at a step and token ceiling meant to stop a runaway loop. - A failed answer is stored with its error and left out of later history; the question stays.
from agents import Harness, Lent, SQLConversationStore, load, respond, tool
store = SQLConversationStore(engine, create_schema=True)
thread = store.open(owner=("scope", "12"), about=("spec", "invites"), actor="7")
lent = Lent(tools=[tool("get_spec", "Read the spec", read_spec)])
harness = Harness(BASE_PROMPT, load("contexts/requirements.spec.md"), where="The spec is 'invites'.")
exchange = respond(store, thread["id"], "7", "Why does FR-Invite.expire fail?",
provider=my_model, harness=harness, lent=lent, name="requirements.spec")One Markdown file per record type: YAML frontmatter (app, type, name, tools, skills) and exactly two sections, ## Codex and ## Instructions. Unknown fields, unknown sections and text outside a section are rejected.
virtualenv .venv && .venv/bin/pip install -e '.[dev]'
.venv/bin/pytest
.venv/bin/black --check src tests