Skip to content

Commit 144d901

Browse files
authored
refactor: Remove write_to_csv skill and related tests (#36)
## Summary Removes the specialized `write_to_csv` skill in favor of using ADK's built-in `create_artifact` tool. The `take_screenshot` skill now saves files locally and returns file paths instead of automatically creating artifacts. This promotes better separation of concerns - skills handle browser automation while the agent uses `create_artifact` for making files downloadable. ## Changes ### Removed - **write_to_csv skill** and all related tests (`skills/write_to_csv.go`, `skills/write_to_csv_test.go`) - Automatic artifact creation logic from `take_screenshot` skill ### Modified - **take_screenshot skill**: Now saves screenshots to local filesystem and returns the file path instead of automatically creating artifacts - **Agent system prompt**: Updated to include instructions for using `create_artifact` tool with screenshots and data extraction - **Main server initialization**: - Changed from `NewDefaultToolBox()` to `NewToolBox()` + `WithDefaultToolBox()` pattern - Added `ArtifactService` initialization and configuration - Updated server builder to use `WithArtifactService` instead of `WithArtifactStorage` - **Dependencies**: Upgraded ADK from v0.14.0 to v0.15.0 ### Benefits - **Better separation of concerns**: Skills focus on their core functionality (browser automation), artifact creation is handled by the agent - **More flexible**: Users can choose whether to create artifacts or just work with local files - **Reduced code duplication**: Removes specialized artifact handling from individual skills - **Consistent pattern**: All file creation now follows the same pattern: skill creates file → agent uses `create_artifact` to make it downloadable ## Test Plan - [x] Removed tests for `write_to_csv` skill - [x] Updated `take_screenshot` tests to validate file path return instead of artifact creation - [x] Manual testing: Verify screenshots can be taken and then converted to artifacts using `create_artifact` tool - [ ] Manual testing: Verify data extraction → CSV conversion → artifact creation workflow ## Migration Notes For users upgrading to this version: - The `write_to_csv` skill is no longer available - To create CSV files, use data extraction combined with the `create_artifact` tool - Screenshots now return file paths; use `create_artifact` to make them downloadable --------- Signed-off-by: Eden Reich <eden.reich@gmail.com>
1 parent 3b6d3be commit 144d901

19 files changed

Lines changed: 136 additions & 754 deletions

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.releaserc.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.well-known/agent-card.json

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AGENTS.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This agent is built using the Agent Definition Language (ADL) and provides A2A c
3030

3131

3232

33-
**System Prompt**: You are an expert Playwright browser automation assistant. Your primary role is to help users automate web browser tasks efficiently and reliably.
33+
**System Prompt**: You are an expert Playwright browser automation assistant with the ability to create downloadable artifacts. Your primary role is to help users automate web browser tasks efficiently and reliably.
3434

3535
Your core capabilities include:
3636
1. **Web Navigation**: Navigate to URLs, handle redirects, and manage page loads
@@ -41,6 +41,7 @@ Your core capabilities include:
4141
6. **JavaScript Execution**: Run custom scripts in the browser context
4242
7. **Authentication Handling**: Manage various authentication methods
4343
8. **Synchronization**: Wait for specific conditions and handle dynamic content
44+
9. **Artifact Creation**: Create downloadable files for screenshots, extracted data, and CSV exports
4445

4546
Key expertise areas:
4647
- Modern web technologies (SPA, dynamic content, AJAX)
@@ -63,6 +64,11 @@ When helping users:
6364
- Provide clear explanations of automation steps
6465
- Optimize for speed while maintaining reliability
6566

67+
**IMPORTANT - Artifact Creation**:
68+
When users request screenshots, the take_screenshot tool automatically creates downloadable artifacts. The screenshot will be available via a download URL returned in the response.
69+
70+
For data extraction, you can use the create_artifact tool to save extracted data as downloadable files (JSON/CSV/TXT).
71+
6672
Your automation solutions should be maintainable, efficient, and production-ready.
6773

6874

@@ -75,7 +81,7 @@ Your automation solutions should be maintainable, efficient, and production-read
7581
## Skills
7682

7783

78-
This agent provides 9 skills:
84+
This agent provides 8 skills:
7985

8086

8187
### navigate_to_url
@@ -134,13 +140,6 @@ This agent provides 9 skills:
134140
- **Output Schema**: Defined in agent configuration
135141

136142

137-
### write_to_csv
138-
- **Description**: Write structured data to CSV files with support for custom headers and file paths
139-
- **Tags**: export, csv, data, file
140-
- **Input Schema**: Defined in agent configuration
141-
- **Output Schema**: Defined in agent configuration
142-
143-
144143

145144

146145
## Server Configuration
@@ -246,11 +245,6 @@ curl -X POST http://localhost:8080/skills/wait_for_condition \
246245
-H "Content-Type: application/json" \
247246
-d '{"input": "your_input_here"}'
248247

249-
# Execute write_to_csv skill
250-
curl -X POST http://localhost:8080/skills/write_to_csv \
251-
-H "Content-Type: application/json" \
252-
-d '{"input": "your_input_here"}'
253-
254248

255249
```
256250

@@ -298,8 +292,6 @@ docker run -p 8080:8080 browser-agent
298292
299293
│ └── wait_for_condition.go # Wait for specific conditions before proceeding with automation
300294
301-
│ └── write_to_csv.go # Write structured data to CSV files with support for custom headers and file paths
302-
303295
├── .well-known/ # Agent configuration
304296
│ └── agent-card.json # Agent metadata
305297
├── go.mod # Go module definition

CLAUDE.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ browser-agent is an A2A (Agent-to-Agent) server implementing the [A2A Protocol](
1010

1111
### ADL-Generated Structure
1212

13-
The codebase is generated using ADL CLI 0.23.2 and follows a strict generation pattern:
13+
The codebase is generated using ADL CLI 0.23.6 and follows a strict generation pattern:
1414
- **Generated Files**: Marked with `DO NOT EDIT` headers - manual changes will be overwritten
1515
- **Configuration Source**: `agent.yaml` - defines agent capabilities, skills, and metadata
1616
- **Server Implementation**: Built on the ADK (Agent Development Kit) framework from `github.com/inference-gateway/adk`
@@ -82,7 +82,6 @@ The following skills are currently defined:
8282
- **execute_script**: Execute custom JavaScript code in the browser context
8383
- **handle_authentication**: Handle various authentication scenarios including basic auth, OAuth, and custom login forms
8484
- **wait_for_condition**: Wait for specific conditions before proceeding with automation
85-
- **write_to_csv**: Write structured data to CSV files with support for custom headers and file paths
8685

8786
To modify skills:
8887
1. Update `agent.yaml` with skill definitions
@@ -118,7 +117,7 @@ Activate with: `flox activate` (if Flox is installed)
118117

119118
- **Generated Files**: Never manually edit files with "DO NOT EDIT" headers
120119
- **Configuration Changes**: Always modify `agent.yaml` and regenerate
121-
- **ADL Version**: Ensure ADL CLI 0.23.2 or compatible version for regeneration
120+
- **ADL Version**: Ensure ADL CLI 0.23.6 or compatible version for regeneration
122121
- **Port Configuration**: Default 8080, configurable via `A2A_PORT` or `A2A_SERVER_PORT`
123122

124123
## Debugging Tips

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ docker run -p 8080:8080 browser-agent
4949
| `execute_script` | Execute custom JavaScript code in the browser context |args, return_value, script |
5050
| `handle_authentication` | Handle various authentication scenarios including basic auth, OAuth, and custom login forms |login_url, password, password_selector, submit_selector, type, username, username_selector |
5151
| `wait_for_condition` | Wait for specific conditions before proceeding with automation |condition, custom_function, selector, state, timeout |
52-
| `write_to_csv` | Write structured data to CSV files with support for custom headers and file paths |append, data, filename, headers, include_headers |
5352

5453
## Configuration
5554

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agent.yaml

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -310,50 +310,12 @@ spec:
310310
inject:
311311
- logger
312312
- playwright
313-
- id: write_to_csv
314-
name: write_to_csv
315-
description: Write structured data to CSV files with support for custom headers and file paths
316-
tags:
317-
- export
318-
- csv
319-
- data
320-
- file
321-
schema:
322-
type: object
323-
properties:
324-
data:
325-
type: array
326-
items:
327-
type: object
328-
description: Array of objects to write to CSV, each object represents a row
329-
filename:
330-
type: string
331-
description: Name of the CSV file (without path, will be saved to configured data directory)
332-
headers:
333-
type: array
334-
items:
335-
type: string
336-
description: Custom column headers for the CSV file (optional, will use object keys if not provided)
337-
append:
338-
type: boolean
339-
description: Whether to append to existing file or create new file
340-
default: false
341-
include_headers:
342-
type: boolean
343-
description: Whether to include headers in the CSV output
344-
default: true
345-
required:
346-
- data
347-
- filename
348-
inject:
349-
- logger
350-
- playwright
351313
agent:
352314
provider: ""
353315
model: ""
354316
systemPrompt: |
355-
You are an expert Playwright browser automation assistant. Your primary role is to help users automate web browser tasks efficiently and reliably.
356-
317+
You are an expert Playwright browser automation assistant with the ability to create downloadable artifacts. Your primary role is to help users automate web browser tasks efficiently and reliably.
318+
357319
Your core capabilities include:
358320
1. **Web Navigation**: Navigate to URLs, handle redirects, and manage page loads
359321
2. **Element Interaction**: Click buttons, fill forms, select dropdowns, and interact with any web element
@@ -363,7 +325,8 @@ spec:
363325
6. **JavaScript Execution**: Run custom scripts in the browser context
364326
7. **Authentication Handling**: Manage various authentication methods
365327
8. **Synchronization**: Wait for specific conditions and handle dynamic content
366-
328+
9. **Artifact Creation**: Create downloadable files for screenshots, extracted data, and CSV exports
329+
367330
Key expertise areas:
368331
- Modern web technologies (SPA, dynamic content, AJAX)
369332
- Selector strategies (CSS, XPath, text, accessibility)
@@ -375,7 +338,7 @@ spec:
375338
- File uploads and downloads
376339
- Network interception and modification
377340
- Mobile and responsive testing
378-
341+
379342
When helping users:
380343
- Always use robust selectors that won't break easily
381344
- Implement proper wait strategies for dynamic content
@@ -384,7 +347,12 @@ spec:
384347
- Consider accessibility and best practices
385348
- Provide clear explanations of automation steps
386349
- Optimize for speed while maintaining reliability
387-
350+
351+
**IMPORTANT - Artifact Creation**:
352+
When users request screenshots, the take_screenshot tool automatically creates downloadable artifacts. The screenshot will be available via a download URL returned in the response.
353+
354+
For data extraction, you can use the create_artifact tool to save extracted data as downloadable files (JSON/CSV/TXT).
355+
388356
Your automation solutions should be maintainable, efficient, and production-ready.
389357
services:
390358
playwright:

config/config.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)