Skip to main content
This guide shows how to integrate Seltz as a search tool for Claude models. When Claude needs to search for information, it will call your Seltz-powered function and use the results to generate informed responses.

Prerequisites

Installation

Setup

Set your API keys as environment variables:
Initialize both clients:

Define the Search Tool

Create a tool schema that describes the Seltz search function to Claude:

Using the Messages API

Here’s a complete example using Anthropic’s Messages API with Seltz search:

How It Works

  1. User sends a message - The user asks a question that may require search
  2. Claude decides to search - The model determines if it needs external information
  3. Tool use is returned - Claude returns a tool_use block with the search query
  4. Seltz executes search - Your code calls Seltz with the query
  5. Results sent back - Search results are sent as a tool_result
  6. Final response - Claude generates a response using the search results

Streaming Responses

Stream the final response for better user experience:

Multi-Turn Conversations

Maintain conversation history for follow-up questions:

Error Handling

Handle Seltz errors gracefully so Claude can respond appropriately:

Best Practices

Claude uses the description to decide when to use the tool. Be explicit about what information the search provides and when it should be used.
More results mean more tokens and higher costs. Use max_results to balance comprehensiveness with efficiency.
Return error information as JSON so Claude can inform the user or suggest alternatives.
Stream the final response so users see output immediately rather than waiting for the complete response.

Next Steps

OpenAI Tool Calling

Integrate with OpenAI models.

Agno Framework

Build autonomous agents with Seltz.