You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
userId: "<YOUR_USER_ID>", // Your app's internal ID for the user (an email, UUID, etc). It's used internally to identify your user in Arcade
93
96
executeFactory: executeOrAuthorizeZodTool, // Checks if tool is authorized and executes it, or returns authorization URL if needed
@@ -104,13 +107,19 @@ import { Agent } from "@mastra/core/agent";
104
107
import { anthropic } from"@ai-sdk/anthropic";
105
108
106
109
// Create the Mastra agent with Arcade tools
107
-
exportconst googleAgent =newAgent({
108
-
name: "googleAgent",
109
-
instructions: `You are a Google assistant that helps users manage their Google services (Gmail, Calendar, Sheets, Drive, and Contacts).
110
-
If a tool requires authorization, you will receive an authorization URL.
111
-
When that happens, clearly present this URL to the user and ask them to visit it to grant permissions.`,
110
+
exportconst gmailAgent =newAgent({
111
+
name: "gmailAgent",
112
+
instructions: `You are a Gmail assistant that helps users manage their inbox.
113
+
114
+
When helping users:
115
+
- Always verify their intent before performing actions
116
+
- Keep responses clear and concise
117
+
- Confirm important actions before executing them
118
+
- Respect user privacy and data security
119
+
120
+
Use the gmailTools to interact with various Gmail services and perform related tasks.`,
112
121
model: anthropic("claude-3-7-sonnet-20250219"),
113
-
tools: googleTools,
122
+
tools: gmailTools,
114
123
});
115
124
```
116
125
@@ -126,21 +135,21 @@ Start the Mastra development server:
126
135
npm run dev
127
136
```
128
137
129
-
This will launch a local development playground, typically accessible at `http://localhost:4111`. Open this URL in your browser, select the `googleAgent` from the list of available agents, and start chatting with it directly in the UI.
138
+
This will launch a local development playground, typically accessible at `http://localhost:4111`. Open this URL in your browser, select the `gmailAgent` from the list of available agents, and start chatting with it directly in the UI.
130
139
131
140
**2. Programmatically:**
132
141
133
142
Alternatively, you can interact with the agent directly in your code:
134
143
135
144
```typescript
136
145
// Generate a response from the agent
137
-
const response =awaitgoogleAgent.generate(
146
+
const response =awaitgmailAgent.generate(
138
147
"Read my last email and summarize it in a few sentences",
139
148
);
140
149
console.log(response.text);
141
150
142
151
// Or stream the response for a more interactive experience
143
-
const stream =awaitgoogleAgent.stream("Send an email to [email protected] with the subject 'Hello from Mastra'");
152
+
const stream =awaitgmailAgent.stream("Send an email to [email protected] with the subject 'Hello from Mastra'");
0 commit comments