Package ai.acolite.agentsdk.core
Class HostedTool
java.lang.Object
ai.acolite.agentsdk.core.HostedTool
HostedTool
Represents tools that execute on OpenAI's hosted infrastructure rather than in your application. These tools are provided and maintained by OpenAI.
Currently supported hosted tools:
- web_search - Search the web for current information
- image_generation - Generate images using DALL-E
Note: Other OpenAI hosted tools like file_search, code_interpreter, and
computer_use are not yet supported by this SDK. Attempting to use them will throw an
UnsupportedOperationException.
Unlike FunctionTool, hosted tools execute remotely on OpenAI's servers. You configure
them but do not implement their execution logic.
Example usage:
// Web search
Agent<Object, TextOutput> agent = Agent.builder()
.instructions("You can search the web for current information.")
.tools(List.of(HostedTool.webSearch()))
.build();
// Image generation
Agent<Object, TextOutput> agent = Agent.builder()
.instructions("You can generate images using DALL-E.")
.tools(List.of(HostedTool.imageGeneration()))
.build();
// Multiple hosted tools
Agent<Object, TextOutput> agent = Agent.builder()
.tools(List.of(
HostedTool.webSearch(),
HostedTool.imageGeneration()
))
.build();
Source: openai-agents-js/tool.ts
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HostedToolDeprecated.code_interpreter is not yet supported by this SDKstatic HostedToolfileSearch(String vectorStoreId) Deprecated.file_search is not yet supported by this SDKstatic HostedToolCreate an image generation hosted tool.static HostedToolCreate a web search hosted tool.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.acolite.agentsdk.core.Tool
getDescription, getName, getType
-
Constructor Details
-
HostedTool
public HostedTool()
-
-
Method Details
-
webSearch
Create a web search hosted tool.- Returns:
- HostedTool configured for web search
-
fileSearch
Deprecated.file_search is not yet supported by this SDKCreate a file search hosted tool.- Parameters:
vectorStoreId- OpenAI vector store ID to search- Returns:
- HostedTool configured for file search
- Throws:
UnsupportedOperationException- file_search is not yet supported by this SDK
-
codeInterpreter
Deprecated.code_interpreter is not yet supported by this SDKCreate a code interpreter hosted tool.- Returns:
- HostedTool configured for code interpreter
- Throws:
UnsupportedOperationException- code_interpreter is not yet supported by this SDK
-
imageGeneration
Create an image generation hosted tool.- Returns:
- HostedTool configured for image generation
-