Skip to content

Commit acea446

Browse files
committed
sdk/python: Support execution environments
1 parent 9e93240 commit acea446

35 files changed

+4154
-20
lines changed

sdk/python/polos/__init__.py

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@
2929
get_workflow,
3030
workflow,
3131
)
32+
from .execution import (
33+
DockerEnvironment,
34+
DockerEnvironmentConfig,
35+
E2BEnvironmentConfig,
36+
EnvironmentInfo,
37+
ExecOptions,
38+
ExecResult,
39+
ExecToolConfig,
40+
ExecutionEnvironment,
41+
GlobOptions,
42+
GrepMatch,
43+
GrepOptions,
44+
LocalEnvironment,
45+
LocalEnvironmentConfig,
46+
SandboxToolsConfig,
47+
SandboxToolsResult,
48+
sandbox_tools,
49+
)
3250
from .features import events, schedules
3351
from .features.events import BatchEventPayload, EventPayload
3452
from .features.schedules import SchedulePayload
@@ -38,7 +56,16 @@
3856
from .runtime.client import ExecutionHandle, PolosClient
3957
from .runtime.queue import Queue, queue
4058
from .runtime.worker import Worker
41-
from .tools.tool import Tool, tool
59+
from .tools.ask_user import AskUserField, AskUserFieldOption, AskUserInput, create_ask_user_tool
60+
from .tools.tool import Tool, ToolApproval, tool
61+
from .tools.web_search import (
62+
WebSearchFunction,
63+
WebSearchOptions,
64+
WebSearchResult,
65+
WebSearchResultItem,
66+
WebSearchToolConfig,
67+
create_web_search_tool,
68+
)
4269
from .types.types import (
4370
AgentConfig,
4471
BatchStepResult,
@@ -76,6 +103,7 @@
76103
"StopConditionContext",
77104
"tool",
78105
"Tool",
106+
"ToolApproval",
79107
"hook",
80108
"HookContext",
81109
"HookResult",
@@ -102,4 +130,32 @@
102130
"WorkflowTimeoutError",
103131
"StepExecutionError",
104132
"BatchWorkflowInput",
133+
# Execution framework
134+
"sandbox_tools",
135+
"SandboxToolsResult",
136+
"SandboxToolsConfig",
137+
"ExecutionEnvironment",
138+
"DockerEnvironment",
139+
"LocalEnvironment",
140+
"DockerEnvironmentConfig",
141+
"E2BEnvironmentConfig",
142+
"LocalEnvironmentConfig",
143+
"ExecToolConfig",
144+
"ExecOptions",
145+
"ExecResult",
146+
"GlobOptions",
147+
"GrepOptions",
148+
"GrepMatch",
149+
"EnvironmentInfo",
150+
# Tools
151+
"create_ask_user_tool",
152+
"AskUserInput",
153+
"AskUserField",
154+
"AskUserFieldOption",
155+
"create_web_search_tool",
156+
"WebSearchToolConfig",
157+
"WebSearchResult",
158+
"WebSearchResultItem",
159+
"WebSearchOptions",
160+
"WebSearchFunction",
105161
]

sdk/python/polos/agents/stop_conditions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ async def max_tokens(ctx: StopConditionContext, config: MaxTokensConfig) -> bool
211211
class MaxStepsConfig(BaseModel):
212212
"""Configuration for max_steps stop condition."""
213213

214-
count: int = 5
214+
count: int = 20
215215

216216

217217
@stop_condition
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
"""Execution framework -- sandbox tools for AI agents.
2+
3+
Provides tools for running commands, reading/writing files, and searching
4+
codebases inside isolated environments (Docker, E2B, Local).
5+
"""
6+
7+
# Main entry point
8+
# Environment implementations
9+
from .docker import DockerEnvironment
10+
from .environment import ExecutionEnvironment
11+
from .local import LocalEnvironment
12+
13+
# Output utilities
14+
from .output import is_binary, parse_grep_output, strip_ansi, truncate_output
15+
from .sandbox_tools import SandboxToolsResult, sandbox_tools
16+
17+
# Security utilities
18+
from .security import assert_safe_path, evaluate_allowlist, is_within_restriction
19+
20+
# Tool factories
21+
from .tools.edit import create_edit_tool
22+
from .tools.exec import create_exec_tool
23+
from .tools.glob import create_glob_tool
24+
from .tools.grep import create_grep_tool
25+
from .tools.read import create_read_tool
26+
from .tools.write import create_write_tool
27+
28+
# Types
29+
from .types import (
30+
DockerEnvironmentConfig,
31+
E2BEnvironmentConfig,
32+
EnvironmentInfo,
33+
ExecOptions,
34+
ExecResult,
35+
ExecToolConfig,
36+
GlobOptions,
37+
GrepMatch,
38+
GrepOptions,
39+
LocalEnvironmentConfig,
40+
SandboxToolsConfig,
41+
)
42+
43+
__all__ = [
44+
# Main entry point
45+
"sandbox_tools",
46+
"SandboxToolsResult",
47+
# Types
48+
"ExecutionEnvironment",
49+
"ExecOptions",
50+
"ExecResult",
51+
"GlobOptions",
52+
"GrepOptions",
53+
"GrepMatch",
54+
"EnvironmentInfo",
55+
"DockerEnvironmentConfig",
56+
"E2BEnvironmentConfig",
57+
"LocalEnvironmentConfig",
58+
"ExecToolConfig",
59+
"SandboxToolsConfig",
60+
# Environments
61+
"DockerEnvironment",
62+
"LocalEnvironment",
63+
# Security
64+
"evaluate_allowlist",
65+
"assert_safe_path",
66+
"is_within_restriction",
67+
# Output
68+
"truncate_output",
69+
"is_binary",
70+
"parse_grep_output",
71+
"strip_ansi",
72+
# Tool factories
73+
"create_exec_tool",
74+
"create_read_tool",
75+
"create_write_tool",
76+
"create_edit_tool",
77+
"create_glob_tool",
78+
"create_grep_tool",
79+
]

0 commit comments

Comments
 (0)