Cortex · Prompt and context

Run producers (producers)

producers in a run’s options adds producers after the agent’s own context. An app gives every agent the same facts this way, such as who is asking and what day it is, without changing their definitions.

Agents
const asking = ['The member asking is Grace.', 'Today is Friday 2026-10-23.'];

const desk = defineAgent({ id: 'desk', instructions: '…', context: ['Doors open thirty minutes before the show.'] });
const clerk = defineAgent({ id: 'clerk', instructions: '…' });

await desk.preview('Two seats tomorrow, please.', { llm, producers: asking });
await clerk.preview('Two seats tomorrow, please.', { llm, producers: asking });
Messages after the finish protocol
{
  desk: [
    'system Doors open thirty minutes before the show.',
    'system The member asking is Grace.',
    'system Today is Friday 2026-10-23.',
    'user Two seats tomorrow, please.',
  ],
  clerk: [
    'system The member asking is Grace.',
    'system Today is Friday 2026-10-23.',
    'user Two seats tomorrow, please.',
  ],
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.