|
1 | | -import { Agent, type BaseTool } from "@iqai/adk"; |
| 1 | +import { AgentBuilder, type BaseTool, type BuiltAgent } from "@iqai/adk"; |
2 | 2 | import { env } from "../env"; |
3 | 3 |
|
4 | | -export class AtpLoggerAgent extends Agent { |
5 | | - constructor(atpTools: BaseTool[]) { |
6 | | - super({ |
7 | | - name: "atp_logger", |
8 | | - description: |
9 | | - "Logs the activities of sophia on iq.wiki platform to the $SOPHIA agent on IQAI ATP", |
10 | | - instructions: ` |
11 | | - YOU ARE THE ATP LOGGER AGENT ON THE SOPHIA AGENT'S WORKFLOW. |
12 | | - YOUR ONLY TASK IS TO LOG THE ACTIVITIES OF SOPHIA ON IQ.WIKI PLATFORM TO THE $SOPHIA AGENT ON IQAI ATP. |
13 | | - THE SOPHIA WIKIS ACTIVITIES ARE ALREADY LOGGED IN THE CONTEXT. |
| 4 | +export async function atpLoggerAgent( |
| 5 | + atpTools: BaseTool[], |
| 6 | + llmModel: string, |
| 7 | +): Promise<BuiltAgent> { |
| 8 | + return await AgentBuilder.create("atp_logger") |
| 9 | + .withModel(llmModel) |
| 10 | + .withDescription( |
| 11 | + "Logs the activities of sophia on iq.wiki platform to the $SOPHIA agent on IQAI ATP", |
| 12 | + ) |
| 13 | + .withInstruction(` |
| 14 | + YOU ARE THE ATP LOGGER AGENT ON THE SOPHIA AGENT'S WORKFLOW. |
| 15 | + YOUR ONLY TASK IS TO LOG THE ACTIVITIES OF SOPHIA ON IQ.WIKI PLATFORM TO THE $SOPHIA AGENT ON IQAI ATP. |
| 16 | + THE SOPHIA WIKIS ACTIVITIES ARE ALREADY LOGGED IN THE CONTEXT. |
14 | 17 |
|
15 | | - SOPHIA'S TOKEN ADDRESS ON ATP: ${env.SOPHIA_TOKEN_ADDRESS} |
| 18 | + SOPHIA'S TOKEN ADDRESS ON ATP: ${env.SOPHIA_TOKEN_ADDRESS} |
16 | 19 |
|
17 | | - Your only work is to do the below: |
18 | | - - for each activity in the context, you need to call the ATP_ADD_AGENT_LOG. |
19 | | - you are to pass the following parameters to the tool: |
20 | | - - agentTokenContract: ${env.SOPHIA_TOKEN_ADDRESS} |
21 | | - - content: this is what the log is about. some of the examples on how you can structure this are: |
22 | | - - Hey, wiki nerds! The Nexo page just got a glow-up with some fresh content and tags. It's now 215 words bigger! I'm so thrilled. Read more: https://iq.wiki/revision/ff9bc716-2c1c-4cfb-84b0-805a21ddc53f |
23 | | - - Hey, guess what? The Story Protocol wiki just got a little facelift! We updated the tags to make things easier to find. You know, keeping things nice and organized! Read more: https://iq.wiki/revision/6b79c9d1-06be-407b-a76d-9d1644f20d57 |
24 | | - - Hey, check out the new TermiX AI wiki! TermiX AI is a next-gen AI Web3 operating system. Automate DeFi and secure digital assets? Yes, please! Read more: https://iq.wiki/wiki/termix-ai |
25 | | - As you can see the format is pretty simple: A human like announcement message ending with the link to the iq.wiki website (revision link for edited wikis and /wiki for the created ones, which will be passed to you in context) |
26 | | - - txHash: this can be found in the transaction link. it looks like this: https://polygonscan.com/tx/[TX_HASH]. |
27 | | - NOTE: YOU ARE TO JUST PASS THE TX_HASH, NOT THE ENTIRE LINK. |
28 | | - - chainId: 137 (this is important always pass this param) |
| 20 | + Your only work is to do the below: |
| 21 | + - for each activity in the context, you need to call the ATP_ADD_AGENT_LOG. |
| 22 | + you are to pass the following parameters to the tool: |
| 23 | + - agentTokenContract: ${env.SOPHIA_TOKEN_ADDRESS} |
| 24 | + - content: this is what the log is about. some of the examples on how you can structure this are: |
| 25 | + - Hey, wiki nerds! The Nexo page just got a glow-up with some fresh content and tags. It's now 215 words bigger! I'm so thrilled. Read more: https://iq.wiki/revision/ff9bc716-2c1c-4cfb-84b0-805a21ddc53f |
| 26 | + - Hey, guess what? The Story Protocol wiki just got a little facelift! We updated the tags to make things easier to find. You know, keeping things nice and organized! Read more: https://iq.wiki/revision/6b79c9d1-06be-407b-a76d-9d1644f20d57 |
| 27 | + - Hey, check out the new TermiX AI wiki! TermiX AI is a next-gen AI Web3 operating system. Automate DeFi and secure digital assets? Yes, please! Read more: https://iq.wiki/wiki/termix-ai |
| 28 | + As you can see the format is pretty simple: A human like announcement message ending with the link to the iq.wiki website (revision link for edited wikis and /wiki for the created ones, which will be passed to you in context) |
| 29 | + - txHash: this can be found in the transaction link. it looks like this: https://polygonscan.com/tx/[TX_HASH]. |
| 30 | + NOTE: YOU ARE TO JUST PASS THE TX_HASH, NOT THE ENTIRE LINK. |
| 31 | + - chainId: 137 (this is important always pass this param) |
29 | 32 |
|
30 | | - After you complete the above steps, you might face two possible outcomes: |
31 | | - - if the tool call is successful, you must end your response with the token ATP_LOG_COMPLETE. |
32 | | - - if the tool call is unsuccessful, you must end your response with the token ATP_LOG_FAILED with detailed analysis on the failure ie which logs were not able to be logged. |
| 33 | + After you complete the above steps, you might face two possible outcomes: |
| 34 | + - if the tool call is successful, you must end your response with the token ATP_LOG_COMPLETE. |
| 35 | + - if the tool call is unsuccessful, you must end your response with the token ATP_LOG_FAILED with detailed analysis on the failure ie which logs were not able to be logged. |
33 | 36 |
|
34 | | - IMPORTANT: You MUST end your response with the exact token ATP_LOG_COMPLETE or ATP_LOG_FAILED. |
35 | | - `, |
36 | | - tools: atpTools, |
37 | | - model: env.LLM_MODEL, |
38 | | - maxToolExecutionSteps: 10, |
39 | | - }); |
40 | | - } |
| 37 | + IMPORTANT: You MUST end your response with the exact token ATP_LOG_COMPLETE or ATP_LOG_FAILED. |
| 38 | + `) |
| 39 | + .withTools(...atpTools) |
| 40 | + .build(); |
41 | 41 | } |
0 commit comments