Repository navigation
Runtime and Authority
An Agent owns one compiled Image, its package source directory capability, one configured entry module, an HTTP client, and default limits. Constructing an Agent compiles and opens its source directory. Every call creates independent runtime state; Agents may be called concurrently. The Effect SDK may set the child working directory and an exact child environment without changing package input, config, or authority.
An Agent must outlive all calls and Imports that reference it. Call input,
config, emitted bytes, and result are borrowed only for the duration of the
call. Lua values never cross runtime states. pa.emit(bytes) starts an opaque message and pa.emit(bytes, "append") extends its current tail; both are no-ops when emissions are disabled. PA does not interpret model reasoning or content. pa.log carries bounded stage names separately from user-visible output. Lua failures retain bounded traceback details for operator-side inspection.
Trusted package code has normal Lua libraries, Image modules, Import modules,
and require("pa"). It loads pure Lua dependencies only from the Image and native modules only from the opened package's absolute native/ directory; ambient Lua search paths are ignored. Eval gets only its selected entry functions, caller Imports through require(name), and its restricted standard library. pa.imports() lists grants for trusted package code; opaque config cannot add one.
Native modules are trusted code and are not contained by Lua allocation or instruction accounting. Embedders must treat them as part of the package's authority.
Each Lua state has an allocation quota and instruction quota. The current binary defaults are 16 MiB and 2,000,000 instructions. Limits apply separately to trusted and Eval states.
Host operations and Eval share call cancellation. pa.http can enforce a byte limit while buffering or invoke an on_chunk(status, bytes) callback under that limit; the response request is released if interrupted. Portable Agents does not
choose a wall-clock timeout; the embedder must provide one. The Effect SDK
interrupts its child process when its scope is interrupted.
Eval authority is:
selected direct entry members + caller-provided Imports
A package must not treat input or config as an authority grant. The embedder should normally make Import edges downgrade-only, such as a trusted Agent importing a restricted Agent.