mirror of
https://github.com/magnus919/agent-skills.git
synced 2026-09-12 12:06:29 +03:00
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.
24 lines
1011 B
Python
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())
|