Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions google-adk-agents/src/agent-chat/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { offlineModelProvider } from './offline-model';
async function run() {
const connection = await NativeConnection.connect({ address: 'localhost:7233' });
try {
// @@@SNIPSTART typescript-google-adk-agent-chat-worker
const worker = await Worker.create({
connection,
taskQueue: 'google-adk-agent-chat',
Expand All @@ -14,6 +15,7 @@ async function run() {
],
});
await worker.run();
// @@@SNIPEND
} finally {
await connection.close();
}
Expand Down
2 changes: 2 additions & 0 deletions google-adk-agents/src/agent-chat/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ export async function agentChat(messages: Message[] = [], turns = 0, runs = 1, t
let processing = 0;
let nextUpdate = 0;
let currentUpdate = 0;
// @@@SNIPSTART typescript-google-adk-agent-chat-workflow
const agent = new LlmAgent({
name: 'assistant',
model: new TemporalModel('gemini-2.5-flash'),
instruction: 'Continue the conversation using its prior context. Respond in one sentence.',
});
const runner = new InMemoryRunner({ agent, appName: 'agent-chat' });
// @@@SNIPEND
const sessionId = `run-${runs}`;
await runner.sessionService.createSession({ appName: runner.appName, userId: 'user', sessionId });
setHandler(getChatState, () => ({ messages, turns, runs }));
Expand Down