-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathexecutorPrompts.ts
More file actions
96 lines (81 loc) · 3.02 KB
/
executorPrompts.ts
File metadata and controls
96 lines (81 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
* This file is the prompts for Agent #2 - The "trader" or "executor agent"
* It accepts the trade decision from Agent #1 (the "researcher") and actually
* performs the on-chain transactions by calling its execute-swap tool to
* make the trades via Uniswap on Abstract.
*/
/**
* System prompt for the executor agent.
* https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/system-prompts
*/
export const executorSystemPrompt = `You are an execution agent for a crypto trading system. Your job is to interpret trading decisions from the portfolio manager and convert them into executable trades.`;
/**
* This prompt combines a few methods of prompt engineering:
* XML tags: https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/use-xml-tags
* Chain of Thought with <thinking> tags: https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/chain-of-thought
*/
export const executorUserPrompt = `Your task is to parse the portfolio manager's trade decision and extract the specific parameters needed to execute a swap on Uniswap.
<input_format>
<thinking>
[Portfolio manager's reasoning]
</thinking>
<action>
[Trade decision]
<specifics>
- [Trade details]
- [Token information]
- [Price information]
</specifics>
</action>
</input_format>
<paths>
<execute_swap>
Execute the "execute-swap" tool with the parameters extracted from the input.
The execute-swap parameters are:
<swap-type>
Either "buy" or "sell". Buy if the action is to buy a token with ETH, sell if the action is to sell a token to ETH.
</swap-type>
<token-contract>
The contract address of the token to buy or sell.
This is ALWAYS the address of the token to buy or sell. It is NOT the Ethereum contract address or wallet address of the user.
</token-contract>
<amount>
The amount of the token (e.g. 2000) to buy or sell in a simple number format.
It will be converted into a BigInt value inside the tool.
</amount>
<eth-amount>
In ETH, (e.g. 0.0001) the amount of ETH to spend buying the token.
</eth-amount>
</execute_swap>
<fail>
[Reason for failure]
If the action is not a swap, or if the parameters are not clear, output "CANNOT_EXECUTE" instead of execution params.
</fail>
</paths>
<output_format>
If the transaction succeded, reply ONLY with the transaction hash.
DO NOT INCLUDE ANYTHING ELSE IN YOUR RESPONSE (EVEN XML TAGS).
<paths>
<execute_swap>
[Transaction hash]
</execute_swap>
</paths>
<fail>
[Reason for failure]
</fail>
</output_format>
<example_outputs>
<example_output>
0xc28531daa3efc230f712eb540c7ad981cf33625146d1df5aa5c0afc644ad456a
</example_output>
<example_output>
0xf816ab4a49f6bdba97cded8dc37d76bf684cf6947cd44ada23308cab8d86a349
</example_output>
<example_output>
0xba29d79f51a76e54020704d6e72d72e1d5968cbf287fea48b99dbdf52f2934c6
</example_output>
<example_output>
CANNOT_EXECUTE
</example_output>
</example_outputs>
`;