feature: add start_service and get_service_logs for background processes#8
Open
hjpinheiro wants to merge 1 commit into
Open
feature: add start_service and get_service_logs for background processes#8hjpinheiro wants to merge 1 commit into
hjpinheiro wants to merge 1 commit into
Conversation
Two new tools for running long-lived processes in sandboxes: - start_service: start a background command (web server, daemon) using async session execution. Returns session_id and cmd_id for later log retrieval. The command runs asynchronously — returns immediately. - get_service_logs: retrieve stdout/stderr from a background service. Auto-discovers cmd_id from the session if not provided. This solves the problem of run_command timing out on long-running servers. Instead of blocking, the agent starts the service, then polls logs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two new tools for running long-lived processes (web servers, daemons, build watchers) in sandboxes:
start_serviceprocess.create_session()+execute_session_command(var_async=True)get_service_logsprocess.get_session_command_logs()Problem solved
run_commandblocks until the command completes. This makes it impossible to start web servers, API servers, or any long-running process — the tool times out or blocks indefinitely.start_servicesolves this by executing commands withvar_async=True, which returns immediately with asession_idandcmd_id. The agent can then pollget_service_logsto check progress.Design
start_service:
var_async=Truesession_id+cmd_idfor log retrievalsandbox_id(required),command(required)get_service_logs:
cmd_idfrom the session if not provided (fallback viaget_session())sandbox_id(required),session_id(required),cmd_id(optional)Example workflow
Testing
.pyfiles passpy_compile.yamlfiles passyaml.safe_loadprovider/daytona.yamlvalidates with 9 total tools (7 original + 2 new)