Skip to content

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

haxziedf2489d9f39e
diff --git a/examples/langchain/src/index.ts b/examples/langchain/src/index.ts
index c7c84f50e..5093a63fc 100644
--- a/examples/langchain/src/index.ts
+++ b/examples/langchain/src/index.ts
@@ -11,6 +11,7 @@ const composio = new Composio({
});
// fetch the tool
+console.log(`πŸ”„ Fetching the tool...`);
const tool = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
// Define the tools for the agent to use
@@ -37,6 +38,7 @@ function shouldContinue({ messages }: typeof MessagesAnnotation.State) {
// Define the function that calls the model
async function callModel(state: typeof MessagesAnnotation.State) {
+ console.log(`πŸ”„ Calling the model...`);
const response = await model.invoke(state.messages);
// We return a list, because this will get added to the existing list
@@ -58,6 +60,7 @@ const app = workflow.compile();
const finalState = await app.invoke({
messages: [new HumanMessage('Find the details of the user `pg` on HackerNews')],
});
+console.log(`βœ… Message recieved from the model`);
console.log(finalState.messages[finalState.messages.length - 1].content);
const nextState = await app.invoke({
@@ -65,4 +68,5 @@ const nextState = await app.invoke({
// This way it knows we're asking about the weather in NY
messages: [...finalState.messages, new HumanMessage('what about haxzie')],
});
+console.log(`βœ… Message recieved from the model`);
console.log(nextState.messages[nextState.messages.length - 1].content);