Skip to content

Unable to use recursive=True on watch_dir for beta version with persistence #676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
suhjohn opened this issue Apr 10, 2025 · 5 comments
Open
Labels
bug Something isn't working

Comments

@suhjohn
Copy link

suhjohn commented Apr 10, 2025

    |   File "/Users/johnsuh/code/internal-chat/backend/.venv/lib/python3.12/site-packages/starlette/responses.py", line 253, in wrap
    |     await func()
    |   File "/Users/johnsuh/code/internal-chat/backend/.venv/lib/python3.12/site-packages/starlette/responses.py", line 242, in stream_response
    |     async for chunk in self.body_iterator:
    |   File "/Users/johnsuh/code/internal-chat/backend/app/services/conversation_service.py", line 363, in create_message_service
    |     raise e
    |   File "/Users/johnsuh/code/internal-chat/backend/app/services/conversation_service.py", line 340, in create_message_service
    |     async for res in fn(db, context):
    |   File "/Users/johnsuh/code/internal-chat/backend/app/services/pipelines/handlers.py", line 315, in yield_agentic_anthropic
    |     async for response in yield_step(
    |   File "/Users/johnsuh/code/internal-chat/backend/app/services/pipelines/handlers.py", line 351, in yield_step
    |     file_watch_handler = await sandbox.files.watch_dir(
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^
    | TypeError: Filesystem.watch_dir() got an unexpected keyword argument 'recursive'

on + e2b-code-interpreter==1.2.0b1

@suhjohn suhjohn added the bug Something isn't working label Apr 10, 2025
Copy link

linear bot commented Apr 10, 2025

@ValentaTomas
Copy link
Member

Hey @suhjohn, can you try updating to version https://pypi.org/project/e2b-code-interpreter/1.2.0b2/ ?

@suhjohn
Copy link
Author

suhjohn commented Apr 10, 2025

Amazing. Thank you

@suhjohn
Copy link
Author

suhjohn commented Apr 10, 2025

actually - I think there might be a regression unless the specs changed:


    async def handle_event(event: FilesystemEvent):  # type: ignore
        print(f"[handlers.py::yield_step] Filesystem event: {to_json_dict(event)}")  # type: ignore

    await sandbox.commands.run(
        f"mkdir -p /home/user/{agent_context['conversation_id']}"
    )
    file_watch_handler = await sandbox.files.watch_dir(
        f"/home/user/{agent_context['conversation_id']}",
        on_event=handle_event,
        recursive=True,
    )

This code used to work, but now it's not printing anything.

@suhjohn
Copy link
Author

suhjohn commented Apr 10, 2025

Actually, just figured out a way to write a version of it on my own using cli commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants