Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion crates/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ async function main() {
});

await withScope("demo-agent", ScopeType.Agent, async (handle) => {
event("initialized", handle, { binding: "node" }, null);
// `handle` describes the active scope; pass null to target the current scope.
Comment thread
zhongxuanwang-nv marked this conversation as resolved.
Outdated
event("initialized", null, { binding: "node" }, null);
});

deregisterSubscriber("printer");
Expand Down
11 changes: 6 additions & 5 deletions docs/getting-started/quick-start/nodejs.mdx
Comment thread
zhongxuanwang-nv marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const {
registerSubscriber,
deregisterSubscriber,
flushSubscribers,
LlmRequest,
withScope,
event,
toolCallExecute,
Expand All @@ -57,23 +56,25 @@ async function main() {
});

await withScope("demo-agent", ScopeType.Agent, async (handle) => {
event("initialized", handle, { binding: "node" }, null);
// `handle` describes the active scope (handle.uuid, handle.name, handle.scopeType).
// For lifecycle calls inside the scope, pass null to target the current scope.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
event("initialized", null, { binding: "node" }, null);

const toolResult = await toolCallExecute(
"search",
{ query: "hello" },
(args) => ({ echo: args.query }),
handle,
null,
null,
null,
null,
);

const llmResult = await llmCallExecute(
"demo-provider",
new LlmRequest({}, { messages: [{ role: "user", content: "hi" }] }),
{ headers: {}, content: { messages: [{ role: "user", content: "hi" }] } },
(request) => ({ ok: true, messages: request.content.messages }),
handle,
null,
null,
null,
null,
Expand Down