Arcade Quickstart
This guide will walk you through the process of getting started with Arcade.dev. First, we will go over Direct Tool Calling, a simple way to call tools directly from your agent.
Direct tool calling is useful in situations where you already know what tool is needed or when there is no prompt for an LLM to interpret and decide on the tool calling. It also gives you full control over what is executed by the Arcade Engine and how.
Prerequisites
- Create an Arcade account
- Get an Arcade API key and take note, you’ll need it in the next steps.
Install the Arcade client
pip install arcadepy
Instantiate and use the client
Create a new script called example.py
:
from arcadepy import Arcade
# You can also set the `ARCADE_API_KEY` environment variable instead of passing it as a parameter.
client = Arcade(api_key="arcade_api_key")
# Arcade needs a unique identifier for your application user (this could be an email address, a UUID, etc).
# In this example, simply use your email address as the user ID:
user_id = "user@example.com"
# Let's use the `Math.Sqrt` tool from the Arcade Math toolkit to get the square root of a number.
response = client.tools.execute(
tool_name="Math.Sqrt",
input={"a": '625'},
user_id=user_id,
)
print(f"The square root of 625 is {response.output.value}")
# Now, let's use a tool that requires authentication to star a GitHub repository
auth_response = client.tools.authorize(
tool_name="GitHub.SetStarred",
user_id=user_id,
)
if auth_response.status != "completed":
print(f"Click this link to authorize: `{auth_response.url}`. The process will continue once you have authorized the app." )
# Wait for the user to authorize the app
client.auth.wait_for_completion(auth_response.id);
response = client.tools.execute(
tool_name="GitHub.SetStarred",
input={
"owner": "ArcadeAI",
"name": "arcade-ai",
"starred": True,
},
user_id=user_id,
)
print(response.output.value)
Run the code
python3 example.py
> The square root of 625 is 25
> Successfully starred the repository ArcadeAI/arcade-ai
Next Steps
In this simple example, we call the tool methods directly. In your real applications and agents, you’ll likely be letting the LLM decide which tools to call - lean more about using Arcade with Frameworks in the Frameworks section, or how to build your own tools.