Call tools directly
In this guide, you'll learn how to call tools programmatically using Arcade AI.
Unlike calling tools with LLMs, calling tools directly doesn't use an AI model to decide which tool to call and what arguments to pass. Instead, you specify the tool and its arguments in code.
You still get the benefits of Arcade AI managing authorization and tool execution, but you have more control over when and how the tool is called. This is useful in apps and AI agents where the workflows are more complex than a single LLM call.
Prerequisites
Set environment variables
export ARCADE_API_KEY=<your-api-key>
You can find your API key in ~/.arcade/credentials.yaml
.
Initialize the client
Import the Arcade()
client in a Python script. The client automatically uses the ARCADE_API_KEY
environment variable.
from arcadepy import Arcade
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
Call a tool
Let's use the SetStarred
tool from the Arcade GitHub toolkit to star a repo.
result = client.tools.execute(
user_id="[email protected]",
tool_name="GitHub.SetStarred",
inputs={"owner": "ArcadeAI", "name": "arcade-ai", "starred": True},
)
print(result)