Huggingface.js documentation
@huggingface/tiny-agents
@huggingface/tiny-agents

Hugging Face์ Inference Client์ MCP ์คํ์ ๊ธฐ๋ฐ์ผ๋ก ๊ตฌ์ถ๋ ๊ฒฝ๋ํ ์กฐํฉ ๊ฐ๋ฅํ AI ์ ํ๋ฆฌ์ผ์ด์ ๊ทธ๋ฃน์ ๋๋ค.
์ค์น
npm install @huggingface/tiny-agents
# or
pnpm add @huggingface/tiny-agentsCLI ์ฌ์ฉ
npx @huggingface/tiny-agents [command] "agent/id"Usage:
tiny-agents [flags]
tiny-agents run "agent/id"
tiny-agents serve "agent/id"
Available Commands:
run Run the Agent in command-line
serve Run the Agent as an OpenAI-compatible HTTP serverHugging Face Hub์ tiny-agents Dataset์์ ์์ด์ ํธ๋ฅผ ์ง์ ๋ก๋ํ๊ฑฐ๋, ์์ฒด ๋ก์ปฌ ์์ด์ ํธ ๊ตฌ์ฑ ํ์ผ์ ๊ฒฝ๋ก๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
์ง์ ์์ด์ ํธ ์ ์ํ๊ธฐ
์์ฒด ์์ด์ ํธ๋ฅผ ๋ง๋๋ ๊ฐ์ฅ ๊ฐ๋จํ ๋ฐฉ๋ฒ์ agent.json ํ์ผ์ ํฌํจํ๋ ํด๋๋ฅผ ๋ง๋๋ ๊ฒ์
๋๋ค:
mkdir my-agent
touch my-agent/agent.json{
"model": "Qwen/Qwen2.5-72B-Instruct",
"provider": "novita",
"servers": [
{
"type": "stdio",
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
]
}๋๋ ๋ก์ปฌ ๋๋ ์๊ฒฉ ์๋ํฌ์ธํธ URL์ ์ฌ์ฉ:
{
"model": "Qwen/Qwen3-32B",
"endpointUrl": "http://localhost:1234/v1",
"servers": [
{
"type": "stdio",
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
]
}
servers๋ MCP ์๋ฒ ๋ชฉ๋ก์
๋๋ค(Stdio, SSE, HTTP ์๋ฒ๋ฅผ ์ง์ํฉ๋๋ค).
์ ํ์ ์ผ๋ก AGENTS.md(๋๋ PROMPT.md) ํ์ผ์ ์ถ๊ฐํ์ฌ ๊ธฐ๋ณธ Agent ํ๋กฌํํธ๋ฅผ ๋ฎ์ด์ธ ์ ์์ต๋๋ค.
๊ทธ๋ฐ ๋ค์ tiny-agents๋ฅผ ๋ก์ปฌ ํด๋๋ก ์ง์ ํ๋ฉด ๋ฉ๋๋ค:
npx @huggingface/tiny-agents run ./my-agent
Voilร ! ๐ฅ
Tiny Agents ์ปฌ๋ ์
https://huggingface.co/datasets/tiny-agents/tiny-agents์์ ํ๋ ์ด์
๋ Tiny Agents ์ปฌ๋ ์
์ ๋๋ฌ๋ณด์ธ์. ๊ฐ ์์ด์ ํธ๋ ์์์ ์ค๋ช
ํ ๊ตฌ์กฐ๋ฅผ ๋ฐ๋ฅด๋ฉฐ ์์ฒด ํ์ ๋๋ ํฐ๋ฆฌ์ ์ ์ฅ๋ฉ๋๋ค. Hub์์ ์์ด์ ํธ๋ฅผ ์คํํ๋ ๊ฒ์ ํด๋น agent_id๋ฅผ ์ฌ์ฉํ๋ ๊ฒ๋งํผ ๊ฐ๋จํฉ๋๋ค. ์๋ฅผ ๋ค์ด, julien-c/flux-schnell-generator ์์ด์ ํธ๋ฅผ ์คํํ๋ ค๋ฉด:
npx @huggingface/tiny-agents run "julien-c/flux-schnell-generator"์ปค๋ฎค๋ํฐ์ ์์ฒด ์์ด์ ํธ๋ฅผ ๊ณต์ ํ๊ณ ์ถ์ผ์ ๊ฐ์? Hub์ Tiny Agents ์ ์ฅ์์ PR์ ์ ์ถํ์ธ์. ์ ์ถ๋ฌผ์๋
agent.jsonํ์ผ์ด ํฌํจ๋์ด์ผ ํ๋ฉฐ, ์ ํ์ ์ผ๋กPROMPT.md๋๋AGENTS.mdํ์ผ์ ์ถ๊ฐํ ์ ์์ต๋๋ค. ๋ค๋ฅธ ์ฌ์ฉ์๊ฐ ์์ด์ ํธ์ ๊ธฐ๋ฅ์ ์ดํดํ ์ ์๋๋ก, ์ํ ํ๋กฌํํธ์ ์ฌ์ฉ ์ฌ๋ก๊ฐ ํฌํจ๋EXAMPLES.mdํ์ผ์ ํฌํจํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
๊ณ ๊ธ: ํ๋ก๊ทธ๋๋งคํฑ ์ฌ์ฉ
import { Agent } from '@huggingface/tiny-agents';
const HF_TOKEN = "hf_...";
// Create an Agent
const agent = new Agent({
provider: "auto",
model: "Qwen/Qwen2.5-72B-Instruct",
apiKey: HF_TOKEN,
servers: [
{
// Playwright MCP
command: "npx",
args: ["@playwright/mcp@latest"],
},
],
});
await agent.loadTools();
// Use the Agent
for await (const chunk of agent.run("What are the top 5 trending models on Hugging Face?")) {
if ("choices" in chunk) {
const delta = chunk.choices[0]?.delta;
if (delta.content) {
console.log(delta.content);
}
}
}๋ผ์ด์ ์ค
MIT
Update on GitHub