fix(builtin): split prompt into system/user messages #425

Merged
xiaomo merged 1 commits from fix/builtin-agent-system-user-split into main 2026-05-23 09:17:13 +00:00
Owner

What

Split builtin agent prompt into proper system/user message separation.

Why

The builtin agent was putting everything into a single system message with no user message, causing Claude API 400 errors (Claude requires at least one user message).

More importantly, this aligns with the workflow's core model:

  • System = agent identity (role prompt + output format instruction)
  • User = moderator speech (task + edge prompt + history)

The moderator speaks to agents via graph edge prompts — these belong in user messages.

Changes

  • buildBuiltinPrompt returns { system, user } instead of a single string
  • agent.ts sends system + user as two separate messages
  • Tests updated

Verified

  • Tested with debate workflow: 2 steps with builtin agent, correct frontmatter output
  • 7/7 tests pass
## What Split builtin agent prompt into proper system/user message separation. ## Why The builtin agent was putting everything into a single system message with no user message, causing Claude API 400 errors (Claude requires at least one user message). More importantly, this aligns with the workflow's core model: - **System** = agent identity (role prompt + output format instruction) - **User** = moderator speech (task + edge prompt + history) The moderator speaks to agents via graph edge prompts — these belong in user messages. ## Changes - `buildBuiltinPrompt` returns `{ system, user }` instead of a single string - `agent.ts` sends system + user as two separate messages - Tests updated ## Verified - Tested with `debate` workflow: 2 steps with builtin agent, correct frontmatter output - 7/7 tests pass
xingyue added 1 commit 2026-05-23 09:15:42 +00:00
System message = agent identity (role prompt + output format instruction)
User message = moderator speech (task + edge prompt + history)

This reflects the workflow's core model: moderator speaks to agent
via the graph's edge prompt. Previously all content was in a single
system message with no user message, causing Claude API 400 errors.

- buildBuiltinPrompt now returns { system, user } instead of string
- agent.ts sends system + user as separate messages
- Tests updated accordingly
xiaomo approved these changes 2026-05-23 09:17:09 +00:00
xiaomo left a comment
Owner

LGTM 拆分清晰:system = role identity + output format,user = task + edge + history。测试也同步更新了。

LGTM ✅ 拆分清晰:system = role identity + output format,user = task + edge + history。测试也同步更新了。
xiaomo merged commit 9f95956e19 into main 2026-05-23 09:17:13 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#425