mirror of
https://github.com/usestrix/strix.git
synced 2026-09-13 23:11:07 +00:00
fix: debug + some rebase
This commit is contained in:
parent
32a4397066
commit
7e63b2411a
4 changed files with 3166 additions and 466 deletions
|
|
@ -33,7 +33,7 @@ classifiers = [
|
|||
"Programming Language :: Python :: 3.14",
|
||||
]
|
||||
dependencies = [
|
||||
"litellm[proxy]>=1.81.1,<1.82.0",
|
||||
"litellm>=1.81.1",
|
||||
"tenacity>=9.0.0",
|
||||
"pydantic[email]>=2.11.3",
|
||||
"rich",
|
||||
|
|
@ -46,6 +46,7 @@ dependencies = [
|
|||
"opentelemetry-exporter-otlp-proto-http>=1.40.0",
|
||||
"scrubadub>=2.0.1",
|
||||
"defusedxml>=0.7.1",
|
||||
"browser-use>=0.12.2",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
import os
|
||||
|
||||
from strix.config import Config
|
||||
|
||||
from .agents_graph import * # noqa: F403
|
||||
from .browser import * # noqa: F403
|
||||
from .executor import (
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import asyncio
|
||||
import base64
|
||||
import contextlib
|
||||
import logging
|
||||
import re
|
||||
from functools import partial
|
||||
|
|
@ -101,6 +102,28 @@ async def _execute_task(session: BrowserSession, operation: Any, desc: str) -> d
|
|||
}
|
||||
|
||||
|
||||
async def _on_step_start(agent: Any) -> None:
|
||||
step = agent.state.n_steps + 1
|
||||
url = "unknown"
|
||||
with contextlib.suppress(Exception):
|
||||
url = await agent.browser_session.get_current_page_url()
|
||||
logger.info("Browser step %d starting — url=%s", step, url)
|
||||
|
||||
|
||||
async def _on_step_end(agent: Any) -> None:
|
||||
step = agent.state.n_steps
|
||||
output = agent.state.last_model_output
|
||||
next_goal = getattr(output, "next_goal", "") or "" if output else ""
|
||||
actions = getattr(output, "action", []) or [] if output else []
|
||||
action_names = [next(iter(a.model_dump(exclude_unset=True)), "?") for a in actions]
|
||||
logger.info(
|
||||
"Browser step %d completed — actions=%s goal=%s",
|
||||
step,
|
||||
action_names,
|
||||
next_goal[:120],
|
||||
)
|
||||
|
||||
|
||||
async def _run_browser_agent(
|
||||
session: BrowserSession,
|
||||
task: str,
|
||||
|
|
@ -123,7 +146,10 @@ async def _run_browser_agent(
|
|||
use_vision=vision,
|
||||
)
|
||||
|
||||
result = await agent.run()
|
||||
result = await agent.run(
|
||||
on_step_start=_on_step_start,
|
||||
on_step_end=_on_step_end,
|
||||
)
|
||||
|
||||
if hasattr(result, "is_successful") and not result.is_successful():
|
||||
final_result = (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue