Skip to content

Implement Python SDK with PulsarSession, AgenticSession, and WebDriver APIs#175

Merged
galaxyeye merged 3 commits into4.4.xfrom
copilot/implement-python-sdk
Jan 9, 2026
Merged

Implement Python SDK with PulsarSession, AgenticSession, and WebDriver APIs#175
galaxyeye merged 3 commits into4.4.xfrom
copilot/implement-python-sdk

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 9, 2026

Python SDK implementation mirroring Kotlin interfaces (PulsarSession, AgenticSession, WebDriver) for Browser4, communicating via OpenAPI protocol.

Changes

Core Classes

  • PulsarSession: Page loading (open, load, submit), URL normalization, CSS-based extraction
  • AgenticSession: Extends PulsarSession with AI-powered automation (act, run, observe, summarize, agent_extract)
  • WebDriver: Browser control—navigation, scrolling, element interaction, script execution, screenshots

Data Models

  • WebPage, NormURL, PageSnapshot for page results
  • AgentRunResult, AgentActResult, ObserveResult, ExtractionResult for agent operations
  • PageEventHandlers placeholder for future event mechanism

Tests: 28 unit tests covering all major functionality

Usage

from pulsar_sdk import PulsarClient, AgenticSession

client = PulsarClient(base_url="http://localhost:8182")
client.create_session()
session = AgenticSession(client)

# PulsarSession operations
page = session.open("https://example.com")
fields = session.extract(page, {"title": "h1", "links": "a[href]"})

# Agentic operations
result = session.act("click the search button")
history = session.run("search for 'python' and click first result")

# WebDriver access
session.driver.scroll_to_bottom()
text = session.driver.select_first_text_or_null("h1")

session.close()

API Consistency

Python methods use snake_case with Kotlin-style aliases (process_trace / processTrace, final_result / finalResult).

Original prompt

实现 python SDK。Python SDK 基于 openapi 协议与 browser4 通讯。调用方式参考FusedActs。Python 中以下接口同 Kotlin 保持尽可能一致:PulsarSession/AgenticSession/WebDriver。预留事件机制(PageEventHandlers),在后面的任务中完成。


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 9, 2026 09:34
…, and WebDriver APIs

Co-authored-by: galaxyeye <1701451+galaxyeye@users.noreply.github.com>
Co-authored-by: galaxyeye <1701451+galaxyeye@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement Python SDK based on OpenAPI protocol Implement Python SDK with PulsarSession, AgenticSession, and WebDriver APIs Jan 9, 2026
Copilot AI requested a review from galaxyeye January 9, 2026 09:40
@galaxyeye galaxyeye marked this pull request as ready for review January 9, 2026 11:39
@galaxyeye galaxyeye merged commit f01febf into 4.4.x Jan 9, 2026
@galaxyeye galaxyeye deleted the copilot/implement-python-sdk branch February 9, 2026 05:49
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.

2 participants