Skip to content

Update to use create_agent factory pattern#7

Merged
wu-changxing merged 1 commit intomainfrom
update-host-pattern
Feb 27, 2026
Merged

Update to use create_agent factory pattern#7
wu-changxing merged 1 commit intomainfrom
update-host-pattern

Conversation

@wu-changxing
Copy link
Copy Markdown
Contributor

Updates browser-agent to follow the host.md pattern using create_agent() factory.

Changes

  • Convert module-level agent instantiation to create_agent() function in agent.py
  • Update main.py to pass create_agent to host() instead of agent instance
  • Add textual>=0.60.0 to requirements.txt (required by connectonion TUI)

Benefits

  • Each HTTP/WebSocket request gets a fresh agent instance
  • Proper isolation between requests
  • Follows ConnectOnion host() best practices

Testing

  • ✅ Tested python main.py - server starts successfully
  • ✅ Agent initializes correctly with 24 tools
  • ✅ WebSocket and HTTP endpoints working

- Convert module-level agent instantiation to create_agent() function
- Update main.py to pass create_agent to host() instead of agent instance
- Add textual>=0.60.0 to requirements.txt (required by connectonion TUI)

This follows the host.md pattern where each request gets a fresh agent
instance for proper isolation.
Copy link
Copy Markdown
Contributor Author

@wu-changxing wu-changxing left a comment

Choose a reason for hiding this comment

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

LGTM

@wu-changxing wu-changxing merged commit ba8df3a into main Feb 27, 2026
1 check failed
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