Agentic Search Tool
Tackle complex research questions with AI-guided iterative searching
The Agentic Search tool uses AI to guide multi-step vector searches, refining queries and filters iteratively until finding the most comprehensive and relevant results for complex questions.
What It Is
Unlike the simpler File Search tool, the Agentic Search tool employs AI to break down complex questions, perform multiple search iterations, and intelligently refine queries until it finds the most relevant and complete information. It excels at research-oriented tasks requiring deep exploration.
NOTE for better results, we recommend using top models from https://huggingface.co/spaces/lmarena-ai/chatbot-arena-leaderboard
Query: “JWT authentication security implications”
Query: “JWT token validation best practices”
Query: “JWT validation implementation examples”
The search process revealed that JWT security implications include token hijacking, weak signature algorithms, and sensitive data exposure. Proper implementation requires validating the signature with a secure algorithm (at least HS256), checking expiration claims, validating issuer and audience claims, and implementing proper key rotation practices…
How Agentic Search Works
Configuration
Basic configuration requires a query parameter and vector store IDs:
Configuration Parameters
The Agentic Search tool is designed to work well with default settings for most use cases. Start with minimal configuration and only adjust parameters if you need to fine-tune the behavior for specific scenarios.
Response Format
The Agentic Search tool returns a comprehensive response including:
When to Use It
The Agentic Search tool is designed for complex research scenarios requiring deep exploration across multiple documents.
Use Cases for Agentic Search
For simpler, direct queries where immediate results are needed, consider using the File Search Tool instead.
Example Queries
Multi-faceted Research
Comparative Analysis
Technical Strategy
Complex Problem-Solving
Advanced Tuning
Seed Strategy Options
The seed_strategy
parameter determines how initial search queries are generated:
“hybrid” (default)
Combines vector and keyword search approaches for balanced results. Best for general-purpose searching across diverse document collections.
”topk”
Uses top-K retrieval, focusing on the most similar documents by vector similarity. Better for specialized document collections with consistent terminology.
Alpha Parameter Tuning
The alpha
parameter (0.0-1.0) balances vector search vs. keyword search weights:
- Higher values (0.7-0.9): More weight to vector semantic search, better for conceptual questions
- Middle values (0.4-0.6): Balanced approach, good for most questions
- Lower values (0.1-0.3): More weight to keyword search, better for specific technical terms
If a reranker is enabled in the system configuration, the provided alpha value is ignored and a fixed value of 0.5 is used for pre-reranking result selection only.
Initial Seed Multiplier
This parameter controls how many initial search seeds are generated:
Dynamic Parameter Tuning
The following parameters enable dynamic adjustment of the underlying model’s parameters based on search results:
Enable Presence/Frequency Penalty Tuning
Enable Presence/Frequency Penalty Tuning
Controls automatic tuning of penalties to avoid repetitive content and encourage diversity in search iterations.
- enable_presence_penalty_tuning: Dynamically adjusts presence penalty
- enable_frequency_penalty_tuning: Dynamically adjusts frequency penalty
Enable these options if you notice search iterations getting stuck in repetitive patterns.
Enable Temperature/Top-P Tuning
Enable Temperature/Top-P Tuning
Controls automatic tuning of sampling parameters to balance creativity and precision.
- enable_temperature_tuning: Dynamically adjusts temperature
- enable_top_p_tuning: Dynamically adjusts top-p sampling
Enable these options for exploratory research where creativity in query refinement is beneficial.
Dynamic parameter tuning options are disabled by default for maximum compatibility with model providers. Enable them only if your model supports these parameters.
Integration Examples
Tool Usage with OpenAI Models
The agentic_search tool automatically performs multiple search iterations and provides the results to the AI model in the same request. This creates an advanced RAG experience where the model can access comprehensive research without additional API calls.
GitHub Example Implementation
For a complete working example of the Agentic Search tool, check out this Python example on GitHub. This example demonstrates:
- Setting up the RAG system with sample documents
- Creating and configuring the AgenticSearchTool
- Performing searches with different strategies and parameters
- Comparing results from different search approaches
- Integration with the OpenAI Agents SDK
Configuring Research Depth
For research tasks requiring different levels of depth, you can adjust the configuration:
Best Practices
Ask Specific Queries
Ask Specific Queries
While the Agentic Search tool excels at complex queries, questions should still be specific and focused.
Good Example:
Less Effective:
Provide Context When Relevant
Provide Context When Relevant
Include relevant context in your query to help guide the search process.
Good Example:
Less Effective:
Monitor and Adjust Iterations
Monitor and Adjust Iterations
For critical research queries, monitor the search iterations and adjust parameters if needed.
- If iterations seem unfocused, consider reducing
initial_seed_multiplier
- If iterations aren’t exploring enough aspects, try increasing
max_iterations
- If results are too literal, increase
alpha
for more semantic search weight
Related Tools
Think Tool
For logging thoughts and reasoning processes
File Search Tool
For direct vector store searches
When to Choose Agentic Search vs. File Search
The Agentic Search tool shines for complex, multi-faceted queries requiring deep exploration, while File Search is better for direct, factual queries when you know exactly what you’re looking for.
- Use Agentic Search when: You need comprehensive research on complex topics, comparative analysis, or multi-step problem solving.
- Use File Search when: You need quick answers to specific questions, looking up known information, or when resource constraints are a concern.