Skip to content

feat: add provider-native hosted tool support#1430

Merged
joshua-mo-143 merged 4 commits into0xPlaygrounds:mainfrom
bnomei:codex/feature/provider-native-hosted-tools
Mar 13, 2026
Merged

feat: add provider-native hosted tool support#1430
joshua-mo-143 merged 4 commits into0xPlaygrounds:mainfrom
bnomei:codex/feature/provider-native-hosted-tools

Conversation

@bnomei
Copy link
Contributor

@bnomei bnomei commented Feb 24, 2026

Relates #1053

Summary

This PR adds provider-native hosted tool support to Rig’s completion request flow, with first-class support in OpenAI Responses API and compatible forwarding in other providers.

The issue was that hosted tools (for example web_search, file_search, computer_use) could not be expressed through existing function-only tool plumbing in responses_api.

Scope

This PR is intentionally focused on one facet: tool definition/request serialization for hosted/provider-native tools in completion flows.

It does not change agent loop behavior, tool execution semantics, or unrelated provider APIs.

It is also not complete due to me being new to the projects source code but I hope it will help to accelerate adding this feature.

Implementation

1) Provider-agnostic request surface (completion/request.rs)

  • Added ProviderToolDefinition:
    • type/kind field
    • provider-specific config payload
  • Added builder ergonomics:
    • CompletionRequest::with_provider_tool(...)
    • CompletionRequest::with_provider_tools(...)
    • CompletionRequestBuilder::provider_tool(...)
    • CompletionRequestBuilder::provider_tools(...)
  • Added merge logic to place provider-native tools in additional_params.tools.

2) OpenAI Responses API hosted tools (providers/openai/responses_api/mod.rs)

  • Expanded ResponsesToolDefinition to represent both:
    • function tools
    • hosted tools (web_search, file_search, computer_use, plus generic hosted type)
  • Added helper constructors:
    • ResponsesToolDefinition::function(...)
    • ResponsesToolDefinition::hosted(...)
    • ResponsesToolDefinition::web_search()
    • ResponsesToolDefinition::file_search()
    • ResponsesToolDefinition::computer_use()
  • Updated request conversion to merge:
    • function tools from req.tools
    • provider-native tools from additional_params.tools
  • Added model/request-level tool convenience:
    • CompletionRequest::with_tool(s)
    • ResponsesCompletionModel::with_tool(s)

3) Provider forwarding support (same abstraction path)

  • xai, gemini, anthropic (completion + streaming): now extract additional_params.tools and merge with function tools.
  • groq: maps provider-native tools into Groq’s

Copy link
Collaborator

@joshua-mo-143 joshua-mo-143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks mostly good. please see comment

@joshua-mo-143
Copy link
Collaborator

Manually resolving/merging this in now as I think this'll be useful but don't want to abandon the original PR 🙂

…r-native-hosted-tools

Made-with: Cursor

# Conflicts:
#	rig/rig-core/src/providers/gemini/completion.rs
@ChronosWS
Copy link

Definitely would like to see this - web_search in particular is pretty important for a well-rounded client capable of research.

@joshua-mo-143 joshua-mo-143 added this pull request to the merge queue Mar 13, 2026
Merged via the queue into 0xPlaygrounds:main with commit d70c050 Mar 13, 2026
6 checks passed
@github-actions github-actions bot mentioned this pull request Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants