From 3799196bce187565411d3b20b1cd9594b2ed481a Mon Sep 17 00:00:00 2001 From: Brad Valdes Date: Wed, 18 Mar 2026 11:10:02 -0400 Subject: [PATCH] Add Arch Tools integration: 58+ real-world API tools for CrewAI agents --- integrations/arch-tools-agent/README.md | 108 ++++++++++++++ integrations/arch-tools-agent/main.py | 134 ++++++++++++++++++ .../arch-tools-agent/requirements.txt | 2 + 3 files changed, 244 insertions(+) create mode 100644 integrations/arch-tools-agent/README.md create mode 100644 integrations/arch-tools-agent/main.py create mode 100644 integrations/arch-tools-agent/requirements.txt diff --git a/integrations/arch-tools-agent/README.md b/integrations/arch-tools-agent/README.md new file mode 100644 index 00000000..b0c4756d --- /dev/null +++ b/integrations/arch-tools-agent/README.md @@ -0,0 +1,108 @@ +# CrewAI + Arch Tools Integration + +Give your CrewAI agents access to **58+ real-world API tools** — web scraping, search, crypto data, sentiment analysis, OCR, hashing, and more — through a single API key. + +## What is Arch Tools? + +[Arch Tools](https://archtools.dev) provides a unified API for 58+ tools that AI agents need in the real world. One API key, one SDK, pay-per-call or use free credits. + +**Key features:** +- 🔍 Web search & scraping +- 💰 Crypto prices & market data +- 🧠 AI text generation & summarization +- 📊 Sentiment analysis +- 🔐 Hashing, UUIDs, email verification +- 📷 Screenshots & OCR +- ⚡ x402 crypto payments (pay-per-call with USDC) + +## Quick Start + +### 1. Install dependencies + +```bash +pip install -r requirements.txt +``` + +### 2. Get your API keys + +- **Arch Tools**: Sign up free at [archtools.dev](https://archtools.dev) (250 free credits) +- **OpenAI**: For the LLM powering the agent (or swap for any CrewAI-supported model) + +### 3. Set environment variables + +```bash +export ARCH_TOOLS_API_KEY=arch_your_key_here +export OPENAI_API_KEY=sk-your_key_here +``` + +### 4. Run + +```bash +python main.py +``` + +## How It Works + +This example wraps Arch Tools endpoints as CrewAI `BaseTool` subclasses: + +| CrewAI Tool | Arch Tools Endpoint | What it does | +|---|---|---| +| `WebScrapeTool` | `web_scrape()` | Extract text from any URL | +| `WebSearchTool` | `search_web()` | Search the web | +| `CryptoPriceTool` | `crypto_price()` | Live crypto prices | +| `SentimentTool` | `sentiment_analysis()` | Analyze text sentiment | +| `SummarizeTool` | `summarize()` | Bullet-point summaries | + +The pattern is simple — any of Arch Tools' 58+ endpoints can become a CrewAI tool in ~10 lines: + +```python +from crewai.tools import BaseTool +from arch_tools import ArchTools + +arch = ArchTools(api_key="arch_your_key_here") + +class MyTool(BaseTool): + name: str = "my_tool" + description: str = "What this tool does" + + def _run(self, input: str) -> str: + return str(arch.call("tool-name", param=input)) +``` + +## Extend It + +Arch Tools has 58+ tools you can wrap. Some ideas: + +```python +# Screenshot any webpage +class ScreenshotTool(BaseTool): + name: str = "screenshot" + description: str = "Capture a screenshot of any URL" + def _run(self, url: str) -> str: + return str(arch.screenshot_capture(url)) + +# Verify an email address +class EmailVerifyTool(BaseTool): + name: str = "email_verify" + description: str = "Check if an email address is valid and deliverable" + def _run(self, email: str) -> str: + return str(arch.email_verify(email)) + +# Extract text from images (OCR) +class OCRTool(BaseTool): + name: str = "ocr" + description: str = "Extract text from an image URL" + def _run(self, image_url: str) -> str: + return str(arch.ocr_extract(image_url)) +``` + +## Links + +- [Arch Tools API Docs](https://archtools.dev/docs) +- [Arch Tools Python SDK](https://pypi.org/project/arch-tools/) +- [CrewAI Documentation](https://docs.crewai.com/) +- [Full tool list](https://archtools.dev/docs#tools) + +## License + +MIT diff --git a/integrations/arch-tools-agent/main.py b/integrations/arch-tools-agent/main.py new file mode 100644 index 00000000..387afceb --- /dev/null +++ b/integrations/arch-tools-agent/main.py @@ -0,0 +1,134 @@ +""" +CrewAI + Arch Tools: Give your AI agents 58+ real-world API tools + +This example builds a research agent with web scraping, search, and crypto +data — all powered by Arch Tools (https://archtools.dev). + +Setup: + pip install crewai arch-tools + export ARCH_TOOLS_API_KEY=arch_your_key_here + export OPENAI_API_KEY=sk-... + python main.py +""" + +import os +from crewai import Agent, Task, Crew, LLM +from crewai.tools import BaseTool +from arch_tools import ArchTools + +# --- Initialize Arch Tools client --- +arch = ArchTools(api_key=os.environ["ARCH_TOOLS_API_KEY"]) + + +# --- Define tools that wrap Arch Tools endpoints --- + +class WebScrapeTool(BaseTool): + name: str = "web_scraper" + description: str = "Scrape and extract text content from any URL. Input: a valid URL string." + + def _run(self, url: str) -> str: + result = arch.web_scrape(url) + return result.get("text", result.get("markdown", str(result)))[:5000] + + +class WebSearchTool(BaseTool): + name: str = "web_search" + description: str = "Search the web for any query. Input: a search query string." + + def _run(self, query: str) -> str: + result = arch.search_web(query, limit=5) + results = result.get("results", []) + if not results: + return f"No results found for: {query}" + lines = [] + for r in results[:5]: + title = r.get("title", "Untitled") + url = r.get("url", "") + snippet = r.get("snippet", "") + lines.append(f"• {title}\n {url}\n {snippet}") + return "\n\n".join(lines) + + +class CryptoPriceTool(BaseTool): + name: str = "crypto_price" + description: str = "Get the current price for a cryptocurrency. Input: symbol like 'bitcoin' or 'ethereum'." + + def _run(self, symbol: str) -> str: + result = arch.crypto_price(symbol) + return str(result) + + +class SentimentTool(BaseTool): + name: str = "sentiment_analysis" + description: str = "Analyze the sentiment of a text passage. Input: text to analyze." + + def _run(self, text: str) -> str: + result = arch.sentiment_analysis(text) + return str(result) + + +class SummarizeTool(BaseTool): + name: str = "text_summarizer" + description: str = "Summarize a long text into bullet points. Input: text to summarize." + + def _run(self, text: str) -> str: + result = arch.summarize(text, style="bullets") + return result.get("summary", str(result)) + + +# --- Build the agent --- + +researcher = Agent( + role="Research Analyst", + goal="Gather and synthesize information from multiple web sources, " + "including live market data and sentiment analysis", + backstory=( + "You are an expert research analyst with access to web scraping, " + "search engines, cryptocurrency data, and NLP tools. You gather " + "information methodically, cross-reference sources, and produce " + "clear, actionable reports." + ), + tools=[ + WebScrapeTool(), + WebSearchTool(), + CryptoPriceTool(), + SentimentTool(), + SummarizeTool(), + ], + llm=LLM(model="gpt-4o"), + verbose=True, +) + +# --- Define the task --- + +task = Task( + description=( + "Research the current state of AI agent tooling and crypto payments. " + "Do the following:\n" + "1. Search the web for 'AI agent tools API 2026'\n" + "2. Scrape https://archtools.dev to understand what Arch Tools offers\n" + "3. Get the current Bitcoin and Ethereum prices\n" + "4. Analyze the sentiment of the scraped content\n" + "5. Compile a concise research report with your findings" + ), + expected_output=( + "A structured research report with sections: " + "AI Agent Tooling Landscape, Arch Tools Overview, " + "Crypto Market Snapshot, and Key Takeaways" + ), + agent=researcher, +) + +# --- Run the crew --- + +if __name__ == "__main__": + crew = Crew( + agents=[researcher], + tasks=[task], + verbose=True, + ) + result = crew.kickoff() + print("\n" + "=" * 60) + print("RESEARCH REPORT") + print("=" * 60) + print(result) diff --git a/integrations/arch-tools-agent/requirements.txt b/integrations/arch-tools-agent/requirements.txt new file mode 100644 index 00000000..a28b5c27 --- /dev/null +++ b/integrations/arch-tools-agent/requirements.txt @@ -0,0 +1,2 @@ +crewai>=0.100.0 +arch-tools>=0.1.0