How to run adk-js in debug mode so that it stops on breakpoints? #47
-
|
I have tried running these commands in the debug mode:
But it doesn't stop on breakpoints in My IDE is Webstorm. The debug view in the Web-Mode is not enough to get the full context. How to make it stop on breakpoints? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
@kalenkevich any advice would be very appreciated 🙏 |
Beta Was this translation helpful? Give feedback.
-
|
Hello, Running the agent via To be able to debug your agent file you might need to do pretty much the same but manually:
const myTool = new FunctionTool({
name: 'my_tool',
description: 'Tool desc',
execute: () => {},
});
const rootAgent = new LlmAgent({
name: 'root_agent',
model: 'gemini-2.5-flash',
instruction: '...instructions',
tools: [myTool],
});
import {FunctionTool, InMemoryRunner, LlmAgent} from '@google/adk';
const myTool = new FunctionTool({
name: 'my_tool',
description: 'Tool desc',
execute: () => {},
});
const rootAgent = new LlmAgent({
name: 'root_agent',
model: 'gemini-2.5-flash',
instruction: '...instructions',
tools: [myTool],
});
async function main() {
const userId = 'test_user';
const appName = rootAgent.name;
const runner = new InMemoryRunner({agent: rootAgent, appName});
const session = await runner.sessionService.createSession({
appName,
userId,
});
for await (const e of runner.runAsync({
userId,
sessionId: session.id,
newMessage: createUserContent('My message'),
})) {
if (e.content?.parts?.[0]?.text) {
console.log(`${e.author}: ${JSON.stringify(e.content, null, 2)}`);
}
}
}
main().catch(console.error);
|
Beta Was this translation helpful? Give feedback.
-
|
@dnlrbz FYI we just release v0.4.0 where added support to debug agent files with adk cli run command: #113 |
Beta Was this translation helpful? Give feedback.
Hello,
Running the agent via
npx @google/adk-devtools run agent.tscommand do not support debug mode. This is a wrapper that starts node process with adk-devtools cli entry point which loads agent from given file and run it with the ADK runner instance.To be able to debug your agent file you might need to do pretty much the same but manually:
agent.ts, for example: