Hi,
I’m using computer-use-preview model and PlayWright to control a local browser. I’m inherting the AsynComputer implementation to create a LocalPlaywrightComputer that is passed to an agent as:
cua_prompt = read_prompt("cua_agent_prompt.txt") # get the prompt, unimportant the details here
computer: AsyncComputer = LocalPlaywrightComputer()
await computer.__aenter__()
cua_agent = Agent(
name="Browser CUA Agent",
instructions=cua_prompt,
tools=[ComputerTool(computer)],
model="computer-use-preview",
model_settings=ModelSettings(truncation="auto", reasoning={"effort": "medium"}, temperature=0.0),
)
I would like to extend the class LocalPlaywrightComputer to have more functionality (things like “navigate”, “back”, etc). How can I do that? How do I make the model aware of the new methods created?
I understand I could pass function_tools to the agent directly in tools=[…], but I would like to direcly change the computer class.