Custom tools let you add capabilities beyond the built-in MeshAgent toolkits. ADocumentation Index
Fetch the complete documentation index at: https://docs.meshagent.com/llms.txt
Use this file to discover all available pages before exploring further.
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 Studio UI, MeshAgent CLI, and code
- Discover available tools in a Room
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 the ServiceHost can register 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:toolsroom as a temporary room service. In this example, the toolkit is exposed at the /math path with the name math-toolkit.
If you are running several local agents or tools, meshagent service run is the simplest way to test them in a room without packaging and deploying a full service first.
Step 3: Invoking a MeshAgent Tool
Invoking tools in MeshAgent Studio
- Go to studio.meshagent.com and login
- From the Sessions tab enter the
toolsroom - 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 service run, the toolkit is only available while that terminal session is still running.
Invoking tools from the MeshAgent CLI
While the service is running, from a new tab in your terminal invoke the tool. The result will print to the terminal.bash
Invoking tools from code
You can also call the tool directly from code. Run the Python or .NET example throughmeshagent room connect --room=toolsroom --identity=sample-participant -- <command> so MeshAgent injects the room connection environment automatically. For example: meshagent room connect --room=toolsroom --identity=sample-participant -- python3 tools-calling.py.
Discovering tools
At any time, you can use the MeshAgent CLI or connect to the room with aRoomClient to discover what tools are connected to a given room. This can be useful if you want to allow your users to grant additional capabilities to your agents at runtime or verify a tool is present in the room.
Discovering tools from the CLI
Discovering tools from code
Running this snippet lists the toolkits that are currently available in the room. Use the samemeshagent room connect --room=toolsroom --identity=sample-participant -- <command> pattern when you run it locally.
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.