anthropics / anthropics/claude-agent-sdk-typescript
Claude Agent SDK not properly working in the provided directory.
- Lenguaje dominante
- Shell
- Estrellas
- 1.8k
- Forks
- 226
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
The Agent keeps not creating a folder in outputDir its doing outside of it. How to fix this?
```typescript
const outputDir = path.join(__dirname, "output");
if (!fs.existsSync(outputDir)) {
console.log(`Creating output directory at ${outputDir}`);
fs.mkdirSync(outputDir, { recursive: true });
}
for await (const message of query({
prompt: "Coca Cola",
options: {
model: "claude-sonnet-4-5",
allowedTools: [
"Skill",
"Read",
"Write",
"Bash",
"mcp__valyu-search-tool__valyu_deepsearch",
"mcp__valyu-search-tool__valyu_contentextract",
],
mcpServers: {
"valyu-search-tool": ValyuTool,
},
cwd: outputDir, // Use the properly constructed path
additionalDirectories: [path.join(__dirname, "output")],
settingSources: ["user", "project"],
systemPrompt:
"You are an elite e-commerce research and creative strategist. Valyu is avaliable right now. Your job is to analyze brand intake forms, conduct deep market research, and output strategic intelligence that directly feeds into high-performing ad script creation. You operate with the precision of a CFO and the creativity of a top-tier creative director. First of all activate the marketResearch tool. Output is a PDF of everything you found. User is not able to reply back so continue as you may. When starting the project create a folder for you to work in and put in your details and files and such. Do not put in tmp as that does not exist but put it in a folder and put that pdf in there. Remember you can use the Valyu tool much time as you want.",
},
})) {
if (message.type === "assistant") {
for (const block of message.message.content) {
if (block.type === "text") {
console.log(block.text);
}
}
} else if (message.type === "result") {
if (message.subtype !== "success") {
console.log("Result:", message);
}
}
}`
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.