Replies: 1 comment 2 replies
-
Hello Harry, We’ve just released a new Autogen extension that allows you to use YepCode as a remote sandbox execution environment. The package is now available on PyPI, and here’s a quick example to show you how to get started: import asyncio
import os
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.tools.code_execution import PythonCodeExecutionTool
from autogen_ext_yepcode import YepCodeCodeExecutor
async def main():
# Create OpenAI model client
model_client = OpenAIChatCompletionClient(
model="gpt-4",
api_key=os.getenv("OPENAI_API_KEY"),
)
# Initialize YepCode executor
yepcode_executor = YepCodeCodeExecutor(
timeout=120,
remove_on_done=False,
sync_execution=True,
)
# Start the executor
await yepcode_executor.start()
# Create a PythonCodeExecutionTool with the YepCode executor
code_tool = PythonCodeExecutionTool(executor=yepcode_executor)
# Create an AssistantAgent with the code execution tool
assistant = AssistantAgent(
name="assistant",
model_client=model_client,
tools=[code_tool],
)
# Run a task that requires code execution
task = "Calculate the sum of squares for numbers 1 to 10. Show the calculation step by step using Python code."
result = await assistant.run(task=task)
print(f"Result: {result}")
# Clean up
await yepcode_executor.stop()
await model_client.close()
if __name__ == "__main__":
asyncio.run(main()) Let me know if you have any questions or feedback—we’d love to hear what you think! Best regards, |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Does anyone know how to use Autogen Studio with hosted code interpreter like E2B: https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/autogen-python?
Thanks,
Harry
Beta Was this translation helpful? Give feedback.
All reactions