Example of running code generated by autogen via E2B sandbox
This code interpreter uses AutoGen agents to define new functions with natural language. In this example, the agents are given a task to define a function that gets a URL, then prints the response body. The output of this function is then executed in the remote cloud environment, using E2B sandbox.
This example shows the workflow without human (end-user) input, but you can change this setting by changing the human_input_mode parameter. To modify the task in this example by modifying the user_proxy messages.

- Clone this repository
- Open the e2b-cookbook/guides/e2b_autogen directory
- Install dependencies:
poetry install- Rename
.env.exampleto.envand set up theOPENAI_API_KEYkey and theE2B_API_KEYkey. You can getE2B_API_KEYat https://e2b.dev/docs/getting-started/api-key - Run
poetry run demoto launch the demo orpoetry run mainto drop into an interactive session
If you want to build on top of this example, feel free to make a PR to this cookbook. Or discuss your idea with us via hello@e2b.dev.
