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.

fix(docs): update Claude Agent SDK TypeScript quickstart snippets

Sushmithamallesha521994663b4
diff --git a/docs/content/docs/quickstart.mdx b/docs/content/docs/quickstart.mdx
index 7e456d67d..059b98a87 100644
--- a/docs/content/docs/quickstart.mdx
+++ b/docs/content/docs/quickstart.mdx
@@ -417,9 +417,10 @@ What task would you like me to help you with?
I can use tools like Gmail, GitHub, Linear, Notion, and more.
(Type 'exit' to exit)
Example tasks:
- - 'Summarize my emails from today'
- - 'List all open issues on the composio github repository and create a Google Sheet with the issues'
+ - 'Summarize my emails from today'
+ - 'List all open issues on the composio github repository and create a Google Sheet with the issues'
`);
+
let isFirstQuery = true;
const options = {
mcpServers: { composio: customServer },
@@ -430,10 +431,10 @@ while (true) {
const input = (await readline.question("You: ")).trim();
if (input.toLowerCase() === "exit") break;
- process.stdout.write("Claude: ");
const queryOptions = isFirstQuery ? options : { ...options, continue: true };
isFirstQuery = false;
+ process.stdout.write("Claude: ");
for await (const stream of query({ prompt: input, options: queryOptions })) {
if (stream.type === "assistant") {
for (const block of stream.message.content) {
@@ -446,6 +447,8 @@ while (true) {
console.log();
}
+readline.close();
+
readline.close();
```
</Tab>
@@ -592,35 +595,26 @@ Example tasks:
let isFirstQuery = true;
-// Multi-turn conversation with agentic tool calling
while (true) {
- const answer = await readline.question('You: ');
- const input = answer.trim();
+ const input = (await readline.question("You: ")).trim();
if (input.toLowerCase() === "exit") break;
- process.stdout.write("Claude: ");
-
- // Use `continue: true` to maintain conversation context
const queryOptions = isFirstQuery ? options : { ...options, continue: true };
isFirstQuery = false;
- try {
- for await (const stream of query({ prompt: input, options: queryOptions })) {
- if (stream.type === "assistant") {
- const { content } = stream.message;
- for (const block of content) {
- if (block.type === "tool_use") {
- process.stdout.write(`\n[Using tool: ${block.name}]`);
- } else if (block.type === "text") {
- process.stdout.write(block.text);
- }
+ process.stdout.write("Claude: ");
+ for await (const stream of query({ prompt: input, options: queryOptions })) {
+ if (stream.type === "assistant") {
+ for (const block of stream.message.content) {
+ if (block.type === "tool_use") {
+ process.stdout.write(`\n [Using tool: ${block.name}]\n`);
+ } else if (block.type === "text") {
+ process.stdout.write(block.text);
}
}
}
- } catch (error) {
- console.error("\n[Error]:", error instanceof Error ? error.message : error);
}
- process.stdout.write("\n");
+ console.log();
}
readline.close();
diff --git a/docs/package.json b/docs/package.json
index 42d6d86aa..004fe89a5 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -39,7 +39,7 @@
"@anthropic-ai/claude-agent-sdk": "^0.2.5",
"@anthropic-ai/sdk": "^0.71.2",
"@composio/anthropic": "^0.5.5",
- "@composio/claude-agent-sdk": "^0.5.5",
+ "@composio/claude-agent-sdk": "^0.6.3",
"@composio/core": "^0.6.3",
"@composio/google": "^0.5.5",
"@composio/langchain": "^0.5.5",