Workflows enable hybrid automation by combining the precision of scripting with the adaptability of AI agents. They allow you to script the predictable parts of your automation while leveraging agents only when needed, resulting in more reliable and cost-effective automations.
Define your function handler as a regular python function.
from notte_sdk import NotteClient
notte = NotteClient()
# define your function variables as arguments
def run(url: str):
with notte.Session() as session:
session.execute(type="goto", url=url)
return session.scrape()
Each handler function must be named run.
You can create, update and run deployed functions:
from notte_sdk import NotteClient
from pathlib import Path
code = """
from notte_sdk import NotteClient
notte = NotteClient()
# define your function variables as arguments
def run(url: str):
with notte.Session() as session:
session.execute(type="goto", url=url)
return session.scrape()
"""
# create a local python file with your function code
with Path("my_scraping_function.py").open("w") as f:
f.write(code)
notte = NotteClient()
# Use your local python file to deploy a new function
function = notte.Function(
path="my_scraping_function.py",
name="My Scraping Flow",
description="A flow for scraping the web"
)
print(f"Function created with ID: {function.response.function_id}. You can reference it using `notte.Function(<function_id>)`")
Parameters
The path to the workflow to upload.