Toolkit groups related Tools together so they can be registered in a room and used by people or agents.
In this guide you’ll:
- Write custom tools
- Create a toolkit to group your related tools
- Register a toolkit in a room
- Invoke tools using the MeshAgent CLI, MeshAgent Studio UI, and code
- Give a process agent access to the toolkit
- Let a process agent dynamically discover annotated room toolkits
Creating a custom toolkit
Step 1: Writing custom tools
Let’s create a simple toolkit with two tools, one that can add two numbers, and one that can subtract two numbers. First write the logic for theadd and subtract tools. Then bundle them into a Toolkit that a SingleRoomAgent can expose for room calls.
Save this example as tools-adder.py:
Step 2: Register the toolkit in a room
Create the room and start the toolkit locally. This guide usesgettingstarted, the same room created in the CLI quickstart, so you can reuse a room you already own.
math-toolkit toolkit into gettingstarted.
The toolkit is available while that terminal session is still running. SingleRoomAgent.run() creates the room connection, starts the agent, and unregisters the exposed toolkit when the process stops.
Step 3: Invoke and inspect the toolkit
Invoking tools programmatically
While the agent is running, invoke the toolkit from another terminal or from code. Run the Python and .NET examples throughmeshagent room connect so MeshAgent injects the room connection environment. The Python tab can be saved as tools-calling.py and run directly. For .NET, add the C# tab to a .NET project that references Meshagent.Api, then run the project through meshagent room connect.
Inspecting available toolkits
You can also verify which toolkits are registered in the room. Run the Python and .NET discovery examples through the samemeshagent room connect pattern.
math-toolkit, its add and subtract tools, and this annotation:
Invoking tools in MeshAgent Studio
- Go to studio.meshagent.com and login
- From the Sessions tab enter
gettingstarted - From the menu in the upper left, click Toolkits
- Find the tool you want to run and click Invoke
- Enter any required values and click Ok
meshagent room connect, the toolkit is only available while that terminal session is still running.
Step 4: Give a process agent access to the toolkit
There are two common ways to make a room toolkit available to a process agent.Option A: Require the toolkit by name
Use--require-toolkit when the agent should always have access to a specific room toolkit. This is the simpler path when you already know which toolkit the agent should use.
Leave the terminal running meshagent room connect --room=gettingstarted --identity=math-tools -- python3 tools-adder.py; that process is hosting math-toolkit in the room. In a second terminal, start a chat agent that requires math-toolkit:
bash
Option B: Let the agent discover annotated room toolkits
Use--tool-search room when the agent should be able to dynamically discover annotated toolkits that are already present in the room. This is useful when you do not want to configure every toolkit directly on the agent.
This option uses OpenAI Responses tool search behind the scenes, so it only applies to OpenAI-backed process-agent models.
The sample toolkit sets the meshagent.tool_search annotation. Start a chat agent with room tool search enabled:
bash
--tool-search room adds annotated room toolkits to the model’s tool-search candidate set. In the process-agent logs, math-toolkit should appear as a deferred toolkit available to the model.
Next Steps
If you want the toolkit to stay available after your local terminal session ends, package and deploy it as a MeshAgent service.- Dynamic UI Tools: Learn what Dynamic UI tools are and how to build and use them in your applications
- Learn how to use custom tools inside a Process Agent or Voice Agent
- Service YAML: write service manifests for agents and tools.