Skip to content

Commit bd103af

Browse files
committed
add firecrawl
1 parent 70049b2 commit bd103af

File tree

6 files changed

+62
-13
lines changed

6 files changed

+62
-13
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ celerybeat.pid
123123

124124
# Environments
125125
.env
126+
**/.env
126127
.venv
127128
env/
128129
venv/
@@ -167,3 +168,5 @@ ex/
167168
**/ex/
168169
cookiecutter.json
169170

171+
examples/tests/
172+
examples/tests/**/*

agentstack/cli/cli.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,6 @@ def ask_project_details(slug_name: Optional[str] = None) -> dict:
225225
inquirer.Text("version", message="What's the initial version", default="0.1.0"),
226226
inquirer.Text("description", message="Enter a description for your project"),
227227
inquirer.Text("author", message="Who's the author (your name)?"),
228-
inquirer.List(
229-
"license",
230-
message="License?",
231-
choices=[
232-
"MIT",
233-
"Apache-2.0",
234-
"GPL",
235-
"other",
236-
],
237-
),
238228
]
239229

240230
return inquirer.prompt(questions)
@@ -246,7 +236,7 @@ def insert_template(project_details: dict, framework_name: str, design: dict):
246236
description=project_details["description"],
247237
author_name=project_details["author"],
248238
version=project_details["version"],
249-
license=project_details["license"],
239+
license="MIT",
250240
year=datetime.now().year)
251241

252242
project_structure = ProjectStructure()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from crewai_tools import BrowserbaseLoadTool
22

3-
Browserbase = BrowserbaseLoadTool(text_content=True)
3+
browserbase = BrowserbaseLoadTool(text_content=True)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from crewai_tools import tool
2+
from firecrawl import FirecrawlApp
3+
import os
4+
5+
app = FirecrawlApp(api_key=os.getenv('FIRECRAWL_API_KEY'))
6+
7+
8+
@tool
9+
def web_scrape(url: str):
10+
"""
11+
Scrape a url and return markdown. Use this to read a singular page and web_crawl only if you
12+
need to read all other links as well.
13+
"""
14+
scrape_result = app.scrape_url(url, params={'formats': ['markdown']})
15+
return scrape_result.markdown
16+
17+
18+
@tool
19+
def web_crawl(url: str):
20+
"""
21+
Scrape a url and crawl through other links from that page, scraping their contents.
22+
This tool returns a crawl_id that you will need to use after waiting for a period of time
23+
to retrieve the final contents. You should attempt to accomplish another task while waiting
24+
for the crawl to complete.
25+
26+
Crawl will ignore sublinks of a page if they aren’t children of the url you provide.
27+
So, the website.com/other-parent/blog-1 wouldn’t be returned if you crawled website.com/blogs/.
28+
"""
29+
30+
crawl_status = app.crawl_url(
31+
url,
32+
params={
33+
'limit': 100,
34+
'scrapeOptions': {'formats': ['markdown']}
35+
},
36+
poll_interval=30
37+
)
38+
39+
return crawl_status
40+
41+
42+
@tool
43+
def retrieve_web_crawl(crawl_id: str):
44+
"""
45+
Retrieve the results of a previously started web crawl. Crawls take time to process
46+
so be sure to only use this tool some time after initiating a crawl. The result
47+
will tell you if the crawl is finished. If it is not, wait some more time then try again.
48+
"""
49+
return app.check_crawl_status(crawl_id)
50+

agentstack/tools/browserbase.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"name": "browserbase",
33
"package": "poetry add browserbase crewai-tools",
44
"env": "BROWSERBASE_API_KEY=...\nBROWSERBASE_PROJECT_ID=...",
5-
"tools": ["Browserbase"]
5+
"tools": ["browserbase"]
66
}

agentstack/tools/firecrawl.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "firecrawl",
3+
"package": "poetry add firecrawl-py",
4+
"env": "FIRECRAWL_API_KEY=...",
5+
"tools": ["web_scrape", "web_crawl", "retrieve_web_crawl"]
6+
}

0 commit comments

Comments
 (0)