Skip to content

angee.agents.context

Render a model-generic <system_context> prompt block from a view envelope.

The chat client prefixes each message with the context of what the user is looking at — the open record, a list selection, or a dashboard. The browser sends a view envelope; this builds a compact text block the agent can read: the view metadata, short previews of the selected rows, and a pointer to the MCP tools for full bodies. Model-generic: it resolves the model from the envelope's app/model type and summarises each row from a few public fields, so any addon's model works without a per-model branch here.

render_view_context

python
def render_view_context(view: dict[str, Any]) -> str

Return a <system_context> block describing the open view.

view is {kind, type: "<app>/<model>", sqid?, sqids?, params?}. Returns an empty string for an empty or untyped envelope (nothing to add). Rows are read scoped to the request's ambient actor — only rows the caller may read are previewed, so the block never leaks a row the user can't see — capped, and previewed from a few public fields. Call within a resolved actor context.

Released under the AGPL-3.0 License.