Skip to content

Autogen adapter - #112

Open
Shahid-Musabbar wants to merge 2 commits into
open-gitagent:mainfrom
Shahid-Musabbar:autogen-adapter
Open

Shahid-Musabbar wants to merge 2 commits into
open-gitagent:mainfrom
Shahid-Musabbar:autogen-adapter

Conversation

@Shahid-Musabbar

Copy link
Copy Markdown

##What
Adds an AutoGen adapter (autogen-agentchat >= 0.4), following the pattern of the existing adapters.

  • opengap export -f autogen generates a standalone Python script.
  • opengap run -a autogen generates the script and runs it with the local Python interpreter (python3, python or py). It also works through the git runner.
  • With no sub-agents, the script is a single AssistantAgent.
  • With sub-agents, the main agent and every entry under agents: become AssistantAgents in a SelectorGroupChat. The main agent owns the request and consults specialists. The run ends when a message contains TERMINATE or at runtime.max_turns (default 20).
  • Sub-agents can be full agents (agents/<name>/agent.yaml) or lightweight ones (a description plus an optional SOUL.md). Each uses its own model if it sets one.
  • Tools from tools/*.yaml become FunctionTools. The function bodies are placeholders, since tool yamls only describe the interface.
  • The model client is chosen from the model name or a provider/model prefix: openai, azure, anthropic, ollama, gemini or llama. Clients are imported lazily, so only the extra for the provider in use needs installing.
  • Registered in export, run and the git runner. README, docs and the package.json keywords are updated.
  • Adds src/adapters/autogen.test.ts, which covers the single-agent and team output, sub-agent descriptions and souls, selector prompt placeholders, tools, model default, the prompt override and identifier sanitising.

Why

AutoGen is a widely used multi-agent framework, and gitagent's sub-agent definitions map cleanly onto SelectorGroupChat.

The selector prompt and coordinator instructions are deliberately general. The main agent is treated as the owner of the task, and sub-agents are helpers it consults, not a planner handing out assignments. Specialists are chosen by their descriptions, so a main agent that does one job and uses other agents as tools also works.

I tried this with a hotel-helpdesk agent and a reservations sub-agent. A check-in/check-out question was routed to the sub-agent instead of being answered by the main agent directly.

Note: a description under the parent's agents: map overrides the sub-agent's own agent.yaml description. This is existing behaviour that other adapters share, not something this PR changes.

Closes the Autogen part of the issue #3

How Tested

  • npm run build passes
  • gitagent validate passes on example agents
  • Manual testing (describe below)

Added autogen.test.ts file with the tests conducted.

Checklist

  • My code follows the existing style of this project
  • I have added/updated tests (if applicable)
  • I have updated documentation (if applicable)
  • I have read the CONTRIBUTING.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant