Skip to content

Commit dc33a14

Browse files
committed
base2-alloy2!
1 parent 06f21c5 commit dc33a14

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { createBase2 } from '../base2'
2+
import type { SecretAgentDefinition } from '../../types/secret-agent-definition'
3+
import { ToolCall } from '../../types/agent-definition'
4+
5+
const base2 = createBase2('fast')
6+
const definition: SecretAgentDefinition = {
7+
...base2,
8+
id: 'base2-alloy2',
9+
spawnableAgents: [
10+
...(base2.spawnableAgents ?? []),
11+
'base2-plan-step',
12+
'base2-plan-step-gpt-5',
13+
],
14+
stepPrompt: `${base2.stepPrompt}
15+
16+
## Spawned planner agents have generated potential next steps
17+
18+
Two hypothetical next steps have been generated from planner agents (base2-plan-step and base2-plan-step-gpt-5). Use them as inspiration to write out your own next step. Feel free to take the best parts of each step or ignore them, but know that none of what they wrote out has taken any effect, and it's up to you to write out the actual next step that the user will see.`,
19+
20+
handleSteps: function* ({ params, logger }) {
21+
while (true) {
22+
// Run context-pruner before each step
23+
yield {
24+
toolName: 'spawn_agent_inline',
25+
input: {
26+
agent_type: 'context-pruner',
27+
params: params ?? {},
28+
},
29+
includeToolCall: false,
30+
} as any
31+
32+
yield {
33+
toolName: 'spawn_agents',
34+
input: {
35+
agents: [
36+
{
37+
agent_type: 'base2-plan-step',
38+
},
39+
{
40+
agent_type: 'base2-plan-step-gpt-5',
41+
},
42+
],
43+
},
44+
}
45+
46+
const { stepsComplete, agentState } = yield 'STEP'
47+
48+
// Remove the spawn & spawn result for the base2-plan-step agents
49+
const spawnResultIndex = agentState.messageHistory.findLastIndex(
50+
(m) =>
51+
m.role === 'tool' &&
52+
m.content.toolName === 'spawn_agents' &&
53+
m.content.output[0].type === 'json' &&
54+
(m.content.output[0].value as any[])[0]?.agentType ===
55+
'base2-plan-step',
56+
)
57+
58+
const updatedMessageHistory = agentState.messageHistory.concat()
59+
updatedMessageHistory.splice(spawnResultIndex - 1, 2)
60+
61+
yield {
62+
toolName: 'set_messages',
63+
input: {
64+
messages: updatedMessageHistory,
65+
},
66+
includeToolCall: false,
67+
} satisfies ToolCall<'set_messages'>
68+
69+
if (stepsComplete) break
70+
}
71+
},
72+
}
73+
74+
export default definition
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import planStep from './base2-plan-step'
2+
import type { SecretAgentDefinition } from '../../types/secret-agent-definition'
3+
4+
const definition: SecretAgentDefinition = {
5+
...planStep,
6+
id: 'base2-plan-step-gpt-5',
7+
model: 'openai/gpt-5',
8+
}
9+
10+
export default definition
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { createBase2 } from '../base2'
2+
import type { SecretAgentDefinition } from '../../types/secret-agent-definition'
3+
4+
const base2 = createBase2('fast')
5+
const definition: SecretAgentDefinition = {
6+
...base2,
7+
id: 'base2-plan-step',
8+
model: 'anthropic/claude-sonnet-4.5',
9+
displayName: 'Plan Step',
10+
spawnerPrompt: "Plans the next step in the user's request.",
11+
12+
includeMessageHistory: true,
13+
inheritParentSystemPrompt: true,
14+
systemPrompt: undefined,
15+
16+
// No tools or spawnable agents, this agent merely plans.
17+
toolNames: [],
18+
spawnableAgents: [],
19+
20+
inputSchema: {},
21+
outputMode: 'last_message',
22+
23+
handleSteps: function* ({ params }) {
24+
yield 'STEP'
25+
},
26+
}
27+
28+
export default definition

0 commit comments

Comments
 (0)