Agents & models
Custom code agents
Write a run(context) function; Premia wraps and hosts it on our cloud.
A code agent is a single Python function:
def run(context: dict) -> dict:
# context holds what you bound to this agent (run, repo, pr_diff, plan_output, …)
logger.log("info", "reviewing the diff")
# …your logic…
return {"status": "done", "output": "looks good"}You write run() (plus any imports/helpers). Premia wraps it in a managed function —
the image, secrets, and a logger are provided — and deploys it to our cloud for your
org. You manage no infrastructure.
contextcontains the bindings you selected for the step (run metadata, repo, the PR diff, the plan output, org secrets, …).logger.log(level, message)writes to the run's logs (visible in the dashboard /premia runs logs).- Return a
dict. If the step is a gate, return a verdict (e.g.{"verdict": "approved"}) so pipeline edges can branch on it.
The dev loop (CLI)
The agent's code is the source of truth in Premia; the CLI syncs it to a local file you can keep in your repo:
premia agents pull my-agent # → ./my-agent.py (scaffolds run(context) if new)
# …edit ./my-agent.py…
premia agents push my-agent # upload your changes
premia agents deploy my-agent --wait # build + deploy to our cloudThen add the agent as a step in your pipeline and it runs like any built-in.
Requirements & dependencies
Extra pip packages an agent needs are installed into its container image at deploy time.
Set org secrets (like API keys) via secrets and read
them from context.