Skip to main content
Dynamic tool discovery lets an OpenAI-backed meshagent process agent use OpenAI Responses tool search to choose from toolkits that MeshAgent makes available for a turn. Use this when an agent should not load every possible tool directly into every model request. Tool search gives the model a searchable set of candidate tools and lets it pull in the ones that match the user’s request. --require-toolkit attaches a known toolkit by name. Use it when the agent should always have a specific toolkit available. --tool-search changes how available toolkits are exposed to OpenAI Responses models. It does not create or start a toolkit by itself. The toolkit must already come from the agent’s configured capabilities or from the room. --tool-search supports two modes: --tool-search is only supported for OpenAI Responses models. Use a model such as gpt-5.5. OpenAI’s tool-search guidance makes the same distinction: use tool search over known candidate tools when the candidates are already available at request time, and use client-executed discovery when lookup depends on project, tenant, or other application state.

Start the example toolkit

The examples below use the custom tools quickstart’s tools-adder.py sample. It exposes math-toolkit from a room-connected SingleRoomAgent.
The annotation is the part that makes this room toolkit eligible for dynamic room discovery:
Python
Start the toolkit and leave this terminal running:
bash

Search the agent’s configured tools

Use --tool-search agent when the process agent already has a configured set of toolkits and you want OpenAI Responses tool search to choose from that configured set. This is most useful for larger configured agents; for a single small toolkit, --require-toolkit by itself is simpler. In a second terminal, require math-toolkit by name, then expose the configured toolkit through tool search:
bash
Open the Studio link printed by the command and ask:
math-toolkit is still required by name. Tool search controls how the OpenAI Responses model sees and selects tools from the agent’s configured toolkits.

Search annotated room toolkits

Use --tool-search room when the agent should be able to discover eligible toolkits that are already registered in the room. With the annotated math-toolkit still running, start a process agent with room tool search:
bash
Open the Studio link printed by the command and ask:
--tool-search room includes annotated room toolkits in the model’s search set. The agent does not need --require-toolkit math-toolkit because the toolkit is discovered from the room.

Make a room toolkit discoverable

Room tool search only includes toolkits that opt in with the meshagent.tool_search annotation. If the toolkit does not set the annotation, --tool-search room leaves it out even if the toolkit is visible in the room. Then verify the room sees the annotation:
bash
The output should include:

Troubleshooting

If the agent does not find a room toolkit:
  • Check that the toolkit process is still running.
  • Run meshagent room agents list-toolkits --room=<room> and confirm the toolkit is visible.
  • Confirm the toolkit has "meshagent.tool_search": "true" in its annotations.
  • Use --tool-search room, not --tool-search agent, when you want annotated room toolkits included.
  • Use an OpenAI Responses model. --tool-search is not supported by non-OpenAI process-agent models.
  • Do not use --tool-search with --no-room; room tool search needs a room connection.

Next Steps