Claude Platform 101
← सभी पाठ
पाठ 07Claude Platform 101

Server tools: आपके द्वारा घोषित, Anthropic द्वारा चलाए गए

सारांश ऑडियो

बोला गया सारांश — साथ पढ़ने के लिए प्ले दबाएँ: बोली जा रही पंक्ति ऊपर रहती है।

अध्ययन नोट्स

आप अपने स्वयं के कस्टम tools बना सकते हैं, लेकिन कुछ capabilities काफी सामान्य हैं कि Anthropic उन्हें पहले से बनाकर भेजता है। आप कोड नहीं लिखते। आप sandbox को host नहीं करते। आप बस tool को घोषित करते हैं, और Anthropic इसे चलाता है।

Server tools: आपके द्वारा घोषित, Anthropic द्वारा चलाए गए

Anthropic server tools प्रदान करता है जो उनके infrastructure पर चलते हैं। आप इन्हें execute नहीं करते — Anthropic करता है। इसका मतलब है कि आपको इन calls के लिए agent loop की जरूरत नहीं है। Claude tools को अपने आप call करता है, और result उसी response के अंदर वापस आता है।

मुख्य ones हैं:

  • Web search — internet को search करता है और citations के साथ results return करता है
  • Code execution — Python को एक sandbox में लिखता और चलाता है
  • Web fetch — URLs से पूरी content retrieve करता है

एक फ़ाइल में दो server tools

आइए एक फ़ाइल में कुछ बड़े ones को देखें: दो messages. create calls, एक web search के साथ और एक code execution के साथ।

import anthropic

client = anthropic. Anthropic()

search_response = client. messages. create( model="claude-opus-4-8", max_tokens=1024, tools=[{"type": "web_search_20260209", "name": "web_search"}], messages=[ {"role": "user", "content": "Anthropic का latest model release क्या है? एक वाक्य में उत्तर दें।"} ], )

for block in search_response. content: if block. type == "server_tool_use": print(f"Tool call: {block. name} — {block. input}") elif block. type == "text": print(block. text)

code_response = client. messages. create( model="claude-opus-4-8", max_tokens=1024, tools=[{"type": "code_execution_20260120", "name": "code_execution"}], messages=[ {"role": "user", "content": "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] का mean और standard deviation calculate करें"} ], )

for block in code_response. content: if block. type == "server_tool_use": print(f"Tool call: {block. name} — {block. input}") elif block. type == "bash_code_execution_tool_result": print(f"stdout: {block. content. stdout}") elif block. type == "text": print(block. text)

ध्यान देने योग्य दो बातें:

  • यहाँ कोई agent loop नहीं है। हम stop_reason पर switch नहीं करते। हम tool results को वापस push नहीं करते। Anthropic tool को server-side पर चलाता है, और response में पहले से ही result होता है।
  • Response में नए block types हैं। Tool call के लिए एक server_tool_use block, code execution tool result के लिए एक output block, साथ ही regular text blocks।

इसे चलाना

Web search के लिए, आप Claude के tool call को printed देखेंगे, फिर latest model release के बारे में एक वाक्य का उत्तर search citations के साथ।

Code execution के लिए, आप Claude द्वारा लिखा गया actual Python देखेंगे, sandbox से stdout, और एक final text answer।

हमें search crawler को spin up नहीं करना पड़ा। हमने Python sandbox को run नहीं किया। हमने दो tools को घोषित किया और दोनों को free में पाया।

दूसरी category: client tools

यह जानना काबिल-ए-ग़ौर है कि दूसरी category भी मौजूद है। Client tools वहाँ चलते हैं जहाँ आपका कोड चलता है। वे Claude SDK में shipped होते हैं, इसलिए आपको schema को खुद define नहीं करना पड़ता। दो उदाहरण:

  • Memory — Claude sessions के across memory को read और write करता है
  • Bash — एक persistent bash shell ताकि Claude commands को execute कर सके

Anthropic docs table of built-in tools, memory और bash को client tools के रूप में listed किया गया है server tools जैसे web fetch और code execution के साथ

उनका shape एक custom tool जैसा ही है, लेकिन SDK आपको schema और एक sensible runner देता है।

यह production में क्यों मायने रखता है

एक production app में, यह उन features के लिए सबसे छोटा रास्ता है जो अन्यथा हफ्तों लगते। Web search एक fact-check endpoint को power कर सकता है जो एक draft में हर numeric और regulatory claim को live web के विरुद्ध verify करता है।

एक proposal review app जो web search का उपयोग करके एक draft proposal में regulatory और numeric claims को fact-check करता है

एक reminder, हालांकि: सिर्फ इसलिए कि कुछ internet पर validated है इसका मतलब यह नहीं है कि यह सच है। हमेशा Claude के काम को double-check करें।

Recap

  • Server tools — web search, code execution, web fetch — आपके tools array में घोषित किए जाते हैं। Anthropic उन्हें चलाता है।
  • आप result को उसी response में पाते हैं, कोई agent loop required नहीं। server_tool_use और tool result blocks को regular text blocks के साथ देखें।
  • Client tools जैसे memory और bash वहाँ चलते हैं जहाँ आपका कोड चलता है, लेकिन SDK आपको schema और एक runner देता है।
  • "Anthropic द्वारा hosted" का विचार पूरे तरह scale होता है: managed agents इसे पूरे agent पर लागू करते हैं, सिर्फ एक tool पर नहीं।
फ्लैशकार्ड 7 कार्ड
प्रश्न
प्रकट करने के लिए क्लिक करें · ←/→
उत्तर
वापस पलटने के लिए क्लिक करें
ज्ञान जाँच 6 प्रश्न