Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kalil0321
Copy link
Contributor

@kalil0321 kalil0321 commented Nov 2, 2025

The goal is to create an LLM validator that cleans the code, export it to other frameworks / languages and ideally run it in a small container to check bugs.
For code cleaning, sometimes multiple versions are required for the CodeAgent to generate the code so it is good to have a validator that makes sure we don't have multiple versions for getting the same data.



Summary by cubic

Adds an LLM-powered CodeValidator with sandbox execution and new session export options (Python, Playwright, TypeScript) to improve reliability and make sharing automation scripts easier.

  • New Features

    • Added CodeValidator with structured results (issues, improved code, summary), a SandboxExecutor, and DOM-safe validation rules.
    • session_to_python_script is now async; validates the full script and can auto-apply improvements; preserves JS blocks and fixes escape sequences.
    • New async exports: session_to_playwright_script and session_to_typescript_script with LLM conversion and safe fallbacks.
    • CodeAgent captures browser state for validation before clearing history; init re-exports new helpers and validator classes; docs updated for async usage.
  • Migration

    • session_to_python_script is async. Update calls to: script = await session_to_python_script(agent).
    • Optional validator_llm for all export helpers; set apply_improvements=True to also return an improved script.

Written for commit fd52684. Summary will update automatically on new commits.

@kalil0321 kalil0321 changed the title Add session export options and code validation integration CodeValidator for CodeAgent's generated code Nov 2, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 9 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="browser_use/code_use/validator/system_prompt.md">

<violation number="1" location="browser_use/code_use/validator/system_prompt.md:66">
`document.title` and `document.URL` are always defined (they default to a string even during page load), so stating they may be `undefined` provides incorrect guidance. Please adjust the wording to reflect that they may be empty or stale rather than undefined.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant