Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Update the example
haxzie committed
May 16, 2025 at 15:42 UTC
df2489d9f39e31f7f1b520c9da6bde68e3cc7c33
1 file changed
+4
examples/langchain/src/index.ts
+4
@@ -11,6 +11,7 @@ const composio = new Composio({
11
});
12
13
// fetch the tool
14
+console.log(`🔄 Fetching the tool...`);
15
const tool = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
16
17
// Define the tools for the agent to use
@@ -37,6 +38,7 @@ function shouldContinue({ messages }: typeof MessagesAnnotation.State) {
38
39
// Define the function that calls the model
40
async function callModel(state: typeof MessagesAnnotation.State) {
41
+ console.log(`🔄 Calling the model...`);
42
const response = await model.invoke(state.messages);
43
44
// We return a list, because this will get added to the existing list
@@ -58,6 +60,7 @@ const app = workflow.compile();
60
const finalState = await app.invoke({
61
messages: [new HumanMessage('Find the details of the user `pg` on HackerNews')],
62
});
63
+console.log(`✅ Message recieved from the model`);
64
console.log(finalState.messages[finalState.messages.length - 1].content);
65
66
const nextState = await app.invoke({
@@ -65,4 +68,5 @@ const nextState = await app.invoke({
68
// This way it knows we're asking about the weather in NY
69
messages: [...finalState.messages, new HumanMessage('what about haxzie')],
70
});
71
+console.log(`✅ Message recieved from the model`);
72
console.log(nextState.messages[nextState.messages.length - 1].content);