Built-in Tools
Korad.AI includes powerful tools that work with any model. Tools extend model capabilities with web search, code execution, browser automation, and image analysis.
Available Tools
Web Search
Search the web for current information using Brave Search API
tool_type = "computer_20241022"
tool_name = "web-search"
Capabilities:
- Real-time web search
- Current events and news
- Fact-checking
- Price comparisons
- Latest documentation
Cost: $0.01 per search
Parameters:
{
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The search query string"
},
"num_results": {
"type": "integer",
"description": "Number of results to return (1-20)",
"default": 10
}
},
"required": ["query"]
}
Example:
import anthropic
client = anthropic.Anthropic(
base_url="https://api.korad.ai/v1",
api_key="sk-korad-YOUR-KEY"
)
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
tools=[{
"type": "computer_20241022",
"name": "web-search",
"description": "Search the web for current information"
}],
messages=[{
"role": "user",
"content": "What's the latest news about quantum computing?"
}]
)
# Model will automatically call web-search tool
for block in response.content:
if block.type == "tool_use" and block.name == "web-search":
print(f"Search query: {block.input['query']}")
print(f"Results: {block.results}")
Web Fetch
Fetch and extract content from a specific URL
tool_type = "computer_20241022"
tool_name = "web-fetch"
Capabilities:
- Read specific webpages
- Extract article content
- Parse HTML
- Get page metadata
Cost: $0.02 per fetch
Parameters:
{
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "The URL to fetch content from"
},
"summarize": {
"type": "boolean",
"description": "Whether to provide a summary of the content",
"default": true
}
},
"required": ["url"]
}
Example:
response = client.messages.create(
model="gemini-2.5-pro",
max_tokens=1024,
tools=[{
"type": "computer_20241022",
"name": "web-fetch",
"description": "Fetch and extract content from a URL"
}],
messages=[{
"role": "user",
"content": "Summarize the content of https://www.anthropic.com/news"
}]
)
Code Sandbox
Execute Python code in an isolated sandbox environment
tool_type = "computer_20241022"
tool_name = "code-sandbox"
Capabilities:
- Execute Python code safely
- Return stdout/stderr
- Support for common libraries
- 30-second timeout
- Isolated environment
Cost: $0.10 per execution
Parameters:
{
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "The Python code to execute"
},
"timeout": {
"type": "integer",
"description": "Execution timeout in seconds",
"default": 30,
"minimum": 1,
"maximum": 120
}
},
"required": ["code"]
}
Example:
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
tools=[{
"type": "computer_20241022",
"name": "code-sandbox",
"description": "Execute Python code in an isolated sandbox"
}],
messages=[{
"role": "user",
"content": "Calculate the first 100 digits of pi using Monte Carlo method"
}]
)
# Model will write and execute Python code
for block in response.content:
if block.type == "tool_use" and block.name == "code-sandbox":
print(f"Code executed: {block.input['code']}")
print(f"Output: {block.result}")
Available Libraries:
- numpy, pandas, scipy
- requests, beautifulsoup4
- matplotlib, plotly
- sympy, networkx
- And more...
Browser Session
Automate browser interactions using Playwright
tool_type = "computer_20241022"
tool_name = "browser-session"
Capabilities:
- Headless browser automation
- Navigate dynamic websites
- Take screenshots
- Fill forms, click buttons
- Scrape JavaScript-rendered content
Cost: $0.05 per session
Parameters:
{
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "The starting URL to navigate to"
},
"actions": {
"type": "array",
"items": {"type": "string"},
"description": "List of actions to perform",
"default": []
},
"screenshot": {
"type": "boolean",
"description": "Whether to take a full-page screenshot at the end",
"default": false
}
},
"required": ["url"]
}
Example:
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
tools=[{
"type": "computer_20241022",
"name": "browser-session",
"description": "Automate browser interactions using Playwright"
}],
messages=[{
"role": "user",
"content": "Go to example.com and tell me the main heading"
}]
)
Image Analysis
Analyze an image using AI vision capabilities
tool_type = "computer_20241022"
tool_name = "image-analysis"
Capabilities:
- Analyze images from URLs
- Extract text from images (OCR)
- Describe visual content
- Identify objects and scenes
- Read charts and graphs
Cost: $0.02 per image
Parameters:
{
"type": "object",
"properties": {
"image_url": {
"type": "string",
"format": "uri",
"description": "URL of the image to analyze"
},
"prompt": {
"type": "string",
"description": "What to analyze or ask about the image",
"default": "Describe this image in detail."
}
},
"required": ["image_url"]
}
Example:
response = client.messages.create(
model="gemini-2.5-pro",
max_tokens=1024,
tools=[{
"type": "computer_20241022",
"name": "image-analysis",
"description": "Analyze an image using AI vision capabilities"
}],
messages=[{
"role": "user",
"content": "Analyze this chart: https://example.com/chart.png"
}]
)
Tool Use Patterns
Automatic Tool Calling
Models will automatically call tools when needed:
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
tools=[{
"type": "computer_20241022",
"name": "web-search",
"description": "Search the web"
}],
messages=[{
"role": "user",
"content": "Who won the Super Bowl?" # Triggers web-search
}]
)
# Model automatically calls web-search and returns results
Multiple Tools in One Request
response = client.messages.create(
model="gemini-2.5-pro",
max_tokens=1024,
tools=[
{
"type": "computer_20241022",
"name": "web-search",
"description": "Search the web"
},
{
"type": "computer_20241022",
"name": "code-sandbox",
"description": "Execute Python code"
},
{
"type": "computer_20241022",
"name": "web-fetch",
"description": "Fetch a webpage"
}
],
messages=[{
"role": "user",
"content": "Research the latest AI benchmarks and calculate improvements"
}]
)
Tool Result Handling
with client.messages.stream(
model="claude-sonnet-4-5",
max_tokens=1024,
tools=[{
"type": "computer_20241022",
"name": "web-search",
"description": "Search the web"
}],
messages=[{
"role": "user",
"content": "What's the weather in Tokyo?"
}]
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)
Tool Costs
| Tool | Cost | Best For |
|---|---|---|
| web-search | $0.01 | Current information, news |
| web-fetch | $0.02 | Reading specific pages |
| code-sandbox | $0.10 | Code execution, calculations |
| browser-session | $0.05 | Dynamic sites, automation |
| image-analysis | $0.02 | Visual content analysis |
Tool Limits
- Max concurrent tools: 5 per request
- Tool execution timeout: 30-120 seconds (tool-dependent)
- Rate limits: 100 tool calls/minute per API key
Error Handling
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
tools=[{
"type": "computer_20241022",
"name": "web-search",
"description": "Search the web"
}],
messages=[{
"role": "user",
"content": "Search for something"
}]
)
# Check for tool errors
for block in response.content:
if block.type == "tool_result":
if "error" in block.result:
print(f"Tool error: {block.result['error']}")
Best Practices
- Provide clear tool descriptions — Models use these to decide when to call tools
- Specify required parameters — Ensure tools have clear parameter schemas
- Handle tool errors gracefully — Check for errors in tool results
- Use appropriate tools — Match tool capabilities to your use case
- Monitor costs — Tool usage adds to per-request costs