@pmcollab/coworkstream-engine-azure-ai-agent
v0.1.0
Published
Azure AI Agent Service AgentRunner adapter for @pmcollab/coworkstream-engine. Wraps an agent hosted in Azure AI Foundry.
Readme
@pmcollab/coworkstream-engine-azure-ai-agent
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.
Azure AI Agent Service AgentRunner adapter — wraps an agent hosted in Azure AI Foundry.
Install
npm install @pmcollab/coworkstream-engine-azure-ai-agent @azure/ai-projects @azure/identityUse
import { AIProjectsClient } from '@azure/ai-projects'
import { DefaultAzureCredential } from '@azure/identity'
import { createEngine } from '@pmcollab/coworkstream-engine'
import { createAzureAIAgentAgent } from '@pmcollab/coworkstream-engine-azure-ai-agent'
const projects = AIProjectsClient.fromConnectionString(
process.env.AI_PROJECT_CONNECTION_STRING,
new DefaultAzureCredential()
)
const agent = createAzureAIAgentAgent({
id: 'risk-azure',
projectsClient: projects,
agentId: 'asst_xxxx',
})
const engine = createEngine({ agents: [agent], /* ... */ })Flow per item
- Create a thread.
- Post the formatted item as a user message.
- Create a run against the configured agent.
- Poll until terminal status (
completed,failed,cancelled,expired). - Read the assistant's reply and extract
{ position, reasoning, confidence }.
Recommended agent setup
Configure your Azure AI agent's instructions to end with:
Respond with a JSON object:
{ "position": "...", "reasoning": "...", "confidence": 0..1 }
The default extractor parses JSON out of the assistant's text. Or set the agent to use structured output (response_format) and the JSON path becomes guaranteed.
Options
createAzureAIAgentAgent({
id, projectsClient, agentId, // required
name?, avatar?, capabilities?,
pollIntervalMs?: number, // default 1000
timeoutMs?: number, // default 120_000
defaultConfidence?: number,
formatItem?: (item, ctx) => string,
extractPosition?: (message, item, ctx) => { position, reasoning, confidence },
})License
Commercial. See LICENSE in the repository root.
