Tin

Examples · anthropic · 49 of 339

research

An agent with tools Anthropic runs: web search, web fetch and code execution, plus an MCP server.

examples/anthropic/research.tintin run examples/anthropic/research.tin
// An agent with tools Anthropic runs: web search, web fetch and code execution, plus an MCP server.
// Needs ANTHROPIC_API_KEY (and CAL_TOKEN for the MCP server). `tin caps research.tin` shows what it may do:
// the model reaches the network (net) and runs code (code) through the API.

agent Researcher {
  model: "claude-haiku-4-5"
  system: "Answer with sources. Use code to check any number you compute."
  maxTokens: 8000
  serverTools: {
    webSearch: { maxUses: 3, blockedDomains: ["example.com"] }
    webFetch: { maxUses: 2, citations: true }
    codeExecution: {}
  }
  mcpServers: {
    calendar: { url: "https://mcp.example.com/sse", token: env("CAL_TOKEN"), tools: ["list_events"] }
  }
}

fn main() {
  // a long search may pause (stop_reason pause_turn); the agent loop continues it, in the same container
  print(Researcher("How many Tin programs are in the tin.ad gallery today? Check with code."))
}