Scrap Web
  • Get Started
    • Introduction
    • Quickstart
  • Customize
    • Agent Settings
    • Browser Settings
    • Custom Functions
    • LangChain Chat Models
    • System prompt
  • Development
    • Local Setup
    • Telemetry
    • Roadmap
    • Tokenomics
Powered by GitBook
On this page
  1. Get Started

Quickstart

Start using Scrap Web with this quickstart guide

PreviousIntroductionNextAgent Settings

Last updated 4 months ago

Prepare the environment

Scrap Web requires Python 3.11 or higher.

First, we recommend using to setup the Python environment.

Copy

uv venv --python 3.11

and activate it with:

Copy

source .venv/bin/activate

Install the dependencies:

Copy

uv pip install scrap-web

Then install playwright:

Copy

playwright install

Create an agent

Then you can use the agent as follows:

agent.pyCopy

from langchain_openai import ChatOpenAI
from swift_web import Agent
import asyncio

llm = ChatOpenAI(model="gpt-4o")

async def main():
    agent = Agent(
        task="Find a one-way flight from Bali to Oman on 12 January 2025 on Google Flights. Return me the cheapest option.",
        llm=llm,
    )
    result = await agent.run()
    print(result)

asyncio.run(main())

ChatOpenAI and other Langchain chat models require specific API keys. For example, for for OpenAI and Anthropic, you can set the API keys in your .env file, such as.

.envCopy

OPENAI_API_KEY=
ANTHROPIC_API_KEY=

Set up your LLM API keys

For other LLM models you can refer to the to find how to set them up with their specific API keys.

uv
​
​
Langchain documentation