Read-only Agent SDK starter using built-in file tools, a bounded agent loop, and streamed text output.
Uploaded markdown content, not a verification of tool compatibility or results. Review the raw text, commands, and permissions before using it. Stars require an account.
name: agent-sdk-starter
npm install @anthropic-ai/claude-agent-sdk
Configure SDK authentication through the environment as described in the [official quickstart](https://code.claude.com/docs/en/agent-sdk/quickstart). Save this as agent.mts and run it with npx tsx agent.mts after installing tsx. API usage may incur charges; do not hard-code credentials. The enabled tools are read-only.
import { query } from "@anthropic-ai/claude-agent-sdk";
for await (const message of query({
prompt: "Find how authentication works in this project. Do not modify files.",
options: {
model: "claude-sonnet-4-6",
tools: ["Read", "Glob", "Grep"],
allowedTools: ["Read", "Glob", "Grep"],
maxTurns: 6
}
})) {
if (message.type === "assistant") {
for (const block of message.message.content) {
if ("text" in block) console.log(block.text);
}
}
}