Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Split validator and output
magmueller2f0634048ada
diff --git a/examples/custom_output_and_validate_output.py b/examples/custom_output.pysimilarity index 89%rename from examples/custom_output_and_validate_output.pyrename to examples/custom_output.pyindex 813c58855..324241dfa 100644--- a/examples/custom_output_and_validate_output.py+++ b/examples/custom_output.py@@ -29,7 +29,6 @@ class DoneResult(BaseModel):hours_since_post: int-# we overwrite done() with custom output to demonstrate the validator@controller.registry.action('Done with task', param_model=DoneResult)async def done(params: DoneResult):result = ActionResult(is_done=True, extracted_content=params.model_dump_json())@@ -39,7 +38,7 @@ async def done(params: DoneResult):async def main():task = 'Go to hackernews show hn and give me the number 1 post in the list'model = ChatOpenAI(model='gpt-4o')- agent = Agent(task=task, llm=model, controller=controller, validate_output=True)+ agent = Agent(task=task, llm=model, controller=controller)history = await agent.run()diff --git a/examples/validate_output.py b/examples/validate_output.pyindex ad06d3b58..62f92d66b 100644--- a/examples/validate_output.py+++ b/examples/validate_output.py@@ -44,8 +44,8 @@ async def main():task = 'Go to hackernews hn and give me the top 1 post'model = ChatOpenAI(model='gpt-4o')agent = Agent(task=task, llm=model, controller=controller, validate_output=True)-- await agent.run()+ # NOTE: this should fail to demonstrate the validator+ await agent.run(max_steps=5)if __name__ == '__main__':