727b4bb3ed
- Update root tsconfig.json references: replace packages/workflow with 6 new packages - Update cli-workflow tsconfig references to new packages - Add tsconfig references to workflow-util, workflow-runtime, workflow-execute - Fix workflow-agent-llm, workflow-agent-cursor, workflow-agent-hermes, workflow-util-agent tsconfig references (../workflow -> ../workflow-runtime) - Remove stale @uncaged/workflow deps from agent package.json files - Change template packages to import buildDescriptor from @uncaged/workflow-register - Normalize package.json exports field across all new packages - Delete old packages/workflow/ directory
@uncaged/workflow-agent-llm
AgentFn adapter that calls an OpenAI-compatible POST /chat/completions endpoint using @uncaged/workflow’s LlmProvider (base URL, API key, model).
Single-turn: system text is the current role’s systemPrompt, user text is the thread’s initial prompt (ctx.start.content). Errors from HTTP, JSON, or empty choices are thrown as Error with a JSON payload string.
Install
bun add @uncaged/workflow-agent-llm @uncaged/workflow
In this monorepo: "@uncaged/workflow-agent-llm": "workspace:*", "@uncaged/workflow": "workspace:*".
Usage
import { createLlmAdapter } from "@uncaged/workflow-agent-llm";
const agent = createLlmAdapter({
baseUrl: "https://api.openai.com/v1",
apiKey: process.env.OPENAI_API_KEY!,
model: "gpt-4.1-mini",
});
API overview
| Export | Description |
|---|---|
createLlmAdapter(provider) |
LlmProvider → AgentFn |
chatCompletionText({ provider, messages }) |
Low-level Result<string, LlmChatError> helper |
LlmMessage |
{ role: "system" | "user" | "assistant"; content: string } |
LlmChatError |
Discriminated error kinds for failed completions |