Skip to content
Open
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
58 changes: 57 additions & 1 deletion docs/tools/third-party/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,62 @@ Here's the full code combining the steps above to create and run an agent using
--8<-- "examples/python/snippets/tools/third-party/langchain_tavily_search.py"
```

### Example: Using LangChain's StructuredTool

ADK also supports LangChain's `StructuredTool` which allows you to define a schema for your tool's arguments.

```python
from google.adk.agents.llm_agent import Agent
from google.adk.tools.langchain_tool import LangchainTool
from langchain_core.tools import tool
from langchain_core.tools.structured import StructuredTool
from pydantic import BaseModel


async def add(x, y) -> int:
"""Adds two numbers."""
return x + y


@tool
def minus(x, y) -> int:
"""Subtracts two numbers."""
return x - y


class AddSchema(BaseModel):
x: int
y: int


class MinusSchema(BaseModel):
x: int
y: int


test_langchain_add_tool = StructuredTool.from_function(
add,
name="add",
description="Adds two numbers",
args_schema=AddSchema,
)

root_agent = Agent(
model="gemini-2.0-flash-001",
name="test_app",
description="A helpful assistant for user questions.",
instruction=(
"You are a helpful assistant for user questions, you have access to a"
" tool that adds two numbers."
),
tools=[
LangchainTool(tool=test_langchain_add_tool),
LangchainTool(tool=minus),
],
)
```


## 2. Using CrewAI tools

ADK provides the `CrewaiTool` wrapper to integrate tools from the CrewAI library.
Expand Down Expand Up @@ -140,4 +196,4 @@ Here's the full code combining the steps above to create and run an agent using

```py
--8<-- "examples/python/snippets/tools/third-party/crewai_serper_search.py"
```
```