Skip to content
Open
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
Expand Up @@ -3,14 +3,16 @@ title: "Custom Auth Flow with CrewAI"
description: "Learn how to create a custom auth flow with CrewAI"
---

<!-- Editorial: Structure - Added intro line and reorganized first paragraph to follow 10/20/70 format; Terminology - Changed "Tool" to "tool" in heading -->

import { Steps, Callout } from "nextra/components";
import ToggleContent from "@/app/_components/toggle-content";

## Custom Auth Flow with CrewAI
## Custom auth flow with CrewAI

In this guide, we will explore how to create a custom auth flow that will be performed before executing Arcade tools within your CrewAI agent team.
Learn how to create a custom auth flow that runs before executing Arcade tools within your CrewAI agent team.

The `ArcadeToolManager`'s built-in authorization and tool execution flows work well for many typical use cases. However, some scenarios call for a tailored approach. By implementing a custom auth flow, you gain flexibility in handling tool authorization. If your use case calls for a unique interface, additional approval steps, or specialized error handling, then this guide is for you.
The `ArcadeToolManager`'s built-in authorization and tool execution flows work well for many typical use cases. However, some scenarios call for a tailored approach. By implementing a custom auth flow, you gain flexibility in handling tool authorization. If your use case calls for a unique interface, additional approval steps, or specialized error handling, then this guide is for you. You'll learn how to override the default authorization flow, implement custom approval steps, and integrate the custom flow into your CrewAI agents.

<Steps>

Expand All @@ -20,7 +22,7 @@ The `ArcadeToolManager`'s built-in authorization and tool execution flows work w

### Set up your environment

Install the required package, and ensure your environment variables are set with your Arcade and OpenAI API keys:
Install the required package, and set your environment variables with your Arcade and OpenAI API keys:

```bash
pip install crewai-arcade
Expand All @@ -37,7 +39,7 @@ export OPENAI_API_KEY="your_openai_api_key"

### Define your custom auth flow

The custom auth flow defined in the following code snippet is a function that will be called whenever CrewAI needs to call a tool.
The custom auth flow defined in the following code snippet is a function that CrewAI calls whenever it needs to call a tool.

```python
from typing import Any
Expand All @@ -51,15 +53,15 @@ def custom_auth_flow(
) -> Any:
"""Custom auth flow for the ArcadeToolManager

This function is called when CrewAI needs to call a tool that requires authorization.
Authorization is handled before executing the tool.
CrewAI calls this function when it needs to call a tool that requires authorization.
The system handles authorization before executing the tool.
This function overrides the ArcadeToolManager's default auth flow performed by ArcadeToolManager.authorize_tool
"""
# Get authorization status
auth_response = manager.authorize(tool_name, USER_ID)

# If the user is not authorized for the tool,
# then we need to handle the authorization before executing the tool
# then handle the authorization before executing the tool
if not manager.is_authorized(auth_response.id):
print(f"Authorization required for tool: '{tool_name}' with inputs:")
for input_name, input_value in tool_input.items():
Expand All @@ -81,8 +83,8 @@ def custom_auth_flow(
def tool_manager_callback(tool_manager: ArcadeToolManager, tool_name: str, **tool_input: dict[str, Any]) -> Any:
"""Tool executor callback with custom auth flow for the ArcadeToolManager

ArcadeToolManager's default executor handles authorization and tool execution.
This function overrides the default executor to handle authorization in a custom way and then executes the tool.
ArcadeToolManager's default executor calls the function to handle authorization and tool execution.
This function overrides the default executor to handle authorization in a custom way and then the system executes the tool.
"""
custom_auth_flow(tool_manager, tool_name, **tool_input)
return tool_manager.execute_tool(USER_ID, tool_name, **tool_input)
Expand All @@ -102,7 +104,7 @@ tools = manager.get_tools(tools=["Gmail.ListEmails"], toolkits=["Slack"])

### Use tools in your CrewAI agent team

Create a Crew that uses your tools with the custom auth flow. When the tool is called, your tool manager callback will be called to handle the authorization and then the tool will be executed.
Create a Crew that uses your tools with the custom auth flow. When the tool calls your method, your tool manager callback handles the authorization and then the system executes the tool.

```python
from crewai import Agent, Crew, Task
Expand Down Expand Up @@ -156,15 +158,15 @@ def custom_auth_flow(
) -> Any:
"""Custom auth flow for the ArcadeToolManager

This function is called when CrewAI needs to call a tool that requires authorization.
Authorization is handled before executing the tool.
CrewAI calls this function when it needs to call a tool that requires authorization.
The system handles authorization before executing the tool.
This function overrides the ArcadeToolManager's default auth flow performed by ArcadeToolManager.authorize_tool
"""
# Get authorization status
auth_response = manager.authorize(tool_name, USER_ID)

# If the user is not authorized for the tool,
# then we need to handle the authorization before executing the tool
# then handle the authorization before executing the tool
if not manager.is_authorized(auth_response.id):
print(f"Authorization required for tool: '{tool_name}' with inputs:")
for input_name, input_value in tool_input.items():
Expand All @@ -186,8 +188,8 @@ def custom_auth_flow(
def tool_manager_callback(tool_manager: ArcadeToolManager, tool_name: str, **tool_input: dict[str, Any]) -> Any:
"""Tool executor callback with custom auth flow for the ArcadeToolManager

ArcadeToolManager's default executor handles authorization and tool execution.
This function overrides the default executor to handle authorization in a custom way and then executes the tool.
ArcadeToolManager's default executor calls the function to handle authorization and tool execution.
This function overrides the default executor to handle authorization in a custom way and then the system executes the tool.
"""
custom_auth_flow(tool_manager, tool_name, **tool_input)
return tool_manager.execute_tool(USER_ID, tool_name, **tool_input)
Expand Down Expand Up @@ -231,4 +233,4 @@ print(result)

## Next steps

Now you're ready to integrate Arcade tools with a custom auth flow into your own CrewAI agent team.
Now you're ready to integrate Arcade tools with a custom auth flow into your own CrewAI agent team.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ title: "Use Arcade tools with CrewAI"
description: "Integrate Arcade tools into your CrewAI applications"
---

<!-- Editorial: Voice and tone - Changed "Follow the step-by-step instructions below" to be more direct; Structure - Added introductory context about what readers will learn -->

import { Steps } from "nextra/components";
import ToggleContent from "@/app/_components/toggle-content";

## Use CrewAI with Arcade

This guide explains how to integrate Arcade tools into your CrewAI application. Follow the step-by-step instructions below. If a tool requires authorization, an authorization URL will appear in the console, waiting for your approval. This process ensures that only the tools you choose to authorize execute.
This guide explains how to integrate Arcade tools into your CrewAI application for practitioners building agent workflows.

You'll learn how to set up the CrewAI-Arcade integration, configure tool authorization, and create agents that can execute Arcade tools. This integration allows your CrewAI agents to access external services through Arcade's tool ecosystem while maintaining secure authorization flows.

When a tool requires authorization, an authorization URL will appear in the console, waiting for your approval. This process ensures that only the tools you choose to authorize execute.

To tailor the tool authorization flow to meet your application's specific needs, check out the [Custom Auth Flow with CrewAI](/get-started/agent-frameworks/crewai/custom-auth-flow) guide.

Expand All @@ -20,7 +26,7 @@ To tailor the tool authorization flow to meet your application's specific needs,

### Set up your environment

Install the required package, and ensure your environment variables are set with your Arcade and OpenAI API keys:
Install the required package, and ensure you set your environment variables with your Arcade and OpenAI API keys:

```bash
pip install crewai-arcade
Expand Down Expand Up @@ -52,7 +58,7 @@ tools = manager.get_tools(tools=["Gmail.ListEmails"], toolkits=["Slack"])

### Use tools in your CrewAI agent team

Create a Crew that uses your tools. When the tool is called, you will be prompted to go visit an authorization page to authorize the tool before it executes.
Create a Crew that uses your tools. When you call the tool, you will visit an authorization page to authorize the tool before it executes.

```python
from crewai import Agent, Crew, Task
Expand Down Expand Up @@ -137,12 +143,12 @@ print(result)
## Tips for selecting tools

- **Relevance**: Pick only the tools you need. Avoid using all tools at once.
- **Avoid conflicts**: Be mindful of duplicate or overlapping functionality.
- **Avoid conflicts**: Be mindful of duplicate or overlapping capability.

## Next steps

Now that you have integrated Arcade tools into your CrewAI agent team, you can:

- Experiment with different toolkits, such as "Math" or "Search."
- Customize the agent's prompts for specific tasks.
- Customize the tool authorization and execution flow to meet your application's requirements.
- Customize the tool authorization and execution flow to meet your application's requirements.
32 changes: 17 additions & 15 deletions app/en/get-started/agent-frameworks/google-adk/overview/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ title: "Arcade with Google ADK overview"
description: "Comprehensive guide to using Arcade with the Google ADK library"
---

<!-- Editorial: Voice and Tone (Avoid marketing language) - Removed "seamless" and "powerful"; Structure (Default Page Structure) - Restructured opening to follow 10/20/70 format -->

# Arcade with Google ADK

The `google-adk-arcade` package provides a seamless integration between
[Arcade](https://arcade.dev) and the [Google ADK](https://github.com/google/adk-python/). This integration allows you to enhance your AI agents with powerful Arcade tools including Google Mail, LinkedIn, GitHub, and many more.
The `google-adk-arcade` package integrates [Arcade](https://arcade.dev) with the [Google ADK](https://github.com/google/adk-python/).

This integration enables AI developers working with Google's ADK framework to enhance their agents with Arcade tools including Google Mail, LinkedIn, GitHub, and many more. You'll use this when building AI agents that need to interact with external services through authenticated APIs. The integration handles tool management and user authorization, allowing you to focus on agent logic rather than infrastructure.

## Installation

Expand All @@ -20,15 +23,15 @@ Make sure you have your Arcade API key ready. [Get an API key](/get-started/setu

## Key features

- **Easy integration** with the Google ADK framework
- **Access to all Arcade MCP Servers** including Google, GitHub, LinkedIn, X, and more
- **Create custom tools** with the Arcade Tool SDK
- **Manage user authentication** for tools that require it
- **Asynchronous support** compatible with Google's ADK framework
- Integration with the Google ADK framework
- Access to all Arcade MCP servers including Google, GitHub, LinkedIn, X, and more
- Create custom tools with the Arcade Tool SDK
- Manage user authorization for tools that require it
- Asynchronous support compatible with Google's ADK framework

## Basic usage

Here's a simple example of using Arcade tools with OpenAI Agents:
Here's an example of using Arcade tools with OpenAI Agents:

```python
import asyncio
Expand Down Expand Up @@ -100,11 +103,10 @@ if __name__ == '__main__':
asyncio.run(main())
```

## Handling authorization
## Handle authorization

When a user needs to authorize access to a tool (like Google or GitHub),
the agent will reply with a URL for the user to visit, which will be displayed
to the user.
the agent will reply with a URL for the user to visit, which the user will see.

After visiting the URL and authorizing access, the user can run the agent again
with the same `user_id`, and it will work without requiring re-authorization.
Expand All @@ -125,9 +127,9 @@ for tool in google_tools:

## Next steps

Ready to start building with Arcade and OpenAI Agents? Check out these guides:
Ready to start building with Arcade and Google ADK? Check out these guides:

- [Using Arcade tools](/get-started/agent-frameworks/google-adk/use-arcade-tools) - Learn the basics of using Arcade tools with Google ADK
- [Creating custom tools](/guides/create-tools/tool-basics/build-mcp-server) - Build your own tools with the Arcade Tool SDK
- [Use Arcade tools](/get-started/agent-frameworks/google-adk/use-arcade-tools) - Learn the basics of using Arcade tools with Google ADK
- [Create custom tools](/guides/create-tools/tool-basics/build-mcp-server) - Build your own tools with the Arcade Tool SDK

Enjoy exploring Arcade and building powerful AI-enabled applications.
Enjoy exploring Arcade and building AI-enabled applications.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ title: "Use Arcade with Google ADK"
description: "Integrate Arcade tools into your Google ADK applications"
---

<!-- Editorial: Voice and Tone - Removed "let's" (avoid marketing language); Structure - Added proper intro paragraph following 10/20/70 format -->

import { Steps } from "nextra/components";

## Use Arcade with Google ADK

In this guide, let's explore how to integrate Arcade tools into your Google ADK application. Follow the step-by-step instructions below.
This guide shows you how to integrate Arcade tools into your Google ADK application.

You'll learn how to set up the Google ADK Arcade integration, retrieve and authorize tools from MCP servers, and create agents that can use Arcade's capabilities. This approach enables you to build AI applications that can interact with external services like Gmail, GitHub, and LinkedIn through Arcade's tool ecosystem. You'll need basic Python knowledge and existing Google ADK familiarity to follow along.

<Steps>

Expand All @@ -17,7 +21,7 @@ In this guide, let's explore how to integrate Arcade tools into your Google ADK

### Set up your environment

Install the required packages, and ensure your environment variables are set with your Arcade API key:
Install the required packages, and ensure you set your environment variables with your Arcade API key:

```bash
pip install google-adk-arcade
Expand All @@ -37,7 +41,7 @@ export GOOGLE_GENAI_USE_VERTEXAI=FALSE

### Create and manage Arcade tools

Use the `get_arcade_tools` function to retrieve tools from specific MCP Servers:
Use the `get_arcade_tools` function to retrieve tools from specific MCP servers:

```python
from arcadepy import AsyncArcade
Expand Down Expand Up @@ -214,9 +218,7 @@ if __name__ == '__main__':

Now that you have integrated Arcade tools into your Google ADK application, you can:

- Experiment with different MCP Servers, such as "Github" or "LinkedIn"
- Experiment with different MCP servers, such as "Github" or "LinkedIn"
- Customize the agent's instructions for specific tasks
- Try out multi-agent systems using different Arcade tools
- Build your own custom tools with the Arcade Tool SDK

Enjoy exploring Arcade and building powerful AI-enabled Python applications!
- Build your own custom tools with the Arcade Tool SDK
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ title: "Authorize Existing Tools"
description: "Use Arcade to authorize existing tools"
---

<!-- Editorial: Voice and Tone - Removed "we'll show you", Structure - Reorganized intro paragraph to match 10/20/70 format -->

import { Steps, Tabs, Callout } from "nextra/components";

## Authorize Existing Tools

In this guide, we'll show you how to authorize LangChain tools like the `GmailToolkit` using Arcade. You may already have tools you want to use, and this guide will show you how to authorize them. Arcade handles retrieving, authorizing, and managing tokens so you don't have to. For complete working examples, see our [Python](https://github.com/ArcadeAI/arcade-ai/blob/main/examples/langchain/langchain_tool_arcade_auth.py) and [JavaScript](https://github.com/ArcadeAI/arcade-ai/blob/main/examples/langchain-ts/langchain-tool-arcade-auth.ts) examples.
This guide covers how to authorize LangChain tools like the `GmailToolkit` using Arcade.

You can use Arcade to handle OAuth for existing LangChain tools you already have. This is useful when you want to add authentication to tools without rebuilding them as Arcade tools. Arcade handles retrieving, authorizing, and managing tokens automatically. For complete working examples, see the [Python](https://github.com/ArcadeAI/arcade-ai/blob/main/examples/langchain/langchain_tool_arcade_auth.py) and [JavaScript](https://github.com/ArcadeAI/arcade-ai/blob/main/examples/langchain-ts/langchain-tool-arcade-auth.ts) examples.

<Steps>

Expand All @@ -17,7 +21,7 @@ In this guide, we'll show you how to authorize LangChain tools like the `GmailTo

### Install the required packages

Instead of the `langchain_arcade` package, you only need the `arcadepy` package to authorize existing tools since Arcade tools are not being used.
Instead of the `langchain_arcade` package, you only need the `arcadepy` package to authorize existing tools since you use Arcade tools.

<Tabs items={["Python", "JavaScript"]} storageKey="preferredLanguage">
<Tabs.Tab>
Expand Down Expand Up @@ -111,7 +115,7 @@ if auth_response.status != "completed":
print(auth_response.url)
```

The `auth_response.status` will be `"completed"` if the user has already authorized the application, so they won't be prompted to authorize again.
The `auth_response.status` will be `"completed"` if the user has already authorized the application, so the system won't prompt them to authorize again.
</Tabs.Tab>
<Tabs.Tab>
```javascript
Expand All @@ -121,7 +125,7 @@ if (authResponse.status !== "completed") {
}
```

The `authResponse.status` will be `"completed"` if the user has already authorized the application, so they won't be prompted to authorize again.
The `authResponse.status` will be `"completed"` if the user has already authorized the application, so the system won't prompt them to authorize again.
</Tabs.Tab>
</Tabs>

Expand All @@ -146,7 +150,7 @@ The `waitForCompletion` method will do nothing if the user has already authorize
</Tabs>


### Use the token to initialize the Gmail MCP Server
### Use the token to initialize the Gmail toolkit

<Tabs items={["Python", "JavaScript"]} storageKey="preferredLanguage">
<Tabs.Tab>
Expand Down Expand Up @@ -217,6 +221,6 @@ for await (const event of events) {
</Tabs>
</Steps>

### Next Steps
### Next steps

Now you're ready to explore more LangChain tools with Arcade. Try integrating additional MCP Servers and crafting more complex queries to enhance your AI workflows.
Explore more LangChain tools with Arcade. Try integrating additional auth providers and crafting more complex queries to enhance your AI workflows.
Loading