Skip to content

Commit 82e2500

Browse files
committed
fix: initialize mcp tools in session w simpler code
chore: revert original prompts codeact chore: re-add system prompt chore: remove playwright mcp custom chore: remove unused
1 parent a1de26e commit 82e2500

File tree

19 files changed

+28
-207
lines changed

19 files changed

+28
-207
lines changed

frontend/src/services/actions.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ const messageActions = {
3131
store.dispatch(addAssistantMessage(message.message));
3232
}
3333
},
34-
[ActionType.PLAYWRIGHT_MCP_BROWSER_SCREENSHOT]: (message: ActionMessage) => {
35-
if (!message.args.thought && message.message) {
36-
store.dispatch(addAssistantMessage(message.message));
37-
}
38-
},
3934
[ActionType.WRITE]: (message: ActionMessage) => {
4035
const { path, content } = message.args;
4136
store.dispatch(setActiveFilepath(path));

frontend/src/services/observations.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export function handleObservationMessage(message: ObservationMessage) {
3131
break;
3232
case ObservationType.BROWSE:
3333
case ObservationType.BROWSE_INTERACTIVE:
34-
case ObservationType.PLAYWRIGHT_MCP_BROWSER_SCREENSHOT:
3534
if (message.extras?.screenshot) {
3635
store.dispatch(setScreenshotSrc(message.extras?.screenshot));
3736
}
@@ -220,19 +219,6 @@ export function handleObservationMessage(message: ObservationMessage) {
220219
}),
221220
);
222221
break;
223-
case ObservationType.PLAYWRIGHT_MCP_BROWSER_SCREENSHOT:
224-
store.dispatch(
225-
addAssistantObservation({
226-
...baseObservation,
227-
observation: ObservationType.PLAYWRIGHT_MCP_BROWSER_SCREENSHOT,
228-
extras: {
229-
url: String(message.extras.url || ""),
230-
screenshot: String(message.extras.screenshot || ""),
231-
trigger_by_action: String(message.extras.trigger_by_action || ""),
232-
},
233-
}),
234-
);
235-
break;
236222
case "error":
237223
store.dispatch(
238224
addAssistantObservation({

frontend/src/types/action-type.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ enum ActionType {
3838

3939
// Changes the state of the agent, e.g. to paused or running
4040
CHANGE_AGENT_STATE = "change_agent_state",
41-
42-
// Take a screenshot of the browser
43-
PLAYWRIGHT_MCP_BROWSER_SCREENSHOT = "playwright_mcp_browser_screenshot",
4441
}
4542

4643
export default ActionType;

frontend/src/types/core/base.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ export type OpenHandsEventType =
1212
| "reject"
1313
| "think"
1414
| "finish"
15-
| "error"
16-
| "playwright_mcp_browser_screenshot";
15+
| "error";
1716

1817
interface OpenHandsBaseEvent {
1918
id: number;

frontend/src/types/core/observations.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { AgentState } from "../agent-state";
2-
import ObservationType from "../observation-type";
32
import { OpenHandsObservationEvent } from "./base";
43

54
export interface AgentStateChangeObservation
@@ -110,15 +109,6 @@ export interface AgentThinkObservation
110109
};
111110
}
112111

113-
export interface PlaywrightMcpBrowserScreenshotObservation
114-
extends OpenHandsObservationEvent<ObservationType.PLAYWRIGHT_MCP_BROWSER_SCREENSHOT> {
115-
source: "agent";
116-
extras: {
117-
url: string;
118-
screenshot: string;
119-
trigger_by_action: string;
120-
};
121-
}
122112
export type OpenHandsObservation =
123113
| AgentStateChangeObservation
124114
| AgentThinkObservation
@@ -130,5 +120,4 @@ export type OpenHandsObservation =
130120
| WriteObservation
131121
| ReadObservation
132122
| EditObservation
133-
| ErrorObservation
134-
| PlaywrightMcpBrowserScreenshotObservation;
123+
| ErrorObservation;

frontend/src/types/observation-type.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ enum ObservationType {
1111
// Interactive browsing
1212
BROWSE_INTERACTIVE = "browse_interactive",
1313

14-
PLAYWRIGHT_MCP_BROWSER_SCREENSHOT = 'playwright_mcp_browser_screenshot',
15-
1614
// The output of a command
1715
RUN = "run",
1816

openhands/agenthub/codeact_agent/function_calling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ def response_to_actions(response: ModelResponse) -> list[Action]:
205205
action = McpAction(
206206
name=tool_call.function.name, arguments=tool_call.function.arguments
207207
)
208-
action.set_hard_timeout(120)
209-
logger.warning(f'MCP action in function_calling.py: {action}')
208+
# action.set_hard_timeout(120)
209+
logger.debug(f'MCP action in function_calling.py: {action}')
210210

211211
# We only add thought to the first action
212212
if i == 0:

openhands/agenthub/codeact_agent/prompts/system_prompt.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
You are Thesis Capsule agent, a helpful AI assistant that can interact with a computer to solve tasks.
1+
You are OpenHands agent, a helpful AI assistant that can interact with a computer to solve tasks.
22

33
<ROLE>
44
Your primary role is to assist users by executing commands, modifying code, and solving technical problems effectively. You should be thorough, methodical, and prioritize quality over speed.
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
You are Thesis Capsule agent, a helpful AI assistant that can interact with a computer to solve tasks.
2-
3-
<PROBLEM_SOLVING_WORKFLOW>
4-
Take screenshot of important actions you take related to web-browsing.
5-
</PROBLEM_SOLVING_WORKFLOW>

openhands/core/schema/observation.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,3 @@ class ObservationType(str, Enum):
5252

5353
MCP = 'mcp'
5454
"""Result of a MCP Server operation"""
55-
56-
PLAYWRIGHT_MCP_BROWSER_SCREENSHOT = 'playwright_mcp_browser_screenshot'
57-
"""Result of a Playwright MCP Browser Screenshot operation. The response is a base64 encoded string of the screenshot, which should be streamed to the client using the correct format matching
58-
browsergym's screenshot format."""

0 commit comments

Comments
 (0)