Skip to content

Commit 93d0b16

Browse files
committed
deploys work
1 parent 4d78b35 commit 93d0b16

File tree

11 files changed

+629
-30
lines changed

11 files changed

+629
-30
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
workflow_dispatch: {}
77

88
jobs:
@@ -25,11 +25,11 @@ jobs:
2525
- name: Setup bun
2626
uses: oven-sh/setup-bun@v2
2727
with:
28-
bun-version: 'latest'
28+
bun-version: "latest"
2929

3030
- uses: extractions/setup-just@v3
3131
with:
32-
just-version: '1.40.0'
32+
just-version: "1.40.0"
3333

3434
- name: Python deps cache
3535
uses: actions/cache@v4
@@ -41,14 +41,12 @@ jobs:
4141
run: uv sync --frozen
4242

4343
- name: Lint & format (ruff)
44-
run: just lint
44+
run: uv run ruff check --fix && uv run ruff format
4545

4646
- name: Deploy via Kernel CLI
4747
run: |
48-
just deploy \
48+
bunx -p @onkernel/cli kernel deploy src/app.py \
4949
-e AI_GATEWAY_URL=${{ secrets.AI_GATEWAY_URL }} \
5050
-e AI_GATEWAY_TOKEN=${{ secrets.AI_GATEWAY_TOKEN }}
5151
env:
5252
KERNEL_API_KEY: ${{ secrets.KERNEL_API_KEY }}
53-
54-
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[tools]
22
bun = "1.2"
33
just = "1.40"
4-
python = "3.13.7"
4+
python = "3.11"

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Notes
2+
3+
Entrypoint (main.py) must be in the root directory

justfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ gemini *args:
1414
bunx @google/gemini-cli {{args}}
1515

1616
kernel *args:
17-
bunx -p @onkernel/cli kernel {{args}}
18-
19-
deploy *args:
20-
just kernel deploy src/app.py {{args}}
17+
bunx --bun -p @onkernel/cli kernel {{args}}
2118

2219
logs *args:
2320
just kernel logs browser-agent --follow {{args}}

lib/gateway.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from os import environ as env
2+
3+
AI_GATEWAY_URL = env["AI_GATEWAY_URL"]
4+
AI_GATEWAY_TOKEN = env["AI_GATEWAY_TOKEN"]

src/app.py renamed to main.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,29 @@
1313
logger = logging.getLogger(__name__)
1414

1515

16-
@app.action("browser-agent")
17-
async def browser_agent(ctx: KernelContext, input_data: dict):
18-
request = BrowserAgentRequest(**input_data)
16+
@app.action("perform")
17+
async def perform(ctx: KernelContext, params: dict):
18+
request = BrowserAgentRequest.model_validate(params)
1919
browser = await kernel.browsers.create(
2020
invocation_id=ctx.invocation_id,
2121
stealth=True,
2222
headless=False,
2323
timeout=60,
2424
)
25-
logger.info(f"Created browser [live view: {browser.browser_live_view_url}]")
25+
logger.info(f"Created browser {browser.browser_live_view_url}")
2626

2727
agent = Agent(
2828
task=request.task,
2929
llm=request.llm,
3030
browser_session=CustomBrowserSession(cdp_url=browser.cdp_ws_url),
3131
)
3232

33-
trajectory = await agent.run()
34-
33+
trajectory = await agent.run(max_steps=request.max_steps)
3534
duration = trajectory.total_duration_seconds
36-
errors = trajectory.errors()
37-
result = trajectory.final_result()
38-
downloads = agent.browser_session.downloaded_files
3935

40-
if not result:
41-
return dict_of(duration, errors)
36+
if result := trajectory.final_result():
37+
files = agent.browser_session.downloaded_files
38+
return dict_of(duration, result, files)
4239

43-
return dict_of(duration, result, downloads)
40+
errors = trajectory.errors()
41+
return dict_of(duration, errors)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "python-bu"
33
version = "0.1.0"
44
description = "Kernel sample app for Browser Use"
55
readme = "README.md"
6-
requires-python = ">=3.13"
6+
requires-python = ">=3.11"
77
dependencies = [
88
"browser-use>=0.7.2",
99
"kernel>=0.11.0",

src/lib/gateway.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)