Skip to content

Commit 7f0c945

Browse files
authored
quickstart now walks through setting up a uv project (#670)
* quicstart now walks through setting up a uv project * removed my hardcoded email from the output
1 parent da0ae54 commit 7f0c945

File tree

1 file changed

+39
-15
lines changed
  • app/en/get-started/quickstarts/call-tool-agent

1 file changed

+39
-15
lines changed

app/en/get-started/quickstarts/call-tool-agent/page.mdx

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,33 @@ Install and use the Arcade client to call Arcade Hosted Tools.
4040

4141
<Steps>
4242

43+
4344
### Install the Arcade client
4445

4546
<Tabs items={["Python", "TypeScript"]} storageKey="preferredLanguage">
4647

4748
<Tabs.Tab>
48-
In your terminal, run the following command to install the Python client package `arcadepy`:
49+
In your terminal, run the following command to create a new `uv` project:
4950

50-
```bash
51-
uv pip install arcadepy
52-
```
51+
```bash
52+
mkdir arcade-quickstart
53+
cd arcade-quickstart
54+
uv init
55+
```
56+
57+
Then, run the following command to create and activate a new virtual environment, isolating the project dependencies from your system:
58+
59+
60+
```bash
61+
uv venv
62+
source .venv/bin/activate
63+
```
64+
65+
Then, run the following command to install the Python client package `arcadepy`:
66+
67+
```bash
68+
uv add arcadepy
69+
```
5370

5471
</Tabs.Tab>
5572

@@ -70,9 +87,9 @@ bun install @arcadeai/arcadejs
7087

7188
<Tabs.Tab>
7289

73-
Create a new script called `example.py`:
90+
Open the `main.py` file and replace the content with the following:
7491

75-
```python filename="example.py"
92+
```python filename="main.py"
7693
from arcadepy import Arcade
7794

7895
# You can also set the `ARCADE_API_KEY` environment variable instead of passing it as a parameter.
@@ -114,7 +131,7 @@ This helper function will check if a tool requires authorization and if so, it w
114131

115132
<Tabs.Tab>
116133

117-
```python filename="example.py"
134+
```python filename="main.py"
118135
# Helper function to authorize and run any tool
119136
def authorize_and_run_tool(tool_name, input, user_id):
120137
# Start the authorization process
@@ -126,7 +143,7 @@ def authorize_and_run_tool(tool_name, input, user_id):
126143
# If the authorization is not completed, print the authorization URL and wait for the user to authorize the app.
127144
# Tools that do not require authorization will have the status "completed" already.
128145
if auth_response.status != "completed":
129-
print(f"Click this link to authorize {tool_name}: {auth_response.url}. The process will continue once you have authorized the app.")
146+
print(f"Click this link to authorize {tool_name}:\n{auth_response.url}.\nThe process will continue once you have authorized the app.")
130147
client.auth.wait_for_completion(auth_response.id)
131148

132149
# Run the tool
@@ -157,7 +174,7 @@ async function authorize_and_run_tool({
157174
// If the authorization is not completed, print the authorization URL and wait for the user to authorize the app. Tools that do not require authorization will have the status "completed" already.
158175
if (authResponse.status !== "completed") {
159176
console.log(
160-
`Click this link to authorize ${tool_name}: \`${authResponse.url}\`. The process will continue once you have authorized the app.`
177+
`Click this link to authorize ${tool_name}:\n${authResponse.url}.\nThe process will continue once you have authorized the app.`
161178
);
162179
// Wait for the user to authorize the app
163180
await client.auth.waitForCompletion(authResponse.id);
@@ -188,7 +205,7 @@ In this example workflow, we:
188205

189206
<Tabs.Tab>
190207

191-
```python filename="example.py"
208+
```python filename="main.py"
192209
# This tool does not require authorization, so it will return the results
193210
# without prompting the user to authorize the tool call.
194211
response_search = authorize_and_run_tool(
@@ -311,10 +328,11 @@ console.log(respose_send_email.output?.value);
311328
<Tabs.Tab>
312329

313330
```bash
314-
uv run example.py
331+
uv run main.py
315332
```
333+
316334
```text
317-
Success! Check your email at [email protected]
335+
Success! Check your email at {arcade_user_id}
318336
319337
You just chained 3 tools together:
320338
1. Searched Google News for stories about MCP URL mode elicitation
@@ -333,7 +351,7 @@ console.log(respose_send_email.output?.value);
333351
```
334352

335353
```text
336-
Success! Check your email at [email protected]
354+
Success! Check your email at {arcade_user_id}
337355
338356
You just chained 3 tools together:
339357
1. Searched Google News for stories about MCP URL mode elicitation
@@ -364,6 +382,8 @@ In this simple example, we call the tool methods directly. In your real applicat
364382

365383
<Tabs.Tab>
366384

385+
<details>
386+
<summary>**main.py** (full file)</summary>
367387
```python filename="example.py"
368388
from arcadepy import Arcade
369389

@@ -386,7 +406,7 @@ def authorize_and_run_tool(tool_name, input, user_id):
386406
# If the authorization is not completed, print the authorization URL and wait for the user to authorize the app.
387407
# Tools that do not require authorization will have the status "completed" already.
388408
if auth_response.status != "completed":
389-
print(f"Click this link to authorize {tool_name}: {auth_response.url}. The process will continue once you have authorized the app.")
409+
print(f"Click this link to authorize {tool_name}:\n{auth_response.url}.\nThe process will continue once you have authorized the app.")
390410
client.auth.wait_for_completion(auth_response.id)
391411

392412
# Run the tool
@@ -443,10 +463,13 @@ response_send_email = authorize_and_run_tool(
443463
print(f"Success! Check your email at {user_id}\n\nYou just chained 3 tools together:\n 1. Searched Google News for stories about MCP URL mode elicitation\n 2. Created a Google Doc with the results\n 3. Sent yourself an email with the document link\n\nEmail metadata:")
444464
print(response_send_email.output.value)
445465
```
466+
</details>
446467

447468
</Tabs.Tab>
448469
<Tabs.Tab>
449470

471+
<details>
472+
<summary>**example.ts** (full file)</summary>
450473
```typescript filename="example.ts"
451474
import Arcade from "@arcadeai/arcadejs";
452475

@@ -481,7 +504,7 @@ async function authorize_and_run_tool({
481504
// If the authorization is not completed, print the authorization URL and wait for the user to authorize the app. Tools that do not require authorization will have the status "completed" already.
482505
if (authResponse.status !== "completed") {
483506
console.log(
484-
`Click this link to authorize ${tool_name}: \`${authResponse.url}\`. The process will continue once you have authorized the app.`
507+
`Click this link to authorize ${tool_name}:\n${authResponse.url}.\nThe process will continue once you have authorized the app.`
485508
);
486509
// Wait for the user to authorize the app
487510
await client.auth.waitForCompletion(authResponse.id);
@@ -550,6 +573,7 @@ console.log(
550573
);
551574
console.log(respose_send_email.output?.value);
552575
```
576+
</details>
553577

554578
</Tabs.Tab>
555579
</Tabs>

0 commit comments

Comments
 (0)