A small Python library created to help developers protect their applications from Server Side Request Forgery (SSRF) attacks.
Project description
🕺 grompy
Hello! This is grompy, a Python library that makes it easy to build, debug, and share workflows (flows), e.g. autonomous applications that perform actions using your browser or desktop.
✨ Build flows with a simple high-level Flow class that can wrap any kind of application. Since grompy comes "batteries-included", you can write your first Flow to control a browser in just a single line.
🔎 Debug flows with an intuitive Gradio user interface, that exposes agent thought while it runs and allows users to "step-in" and intervene at any point.
🤗 Share flows on Hugging Face Spaces publicly (or with specific collaborators) and reuse flows from the community
Installation
Assuming you have Python 3.10 or higher already installed, run in your terminal:
pip install "grompy[full]"
Key Features
1. Get started immediately ✨
Run browser automations with a single terminal command. No need for complex setup or boilerplate code:
grompy flow "Use Wikipedia to tell me the birth date of George Washington. Return the final answer in this format: MM-DD-YYYY."
Note: by default, grompy uses a web-browsing agent built using the excellent smolagents library. The web-browsing agent works best when provided detailed, step-by-step instructions.
2. Customize Flows
Create interactive automation apps using the Flow class. You can define input parameters that users can customize before running the flow:
from grompy import Flow
import gradio as gr
flow = Flow(
task="Find the next upcoming meetup in {} related to {}",
inputs=[
gr.Textbox(label="Location", value="San Francisco")
gr.Textbox(label="Activity", value="board games"),
]
)
flow.launch()
Run Flows Programmatically
The Flow class can also be run programmatically so that it can be used as part of larger programs. Here's an example:
from grompy import Flow
import csv
flow = Flow(task="Find the next upcoming meetup in {} related to {}")
cities = [
"San Francisco", "New York", "Chicago", "Los Angeles", "Seattle",
"Austin", "Boston", "Denver", "Portland", "Miami"
]
results = []
for city in cities:
event_info = flow.run(city, "board games")
results.append({"city": city, "event": event_info})
with open("board_game_events.csv", "w", newline="") as f:
writer = csv.DictWriter(f, fieldnames=["city", "event"])
writer.writeheader()
writer.writerows(results)
3. Easy Sharing via Hugging Face Spaces
Share your automation workflows with others by publishing to Hugging Face Spaces. Just navigate to your project folder and run in the terminal:
grompy publish
This will create a public (you can change visibility to private) Hugging Face Space where others can access and use your automation.
4. Use Community Workflows
Take advantage of existing workflows created by the community. Run any published workflow locally from your terminal, e.g.:
grompy flow https://huggingface.co/spaces/abidlabs/Activity_Finder
The Python equivalent to load a Flow from Spaces is also straightforward:
import grompy as gv
flow = gv.Flow.from_space("https://huggingface.co/spaces/abidlabs/Activity_Finder")
...
Roadmap aka leftover TODOs
-
Get a complex flow woking reliably and fast, add logs
-
Improve default BrowserAgent tool as it gives lookup errors way too often.
-
Generally improve troubleshooting
-
Better cleanup of gradio ui and browsing windows when script is terminated
-
Allow pausing / stopping from gradio ui / include timing information in UI
-
Warn before using OPENAI_API_KEY / HF_TOKEN
-
Add better examples in readme / Spaces (twitter explorer find tweets about a particular topic), research presidents' spouse. Chain Flows together
-
Add support for using the user's default browser
-
Allow retrying from cli and python (understand why browsing fails first. also add max_time_per_step?)
-
Support
max_steps/max_timein.run() -
Be smarter about screenshots
-
Autogenerated docs
-
Support structured generation in
.run()-- how would this work? -
Make it easier to modify the default agent (e.g. by copy-pasting it into the working directory)
-
Allow
taskto be an arbitrary function of inputs, not just a format string -
Add support for
browser-useand desktop apps -
Give examples of how this could be useful long-term (e.g. autonomous agents running on cron jobs & slacking you important stuff)
-
Figure out a way to get human input
Contributing
Contributions are welcome! Feel free to submit bug reports and feature requests or submit pull requests. Star this repo if you find it interesting ⭐
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grompy-0.0.3.tar.gz.
File metadata
- Download URL: grompy-0.0.3.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b78c541ec00efe55ea6487268bc9a67b620795d9451b548b68ac8a7b1dee678d
|
|
| MD5 |
eef798f0dcbab09f4d46e0e167af168a
|
|
| BLAKE2b-256 |
a97c7d64685a7f81eb7c5a27efd28d72b8810f67a14e83edcb49df2beeb02b3d
|
File details
Details for the file grompy-0.0.3-py3-none-any.whl.
File metadata
- Download URL: grompy-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea0f70713d8671ceb34db98e2a976806e19de8c8b71b51cf9f59e2e1ce3f13a9
|
|
| MD5 |
7d6dcd8e1a53e275f27de6c0db641fb0
|
|
| BLAKE2b-256 |
c65fa082e1358972924765c97787e14df184c4e97d3dc64d53b689d827976890
|