cfe4543d39
BREAKING CHANGES:
- Remove AgentFn, AgentFnResult, AgentBinding from workflow-protocol
- Remove wrapAgentAsAdapter from workflow-util-agent
- workflowAsAgent → workflowAdapter (old name kept as deprecated re-export)
New APIs:
- createTextAdapter(producer) — bridges text-producing functions to AdapterFn
- TextProducerFn, TextAdapterResult types
- workflowAdapter() — direct AdapterFn for child workflow delegation
All agent packages (cursor, hermes, llm) now return AdapterFn directly,
no wrapping needed. Bundle entries simplified accordingly.
小橘 🍊(NEKO Team)
@uncaged/workflow-agent-llm
AgentFn adapter that calls an OpenAI-compatible POST /chat/completions endpoint using LlmProvider from @uncaged/workflow-runtime.
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-runtime zod
In this monorepo: "@uncaged/workflow-agent-llm": "workspace:*", "@uncaged/workflow-runtime": "workspace:*" (and satisfy zod ^4 as required by @uncaged/workflow-runtime).
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 |