Lightweight playwright wrapper for AI Agents
Project description
Eidolon Browser Service
This is a playwright wrapper that allows you to run browser automation for AI Agents. It exposes a restapi to create new pages, execute javascript code on a page, and get the page content. It supports OpenAPI and hosts a swagger UI on /docs.
To use this service as a client pip install. There is an optional extra 'server' that includes the dependencies needed to run the server, keeping this library as a lightweight client.
Running the service
docker run -p 7468:7468 eidolonai/browser_service:latest
Note: The dockerfile has the CMD ["uvicorn", "eidolon_browser_service.main:app", "--host", "0.0.0.0", "--port", "7468"]
Endpoints
See the OpenAPI for the full list of endpoints.
Customization
The service can be customized by setting the following environment variables:
BROWSER_SERVICE_CONTEXT_LIMIT=20 # the maximum number of browser contexts that can be created. Can be disabled by setting to -1
BROWSER_SERVICE_CONTEXT_TTL=3600 # the ttl time in seconds of a browser context. Can be disabled by setting to -1
Python Client
The client is available at eidolon_browser_service.async_client
after pip installing this package.
Download
pip install eidolon-browser-service
Note that this only includes the client code. The server dependencies are an available extra .
Usage
from eidolon_browser_service.async_client import Browser
async def main():
context = Browser().context("context_id")
page = await context.new_page()
await page.goto("https://google.com")
await page.actions(action="fill", kwargs=dict(selector="textarea[name='q']", value="Eidolon AI"))
await page.actions(action="click", kwargs=dict(selector="input[name='btnK']"))
print(await page.content())
await context.delete()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file eidolon_browser_service-0.1.7.tar.gz
.
File metadata
- Download URL: eidolon_browser_service-0.1.7.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
f5c8be34e0ef969ca9bba257d1fa873ec9a3b5ce8a6add4df325c2fb50333775
|
|
MD5 |
4287339801c4cfa2f7f0d6fbb530d3c2
|
|
BLAKE2b-256 |
22308b088e99bb91f72773749c7c299c4fb16a9da71024015f8beaeeef5b5774
|
File details
Details for the file eidolon_browser_service-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: eidolon_browser_service-0.1.7-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
afd8552a13a5dd51a77748812d8f60541fb14c4c072dedbac7a253c2f44afda0
|
|
MD5 |
3189bc5b01d757231bd06b4e7695cf02
|
|
BLAKE2b-256 |
efe03f3be48abb8d791687cb29032b186c3f58d106f377714be56283eb39c8ab
|