Files
magnus919_agent-skills/autogen/templates/code-execution.py
Magnus Hedemark 5428b18ddd feat: add autogen — expert skill for conversational multi-agent AI
Greenfield SkillOpt: 3 epochs for Microsoft AutoGen skill.
Conversational agent model, GroupChat patterns, code execution,
nested chats, cancellation tokens, MCP integration.

All API surfaces validated against microsoft.github.io/autogen docs.
2026-07-09 14:57:27 -04:00

24 lines
1011 B
Python

#!/usr/bin/env python3
"""Agent with Docker code execution."""
import asyncio
from autogen_agentchat.agents import AssistantAgent, UserProxyAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.code_executors.docker import DockerCommandLineCodeExecutor
async def main():
model_client = OpenAIChatCompletionClient(model="gpt-4o-mini")
async with DockerCommandLineCodeExecutor(work_dir="coding") as executor:
assistant = AssistantAgent(name="assistant", model_client=model_client,
system_message="Write Python code to solve problems.")
proxy = UserProxyAgent(name="proxy", code_executor=executor,
human_input_mode="NEVER")
team = RoundRobinGroupChat([assistant, proxy])
result = await team.run(task="Calculate pi to 10 decimal places using Python")
print(result.messages[-1].content)
asyncio.run(main())