도구 사용 (Tool Use)
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const response = await client.messages.create({
model: "claude-sonnet-4-20250514",
tools: [{
name: "get_weather",
description: "현재 날씨를 조회합니다",
input_schema: {
type: "object",
properties: {
city: { type: "string", description: "도시 이름" }
},
required: ["city"]
}
}],
messages: [{ role: "user", content: "서울 날씨 알려줘" }]
});에이전트 루프
도구 호출 결과를 다시 전달하여 자율적 작업 수행이 가능합니다.
댓글 0