Turn a useful interaction into a repeatable job

Use a direct goal for a single scripted task. Use an oJob pipeline when you need input validation, multiple steps, post-processing, or scheduling. Embed the JavaScript library when your application owns the surrounding control flow.

mini-a knowledge=README.md goal="Summarize the project in three bullets." format=md outfile=summary.md

This writes the final answer to summary.md. Your script should inspect the result and handle errors; a model-generated answer is not itself a deterministic test.

For a pipeline, follow the oJob agent examples. Job arguments and CLI arguments have different entry points: the reference labels where each option applies. For scheduled runs, configure model credentials and output paths in the execution environment, and avoid prompts requiring interactive approval.

The integration examples below cover the library. The integration interface reference links to the pinned request formats and worker contracts.

Library Integration

mini-a can be used programmatically from JavaScript code and integrated into OpenAF automation workflows.

JavaScript API

Load the installed package and call its MiniA class from OpenAF JavaScript:

loadLib(getOPackPath("mini-a") + "/mini-a.js");
var agent = new MiniA();
var result = agent.start({
  goal: "Describe the purpose of a release checklist in one sentence.",
  useshell: false
});
print(result);

Configure OAF_MODEL in the process environment first. This is OpenAF JavaScript, not Node.js. The returned final result depends on the requested output format; do not assume a wrapper with an output property.

oJob Workflow Integration

Include the package’s MiniAgent job and pass the goal under args:

ojob:
  opacks:
    - mini-a
jobsInclude:
  - mini-a.yaml
todo:
  - Summarize
jobs:
  - name: Summarize
    args:
      goal: "Summarize @README.md in three bullets."
      outfile: summary.md
    to:
      - MiniAgent

Run this with ojob summary.yaml. See oJob-based agents for typed inputs, templates, and post-processing.


Custom Tools

Expose a custom operation through an MCP server, then add that server to mcp=. This keeps the tool’s argument schema, implementation, and transport together.

JavaScript-backed MCP tools

Follow the MCP authoring guide for the supported oJob descriptor and tool schema. Test the server independently, then connect it to mini-a with usetools=true. A standalone JavaScript object is not automatically registered as a Mini-a tool.

Embed a browser conversation

The opt-in iframe bridge supplies allowlisted application fields to each goal in Simple or Advanced Web. Configure exact parent origins and typed fields:

./mini-a-web.sh onport=8888 webembed=true \
  webembedorigins='https://app.example.com' \
  webembedfields='(customerId: (type: string, required: true))' \
  webembedprompt=true

Load the iframe with ?embed=1. The parent exchanges version-1 mini-a:embed messages: hello receives a per-load channel, then set-context sends a strictly increasing revision. Wait for ack before a goal. Use the exact target origin and check both response origin and source window. The complete parent example shows context updates and initial handoff.

webembedcontextrequired=true requires nonempty valid context and at least one configured field. Set false for prompt-only embedding. Fields accept strings, finite safe numbers, booleans and homogeneous arrays; nested objects, unknown fields and coercion are rejected. Limits are 32 fields, 64 items/list, 1,024 UTF-16 code units/string and 16 KiB serialized JSON.

With webembedprompt=true, a same-origin parent can send one initial plain goal as an editable draft or submission. Cross-origin parents may supply context only. A handoff requires a fresh idle conversation and cannot overwrite drafts or send later goals. An acknowledgement means admission, not model completion. Reload requires a new handshake/context. No answers or transcripts are returned to the parent.

Keep normal authentication and backend authorization: context fields are untrusted background data, not identity. Values reach the model and may remain in history or diagnostics. Context/goal text belongs in messages, not URLs. Mini-A’s frame-ancestors policy and the parent’s framing policy must both permit the iframe; do not relax authentication or Origin checks. Read the embedding contract before deploying.