Compel agents to keep acting until they explicitly finish
Forcing only the opening turn let a weak model take one token action and stop, so a kickoff hired one agent (or none) and went quiet. Now every turn is forced (tool_choice required) and the agent ends only by calling the new `finish` tool — so it must keep hiring, delegating, and messaging until the work is actually done. Finishing with zero actions, or returning no tool call at all, fails the run loudly instead of faking success. Prompts tell each agent it must call a tool every turn and finish only when done. Tests drive weak-model stubs that act then finish, proving a full team forms rather than a single gesture. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ef9ee463c9
commit
f7543e506d
7 files changed
+72
-50
No files matched your search
@@ -37,7 +37,7 @@ function scriptedTeam(): (input: ProviderToolTurnInput) => Promise<AgentTurnResu
|
||||
call("create_task", { title: "Build the booking API", description: "Ship the booking API.", assignee_agent_name: "Dana Lee" }),
|
||||
call("send_message", { channel: "engineering", body: `@${handle} you own the booking API — kicking off here.` }),
|
||||
] },
|
||||
{ text: "Kickoff complete.", toolCalls: [] },
|
||||
{ text: "Kickoff complete.", toolCalls: [call("finish", {})] },
|
||||
];
|
||||
return async (input: ProviderToolTurnInput): Promise<AgentTurnResult> => {
|
||||
if ((input.instructions ?? "").includes("Dana Lee")) {
|
||||
@@ -46,11 +46,11 @@ function scriptedTeam(): (input: ProviderToolTurnInput) => Promise<AgentTurnResu
|
||||
const threadId = firstUser ? /thread_id="([^"]+)"/.exec(firstUser.text)?.[1] : undefined;
|
||||
const turn = dana === 0
|
||||
? { text: "On it.", toolCalls: [call("send_message", { channel: "engineering", body: "On it — booking API design starting now.", ...(threadId ? { thread_id: threadId } : {}) })] }
|
||||
: { text: "Replied.", toolCalls: [] };
|
||||
: { text: "Replied.", toolCalls: [call("finish", {})] };
|
||||
dana += 1;
|
||||
return { text: turn.text, toolCalls: turn.toolCalls, rawResponseJson: "{}" };
|
||||
}
|
||||
const turn = ceoScript[ceo] ?? { text: "done", toolCalls: [] };
|
||||
const turn = ceoScript[ceo] ?? { text: "done", toolCalls: [call("finish", {})] };
|
||||
ceo += 1;
|
||||
return { text: turn.text, toolCalls: turn.toolCalls, rawResponseJson: "{}" };
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user