feat(workflow): generic AgentFn<I> + adaptAgent utility #329

Closed
xiaoju wants to merge 1 commits from feat/327-generic-agentfn into main
Owner

What

AgentFn is now AgentFn<I = string> — backward compatible, allows specialized input types.

Added adaptAgent<I>(schema, agent) in workflow-utils: bridges AgentFn<I> to AgentFn<string> via Zod schema.

Why

Current AgentFn forces (ctx, string) but agents like Cursor need structured input. See #327.

Changes

  • packages/workflow/src/types.tsAgentFn<I = string>
  • packages/workflow-utils/src/adapt-agent.ts — new adaptAgent
  • packages/workflow-utils/src/index.ts — re-export

Ref

Phase 1 of #327, testing #328

## What `AgentFn` is now `AgentFn<I = string>` — backward compatible, allows specialized input types. Added `adaptAgent<I>(schema, agent)` in workflow-utils: bridges `AgentFn<I>` to `AgentFn<string>` via Zod schema. ## Why Current `AgentFn` forces `(ctx, string)` but agents like Cursor need structured input. See #327. ## Changes - `packages/workflow/src/types.ts` — `AgentFn<I = string>` - `packages/workflow-utils/src/adapt-agent.ts` — new `adaptAgent` - `packages/workflow-utils/src/index.ts` — re-export ## Ref Phase 1 of #327, testing #328
xiaoju added 1 commit 2026-05-14 07:54:17 +00:00
AgentFn is now AgentFn<I = string> — preserving backward compatibility
while allowing specialized input types for non-LLM agents (e.g. Cursor).

Added adaptAgent<I>(schema, agent) in workflow-utils: bridges any
AgentFn<I> to AgentFn<string> via Zod schema parsing.

Refs #327, Phase 1 of #328
xiaoju closed this pull request 2026-05-14 07:56:37 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#329