@pmcollab/coworkstream-engine-openai
v0.1.0
Published
OpenAI AgentRunner adapter for @pmcollab/coworkstream-engine. Works with chat completions + structured output and the Agents API.
Readme
@pmcollab/coworkstream-engine-openai
Coding agents: read
packages/workstream-engine/AGENTS.mdfor the engine integration recipe before wiring this adapter. Migrating an existing setup? Seepackages/workstream-engine/MIGRATION.md.
OpenAI AgentRunner adapter for @pmcollab/coworkstream-engine. Uses chat completions with JSON Schema response_format for structured output.
Install
npm install @pmcollab/coworkstream-engine-openai openaiUse
import OpenAI from 'openai'
import { createEngine } from '@pmcollab/coworkstream-engine'
import { createOpenAIAgent } from '@pmcollab/coworkstream-engine-openai'
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY })
const agent = createOpenAIAgent({
id: 'risk',
client,
model: 'gpt-4o',
instructions: 'You are a risk reviewer. Evaluate proposed actions for risk to revenue.',
})The model is asked to return a JSON object matching:
{ position: string, reasoning: string, confidence: number }Position is taken straight from the JSON. Malformed responses produce a { confidence: 0, error } result so the engine can de-weight that agent without crashing.
Options
createOpenAIAgent({
id, client, // required
name?, avatar?, capabilities?,
model?: string, // default 'gpt-4o'
instructions?: string,
temperature?: number, // default 0.2
defaultConfidence?: number, // default 0.7
formatItem?: (item, ctx) => string,
})License
Commercial. See LICENSE in the repository root.
