Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import asyncio
from arcadepy import AsyncArcade
from google.adk import Agent, Runner
from google.adk.artifacts import InMemoryArtifactService
from google.adk.sessions import InMemorySessionService, Session
from google.genai import types
from google_adk_arcade.tools import get_arcade_tools
from dotenv import load_dotenv


load_dotenv(override=True)


async def main():
# initialize the Arcade client
client = AsyncArcade()
app_name = "Arcade Google ADK"
user_id = "[email protected]"
session_service = InMemorySessionService()
artifact_service = InMemoryArtifactService()

# This function returns a list of tools in the format expected by ADK
gmail_list_emails = await get_arcade_tools(client, tools=["Gmail_ListEmails"])

# We've updated the agent to access a single tool
agent = Agent(
model="gemini-2.0-flash",
name="simple_agent",
instruction="You are a helpful assistant that can help users with"
" everyday tasks. It is very important that you use"
" the provided tools to ensure the task is successfully"
" achieved",
tools=gmail_list_emails, # pass the tool to the agent
)
session = await session_service.create_session(
app_name=app_name, user_id=user_id, state={
"user_id": user_id,
}
)
runner = Runner(
app_name=app_name,
agent=agent,
artifact_service=artifact_service,
session_service=session_service,
)

# This is a helper function to run the agent with a prompt.
async def run_prompt(session: Session, new_message: str):
content = types.Content(
role='user', parts=[types.Part.from_text(text=new_message)]
)
async for event in runner.run_async(
user_id=user_id,
session_id=session.id,
new_message=content,
):
if event.content.parts and event.content.parts[0].text:
print(f'** {event.author}: {event.content.parts[0].text}')

# This is the main agent loop to prompt the user until they exit.
while True:
user_input = input("User: ")
if user_input.lower() == "exit":
print("Goodbye!")
break
await run_prompt(session, user_input)


if __name__ == "__main__":
asyncio.run(main())


60 changes: 60 additions & 0 deletions examples/code/guides/tool-callling/google-adk/google-adk-only.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import asyncio
from google.adk import Agent, Runner
from google.adk.artifacts import InMemoryArtifactService
from google.adk.sessions import InMemorySessionService, Session
from google.genai import types
from dotenv import load_dotenv


load_dotenv(override=True)


async def main():
app_name = 'Arcade Google ADK'
user_id = '{arcade_user_id}'
session_service = InMemorySessionService()
artifact_service = InMemoryArtifactService()

# This creates a simple agent, and for now it does not have any tools.
agent = Agent(
model="gemini-2.0-flash",
name="simple_agent",
instruction="You are a helpful assistant that can help users with"
" everyday tasks.",
)
session = await session_service.create_session(
app_name=app_name, user_id=user_id, state={
"user_id": user_id,
}
)
runner = Runner(
app_name=app_name,
agent=agent,
artifact_service=artifact_service,
session_service=session_service,
)

# This is a helper function to run the agent with a prompt.
async def run_prompt(session: Session, new_message: str):
content = types.Content(
role='user', parts=[types.Part.from_text(text=new_message)]
)
async for event in runner.run_async(
user_id=user_id,
session_id=session.id,
new_message=content,
):
if event.content.parts and event.content.parts[0].text:
print(f'** {event.author}: {event.content.parts[0].text}')

# This is the main agent loop to prompt the user until they exit.
while True:
user_input = input("User: ")
if user_input.lower() == "exit":
print("Goodbye!")
break
await run_prompt(session, user_input)


if __name__ == "__main__":
asyncio.run(main())
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,6 @@
"prismjs@<1.30.0": ">=1.30.0",
"form-data@>=4.0.0 <4.0.4": ">=4.0.4"
}
}
},
"packageManager": "[email protected]+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
}
5 changes: 5 additions & 0 deletions pages/_meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ export default {
title: "Integrations",
href: "/toolkits",
},
learn: {
type: "page",
title: "Learn",
href: "/learn",
},
reference: {
type: "page",
title: "Reference",
Expand Down
13 changes: 11 additions & 2 deletions pages/home/_meta.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BadgeHelp, Code2, Home, Plug } from "lucide-react";
import { BadgeHelp, Code2, Home, Plug, BookMarked } from "lucide-react";

export default {
"*": {
Expand All @@ -15,7 +15,7 @@ export default {
layout: "full",
},
},
learn: {
integrations: {
title: (
<span className="flex items-center gap-2 font-medium">
<Plug className="size-4" />
Expand All @@ -24,6 +24,15 @@ export default {
),
href: "/toolkits",
},
learn: {
title: (
<span className="flex items-center gap-2 font-medium">
<BookMarked className="size-4" />
Learn
</span>
),
href: "/learn",
},
reference: {
title: (
<span className="flex items-center gap-2 font-medium">
Expand Down
3 changes: 0 additions & 3 deletions pages/home/auth/_meta.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
export default {
"how-arcade-helps": "How Arcade Helps",
"auth-tool-calling": "Authorized Tool Calling",
"tool-auth-status": "Checking Authorization Status",
"call-third-party-apis-directly": "Direct Third-Party API Call",
"secure-auth-production": "Secure Auth in Production",
};
2 changes: 1 addition & 1 deletion pages/home/auth/how-arcade-helps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ When a tool is called, the Arcade Engine will check if the user has granted the

### How to implement OAuth2-authorized tool calling

To learn how Arcade allows for actions (tools) to be authorized through OAuth2 and how to implement it, check out [Authorized Tool Calling](/home/auth/auth-tool-calling).
To learn how Arcade allows for actions (tools) to be authorized through OAuth2 and how to implement it, check out [Authorized Tool Calling](/learn/tool-calling/auth-tool-calling).


### Tools that don't require authorization
Expand Down
2 changes: 1 addition & 1 deletion pages/home/glossary.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ An 'authentication provider' is a service that your users can authenticate to gr

An 'authorization scope' is a permission that a user can grant to an agent. This is used to control what the agent can do with the user's data. Available authorization scopes are defined by the authentication provider, and each tool defines the scopes it requires.

Learn more about [authorized tool calling](/home/auth/auth-tool-calling).
Learn more about [authorized tool calling](/learn/tool-calling/auth-tool-calling).


### Tool Executions
Expand Down
3 changes: 2 additions & 1 deletion pages/home/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ description: "Welcome to the Arcade Docs! Here you'll find everything you need t
---

import { LandingPage } from "@components/LandingPage";
import { MCPLanding } from "@components/MCPLanding";

<LandingPage />
<MCPLanding />
2 changes: 1 addition & 1 deletion pages/home/langchain/use-arcade-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ print(manager.tools)
```
</Tabs.Tab>
<Tabs.Tab>
Arcade offers methods to convert tools into Zod schemas, which is essential since LangGraph defines tools using Zod. The `toZod` method is particularly useful, as it simplifies this integration and makes it easier to use Arcade's tools with LangGraph. Learn more about Arcade's Zod integration options [here](/home/use-tools/get-tool-definitions#get-zod-tool-definitions).
Arcade offers methods to convert tools into Zod schemas, which is essential since LangGraph defines tools using Zod. The `toZod` method is particularly useful, as it simplifies this integration and makes it easier to use Arcade's tools with LangGraph. Learn more about Arcade's Zod integration options [here](/learn/tool-calling/get-tool-definitions#get-zod-tool-definitions).
```javascript
import { Arcade } from "@arcadeai/arcadejs";
import { executeOrAuthorizeZodTool, toZod } from "@arcadeai/arcadejs/lib";
Expand Down
2 changes: 1 addition & 1 deletion pages/home/local-deployment/configure/engine.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ For local development, set `api.development = true`. In development mode, Arcade

## Auth configuration

Arcade Engine manages auth for [AI tools](/home/auth/auth-tool-calling) and [direct API calls](/home/auth/call-third-party-apis-directly). It supports many built-in [auth providers](/home/auth-providers), and can also connect to any [OAuth 2.0](/home/auth-providers/oauth2) authorization server.
Arcade Engine manages auth for [AI tools](/learn/tool-calling/auth-tool-calling) and [direct API calls](/learn/tool-calling/call-third-party-apis-directly). It supports many built-in [auth providers](/home/auth-providers), and can also connect to any [OAuth 2.0](/home/auth-providers/oauth2) authorization server.

The `auth.providers` section defines the providers that users can authorize with. Each provider must have a unique `id` in the array. There are two ways to configure a provider:

Expand Down
2 changes: 1 addition & 1 deletion pages/home/mastra/use-arcade-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ process.env.ANTHROPIC_API_KEY = "your_anthropic_api_key"; // or another supporte

### Convert Arcade tools to Mastra tools

Arcade offers methods to convert tools into Zod schemas, which is essential since Mastra defines tools using Zod. The `toZodToolSet` method is particularly useful, as it simplifies this integration and makes it easier to use Arcade's tools with Mastra. Learn more about Arcade's Zod integration options [here](/home/use-tools/get-tool-definitions#get-zod-tool-definitions).
Arcade offers methods to convert tools into Zod schemas, which is essential since Mastra defines tools using Zod. The `toZodToolSet` method is particularly useful, as it simplifies this integration and makes it easier to use Arcade's tools with Mastra. Learn more about Arcade's Zod integration options [here](/learn/tool-calling/get-tool-definitions#get-zod-tool-definitions).

```ts
import { Arcade } from "@arcadeai/arcadejs";
Expand Down
1 change: 0 additions & 1 deletion pages/home/use-tools/_meta.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export default {
"tools-overview": "Introduction",
"get-tool-definitions": "Tool formats",
};
2 changes: 1 addition & 1 deletion pages/home/vercelai/use-arcade-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const arcade = new Arcade()

### Get tools from Arcade's Gmail toolkit and convert them to Zod

Arcade offers methods to convert tools into Zod schemas, which is essential since the Vercel AI SDK defines tools using Zod. The `toZodToolSet` method is particularly useful, as it simplifies this integration and makes it easier to use Arcade's tools with the Vercel AI SDK. Learn more about Arcade's Zod integration options [here](/home/use-tools/get-tool-definitions#get-zod-tool-definitions).
Arcade offers methods to convert tools into Zod schemas, which is essential since the Vercel AI SDK defines tools using Zod. The `toZodToolSet` method is particularly useful, as it simplifies this integration and makes it easier to use Arcade's tools with the Vercel AI SDK. Learn more about Arcade's Zod integration options [here](/learn/tool-calling/get-tool-definitions#get-zod-tool-definitions).

```ts
// Get Arcade's gmail toolkit
Expand Down
20 changes: 20 additions & 0 deletions pages/learn/_meta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default {
"*": {
breadcrumb: true,
},
index: {
title: <span className="flex items-center gap-2 font-medium">Guides</span>,
theme: {
layout: "full",
},
},
"tool-calling": {
title: "Tool Calling",
},
"multi-user-setups": {
title: "Multi-user apps",
},
"managing-deployments": {
title: "Managing deployments",
},
};
8 changes: 8 additions & 0 deletions pages/learn/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: "Learn"
description: "Welcome to the Arcade Learn! Here you'll find everything you need to know about Arcade."
---

import { Learn } from "@components/Learn";

<Learn />
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
16 changes: 16 additions & 0 deletions pages/learn/tool-calling/_meta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export default {
"auth-tool-calling": "Authorized Tool Calling",
"call-tools-directly": "Call a tool directly",
"get-tool-definitions": "Tool formats",
"call-a-tool-from-an-llm": "Call a tool from an LLM",
"call-third-party-apis-directly": "Direct Third-Party API Call",
"auth-tool-calling-langgraph": "Authorized tool calling using LangGraph",
"auth-tool-calling-openai-agents":
"Authorized tool calling using OpenAI Agents SDK",
"auth-tool-calling-google-adk": "Authorized tool calling using Google ADK",
"jit-auth": "Just-in-time auth",
"bulk-auth": "Bulk-auth before the agent runs",
"tool-auth-status": "Checking Authorization Status",
hitl: "Implementing Human-in-the-loop",
"call-tools-with-mcp": "Call tools with MCP",
};
Loading