Embedding agents

Product patterns for agent UIs built on the API.

Teams embed Optamus to add agent capabilities to their own products. A few patterns that work well.

Review-before-write

Stream diffs to your UI and require an explicit user action before applying. This is the default pattern in the desktop app and the one we recommend for anything user-facing.

Plan mode

For long tasks, ask the agent for a plan first, let the user edit it, then execute. Two runs, one workspace:

const plan = await client.runs.create({ prompt, mode: 'plan' });
// ... user edits plan ...
await client.runs.create({ prompt: execute(plan.result()), mode: 'execute' });

Scoped tools

Expose only the tools your surface needs:

client.runs.create({
  prompt,
  tools: ['read', 'grep'], // no write, no shell
});

Session persistence

Runs are addressable. Persist run.id and resume a conversation with client.runs.resume(runId).