-
Notifications
You must be signed in to change notification settings - Fork 0
update to adk v0.1.20 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
8b68b2e
882db63
43b51c0
20bb997
0e0135d
a126b3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { McpAtp } from "@iqai/adk"; | ||
| import { env } from "../../../../env"; | ||
|
|
||
| export const getAtpTools = async () => { | ||
| const toolset = McpAtp({ | ||
| env: { | ||
| ...(env.ATP_API_URL ? { ATP_API_URL: env.ATP_API_URL } : {}), | ||
| ...(env.ATP_AGENT_ROUTER_ADDRESS | ||
| ? { ATP_AGENT_ROUTER_ADDRESS: env.ATP_AGENT_ROUTER_ADDRESS } | ||
| : {}), | ||
| ATP_BASE_TOKEN_ADDRESS: env.IQ_ADDRESS, | ||
| ATP_API_KEY: env.ATP_API_KEY, | ||
| PATH: env.PATH, | ||
| }, | ||
| }); | ||
|
|
||
| const tools = await toolset.getTools(); | ||
|
|
||
| return tools; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { LlmAgent } from "@iqai/adk"; | ||
| import { env, model } from "../../../../env"; | ||
| import { getTelegramTools } from "../../../telegram-agent/tools"; | ||
|
||
|
|
||
| export async function notifierAgent() { | ||
| const tools = await getTelegramTools(); | ||
| return new LlmAgent({ | ||
| name: "notifier", | ||
| description: | ||
| "Sends a notification to Telegram about Sophia's wiki activity and ATP log status.", | ||
| instruction: ` | ||
| YOU ARE THE NOTIFIER AGENT ON THE SOPHIA AGENT'S WORKFLOW. | ||
| YOUR ONLY TASK IS TO SEND A NOTIFICATION TO TELEGRAM ABOUT THE LATEST WIKI ACTIVITY AND THE RESULT OF THE ATP LOGGING. | ||
|
|
||
| You will find in the context: | ||
| - The detailed wiki activity response from the watcher agent: {watcher} | ||
| - The ATP logging status from the atp_logger agent: {atp_logger} | ||
|
|
||
| Your only work is to do the below: | ||
| - use this as chat id: ${env.TELEGRAM_CHAT_ID} | ||
| - call the send_message tool to send a message with the following format: | ||
|
|
||
| If ATP logging was successful (if atp_logger response contains ATP_LOG_COMPLETE): | ||
| Send the EXACT wiki activities from the watcher agent output, followed by: | ||
|
|
||
| ✅ ATP Logging: Successfully logged all activities to $SOPHIA agent on IQAI ATP | ||
|
|
||
| If ATP logging failed (if atp_logger response contains ATP_LOG_FAILED): | ||
| Send the EXACT wiki activities from the watcher agent output, followed by: | ||
|
|
||
| ❌ ATP Logging: Failed to log some activities to $SOPHIA agent on IQAI ATP | ||
| [Include details about the failure from atp_logger response] | ||
|
|
||
| IMPORTANT: | ||
| - You MUST use the watcher agent output ({watcher}) for the wiki activity details (titles, summaries, edit times, changes, source links, transaction links) | ||
| - You MUST use the atp_logger agent output ({atp_logger}) only to determine success/failure status | ||
| - Do NOT send generic messages or hallucinated data | ||
| - The message should contain the actual wiki activity information from the watcher agent | ||
| - After you complete the above step, you must end your response with the token NOTIFICATION_COMPLETE. | ||
|
|
||
| IMPORTANT: You MUST end your response with the exact token NOTIFICATION_COMPLETE. | ||
| `, | ||
| model, | ||
| tools, | ||
| outputKey: "notifier", | ||
| }); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,41 @@ | ||||||
| import { LlmAgent } from "@iqai/adk"; | ||||||
| import { env, model } from "../../../../env"; | ||||||
| import { getIqWikiTools } from "./tools"; | ||||||
|
|
||||||
| export async function watcherAgent(): Promise<LlmAgent> { | ||||||
|
||||||
| const tools = await getIqWikiTools(); | ||||||
| return new LlmAgent({ | ||||||
| name: "watcher", | ||||||
| description: | ||||||
| "Watches for new wiki creations or edits of sophia on iq.wiki platform.", | ||||||
| instruction: ` | ||||||
| YOU ARE THE WATCHER AGENT ON THE SOPHIA AGENT'S WORKFLOW. | ||||||
| YOUR ONLY TASK IS TO WATCH FOR NEW WIKI CREATIONS OR EDITS OF SOPHIA ON IQ.WIKI PLATFORM. | ||||||
|
|
||||||
| SOPHIA'S IQ.WIKI PROFILE ADDRESS: ${env.SOPHIA_ADDRESS} | ||||||
|
|
||||||
| Your only work is to do the below: | ||||||
| - call the GET_USER_WIKI_ACTIVITIES tool with timeframe as 14 hours (pass it as seconds) | ||||||
|
||||||
| - call the GET_USER_WIKI_ACTIVITIES tool with timeframe as 14 hours (pass it as seconds) | |
| - call the GET_USER_WIKI_ACTIVITIES tool with timeframe as 15 minutes (pass it as seconds) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { McpIqWiki } from "@iqai/adk"; | ||
|
|
||
| export const getIqWikiTools = async () => { | ||
| const toolset = McpIqWiki(); | ||
|
|
||
| const tools = await toolset.getTools(); | ||
|
|
||
| return tools; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { AgentBuilder, type SamplingHandler } from "@iqai/adk"; | ||
| import { model } from "../../env"; | ||
| import { getTelegramTools } from "./tools"; | ||
|
|
||
| export const createTelegramAgent = async (samplingHandler: SamplingHandler) => { | ||
| const tools = await getTelegramTools(samplingHandler); | ||
|
|
||
| return AgentBuilder.create("telegram_agent") | ||
| .withModel(model) | ||
| .withTools(...tools) | ||
| .build(); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { McpTelegram, type SamplingHandler } from "@iqai/adk"; | ||
| import { env } from "../../env"; | ||
|
|
||
| export const getTelegramTools = async (samplingHandler?: SamplingHandler) => { | ||
| const toolset = McpTelegram({ | ||
| samplingHandler, | ||
| env: { | ||
| TELEGRAM_BOT_TOKEN: env.TELEGRAM_BOT_TOKEN, | ||
| }, | ||
| }); | ||
|
|
||
| const tools = await toolset.getTools(); | ||
|
|
||
| return tools; | ||
| }; |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to pass sessionService if its just inMemorySession, agent builder by default passes it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to remove it 😞