How to Install AutoGen for AI Agent Workflows (2026)

Quick answer

To install AutoGen for ai agent workflows, use Python 3.10 or later, create a virtual environment, run pip install -U "autogen-agentchat" "autogen-ext[openai]", set your model API key as an environment variable, then run a first AssistantAgent or a RoundRobinGroupChat team with a clear termination condition. AutoGen itself costs $0 to install. In our worked example, 400 team runs a month cost $24.00 in model usage at official gpt-6.2-sol prices, plus your own machine or server. For a brand-new production system, start with Microsoft Agent Framework instead.

Most small businesses do not need one clever chatbot. They need a small, reviewable workflow: one agent to gather facts, one to check them, and a human to approve what leaves the building. AutoGen, the multi-agent framework from Microsoft Research, was built for that conversation-driven pattern, where agents message each other until a stop condition ends the run.

There is a catch you must know before you install anything. Microsoft has archived AutoGen. The official repository now says the project is no longer maintained, with no bug fixes, security fixes, new features, or support, and it advises against production use. New projects are pointed to Microsoft Agent Framework instead. This guide still shows you how to install AutoGen for ai agent workflows correctly, because many teams already run it and need a safe setup, but it treats the archive warning as part of the install, not a footnote.

Quick Answer

To install AutoGen for ai agent workflows, use Python 3.10 or later, create a virtual environment, run pip install -U "autogen-agentchat" "autogen-ext[openai]", set your model API key as an environment variable, then run a first AssistantAgent or a RoundRobinGroupChat team with a clear termination condition. AutoGen itself costs $0 to install. In our worked example, 400 team runs a month cost $24.00 in model usage at official gpt-6.2-sol prices, plus your own machine or server. For a brand-new production system, start with Microsoft Agent Framework instead.

In this article

  • How we checked this guide
  • Read this first: archived status and licence in plain words
  • What AutoGen replaces, and what it does not
  • How AgentChat, Core, and Extensions fit together
  • Routes: AutoGen, AutoGen Studio, or Microsoft Agent Framework
  • Requirements before you install AutoGen for ai agent workflows
  • Step 1: install Python and the AutoGen packages
  • Step 2: add your model key and run a first agent
  • Step 3: build your first two-agent team
  • Step 4: shape the workflow for real business work
  • Step 5: run it like production, not a demo
  • First-run security steps you must not skip
  • Backup and update routine for an archived project
  • Common errors and fixes
  • Tips and tricks that save money
  • The real cost maths
  • When not to self-host AutoGen
  • Pros and cons
  • Our verdict
  • FAQ
  • Strategic Pivot
  • Sources

How we checked this guide

We verified the install commands, Python requirement, package names, first-agent example, team patterns, Studio limits, and archive warning on the official Microsoft AutoGen GitHub repository and the official AutoGen documentation on December 3, 2026. The licence position comes from the repository LICENSE file checked the same day. The model price in the worked example comes from the official OpenAI pricing page, also checked on December 3, 2026.

Where the official pages set a limit, we say so plainly. AutoGen Studio is described by Microsoft as a research prototype, not a production-ready app. The framework itself is now archived. If a claim could not be verified on an official page, it stays out of this guide. That discipline matters here more than usual, because old tutorials still show v0.2 package names and patterns that no longer match the current AgentChat API.

Read this first: archived status and licence in plain words

Start with the archive notice, because it changes the buying decision. The official AutoGen repository carries an archived badge and a caution that Microsoft is not providing bug fixes, security fixes, new features, or support. The repository remains available for historical and reference purposes. Microsoft warns that vulnerabilities in the project and its dependencies may remain unaddressed, advises careful risk assessment before use with sensitive data, and continues to advise against production use. New users are directed to Microsoft Agent Framework, described as the enterprise-ready successor, and existing users are pointed to a migration guide.

In plain words: you can still install AutoGen, learn from it, and maintain an existing system with your eyes open. You should not start a new customer-facing production system on it and assume Microsoft will patch the next security issue. That single fact is the difference between a sensible AutoGen install and an expensive mistake.

The licence needs the same plain treatment. The repository LICENSE file checked on December 3, 2026 is the Creative Commons Attribution 4.0 International licence. There is no AutoGen licence fee, no seat price, and no usage meter from Microsoft for the framework itself. You pay for the model you call, the machine you run on, and your own maintenance time. Keep attribution and licence notices with copies you share, and remember that archived software comes without a support promise. The $0 figure in this guide means $0 in framework licence fees. It never means $0 to run.

AutoGen official GitHub repository to install AutoGen for ai agent workflows

What AutoGen replaces, and what it does not

AutoGen replaces the hand-rolled chat loop that many agent experiments start with: a pile of prompt strings, manual message passing between model calls, and stop rules held together by hope. Instead, you define agents with names, system messages, model clients, and tools. You put them in a team, give the team a task, and let a termination condition decide when the conversation ends. Every message is visible, so a weak result can be traced to the agent and turn that produced it.

For a small business, the fit is work that benefits from a second pair of eyes. A primary agent drafts a customer reply and a critic agent checks tone, facts, and missing details before a human approves it. A research agent gathers product facts and a reviewer agent flags unsupported claims. A support workflow classifies a ticket, searches your help pages, and drafts a response for staff to send. The value is not that agents are magic. The value is that drafting and checking become separate, inspectable steps.

What AutoGen does not replace is process design. If the task is vague, the team will produce vague work in more turns and at higher token cost. If your source documents are wrong, the agents will repeat the error politely. Budget time for task wording, examples, tools, and review. It also does not replace general business automation. If most of a workflow is moving rows between a CRM, email, and spreadsheets, a general automation tool fits better; our n8n on a VPS guide covers that layer, and an agent team can sit inside it as the judgement step.

Best for: technical owners who already run AutoGen, need to maintain it safely, or want to learn conversation-driven multi-agent patterns on their own machine. Skip if: you are starting a new production system today and need vendor security fixes and long-term support.

How AgentChat, Core, and Extensions fit together

AutoGen is layered, and the layers explain the package names. The Core API is the low-level runtime: message passing, event-driven agents, and local or distributed execution across Python and .NET. The AgentChat API sits on top of Core with a simpler, opinionated interface for rapid prototyping, including familiar patterns such as two-agent chats and group chats. The Extensions API adds model clients and capabilities such as OpenAI and Azure OpenAI clients, code execution, and tool support.

Most small-business readers should start in AgentChat. An AssistantAgent takes a name, a model client, an optional system message, and optional tools. A team such as RoundRobinGroupChat runs participants in turns, with each response broadcast so the team shares context. SelectorGroupChat uses a model to choose the next speaker after each message. Swarm uses handoff messages to move work between agents. MagenticOneGroupChat is a generalist team for open-ended web and file tasks. The official Teams tutorial gives the right order of operations: optimise a single agent first, and move to a team only when one agent proves inadequate.

That order saves money. Every extra agent reads context and writes a reply, so a three-agent team can cost several times a single-agent run for the same task. Start with one agent and good tools. Add a critic when errors are expensive. Add a selector or handoffs only when routing is the real problem. Our CrewAI guide covers the role-and-task alternative if you prefer named crews over open conversation.

Routes: AutoGen, AutoGen Studio, or Microsoft Agent Framework

There are three practical routes, and only one of them is right for new production work.

RoutePrice anchorBest forSkip if
AutoGen AgentChat$0 framework licence feeMaintaining existing AutoGen systems and learning agent patternsYou need maintained production support
AutoGen Studio$0 framework licence feeRapid prototyping without writing codeYou need a production-ready app
Microsoft Agent FrameworkSuccessor route for new projectsNew production multi-agent systemsYou must stay on existing AutoGen code today

The open-source AutoGen route is the one this guide installs. AutoGen Studio adds a low-code Team Builder, Playground, Gallery, and Deployment views on top of AgentChat, installed with pip install -U "autogenstudio" and run locally with autogenstudio ui --port 8080 --appdir ./my-app. Microsoft is explicit that Studio is a research prototype, not a production-ready app, and that production builders must implement authentication, security, and other deployment features themselves.

Microsoft Agent Framework is the route Microsoft recommends for new users. If you have no AutoGen code to protect, that recommendation should carry real weight. For comparison, our Dify guide covers an all-in-one LLM platform and our Langflow guide covers a visual builder. AutoGen is the conversation-first, code-first option with an archive warning attached.

Requirements before you install AutoGen for ai agent workflows

Start with the documented Python floor. AutoGen requires Python 3.10 or later. Check the version before you install anything, because an old interpreter turns a one-line install into dependency archaeology. The official installation guide recommends a virtual environment so AutoGen dependencies stay isolated from the rest of your system. Use venv or conda, and keep one environment per project.

You also need a model route. The quickstart installs the OpenAI extension and creates an OpenAIChatCompletionClient. Azure OpenAI with AAD authentication needs the Azure extension instead. Other models are supported through the model-client interface, including local models; our Ollama guide covers the local model layer if you want to trade token bills for hardware you own.

Finally, decide where code, keys, and logs will live. Your project files are source code. Your API key is a password. Your run logs may contain customer text. Treat all three accordingly from the first run, not after the first incident.

AutoGen official installation docs to install AutoGen for ai agent workflows

Step 1: install Python and the AutoGen packages

Create and activate a virtual environment first. On Linux or Mac, the official guide uses python3 -m venv .venv followed by source .venv/bin/activate. On Windows, it uses python -m venv .venv followed by .venv\Scripts\activate.bat. A conda environment with Python 3.12 is the documented alternative. Confirm the active interpreter reports Python 3.10 or later before continuing.

Then install AgentChat and the OpenAI model client from Extensions:

pip install -U "autogen-agentchat" "autogen-ext[openai]"

That single command is the current official path. The quickstart variant adds Azure support with pip install -U "autogen-agentchat" "autogen-ext[openai,azure]". Install only the extras you need. Every extra package is another dependency you own, and on an archived project every dependency deserves a reason to exist.

Pin what you installed. After a successful install, save the environment with pip freeze > requirements.txt and commit that file with your code. On a maintained framework, loose versions are a minor risk. On an archived framework, a reproducible environment is how you rebuild the same system next year without surprise upgrades. Record the Python version beside it.

If you want the no-code prototype interface as well, install Studio separately with pip install -U "autogenstudio". Keep Studio on your own machine or a private network. The security section below explains why a public Studio URL is a bad idea.

Step 2: add your model key and run a first agent

Set your model API key as an environment variable. The official quickstart reads the OpenAI key from the environment when no key is passed directly to the client. Never paste a live key into a script you commit, a screenshot you share, or a support ticket. Use a dedicated key for this project so you can revoke it without breaking anything else.

Run the smallest useful test: one AssistantAgent with one harmless tool. The official quickstart defines a weather function tool, creates an agent named weather_agent with reflection on tool use enabled, streams the run to the console, and closes the model client when finished. Copy that shape with your own harmless tool, such as a function that returns your opening hours from a fixed string. If the agent calls the tool and answers from its result, your install, key, and model route all work.

Check three things in that first run. First, the console shows the function call and its result, not just a confident final sentence. Second, token usage appears in the messages, so you can see what a run costs. Third, the process exits cleanly after the client closes. A first agent that cannot show its tool call is not ready for customer data.

Keep the first agent boring on purpose. No web browsing, no code execution, no file writes, no email sending. You are proving the plumbing. Tools that change the outside world come later, behind the security steps.

AutoGen official quickstart docs to install AutoGen for ai agent workflows

Step 3: build your first two-agent team

The official Teams tutorial builds a reflection team: a primary agent drafts, a critic agent reviews, and a TextMentionTermination condition stops the team when the critic replies with the approval word. That pattern maps directly onto small-business work. Replace the poem task with a customer reply, a product description, or a quote summary. The primary agent writes the draft. The critic checks facts against your source text, flags missing details, and approves only when the draft is safe to send to a human.

Run the team with team.run(task=...) for a final TaskResult, or stream it with run_stream and the Console helper while you are debugging. Read the stop reason every time. A team that stops because it hit a turn limit has not finished; it has given up. A team that stops on the approval word has completed the pattern you designed.

Set a hard ceiling before the first real task. Combine the approval-word termination with a maximum-turn limit so two polite agents cannot critique each other until the token bill becomes the story. The tutorial’s token counts show why: each turn re-reads a growing context, so later turns cost more than early ones. Your ceiling is a budget control, not a style choice.

Reset the team between tasks with team.reset() when you reuse it. Shared context is the feature that makes teams coherent and the bug that makes them leak one customer’s details into another customer’s draft. Fresh context per task is the safe default.

AutoGen official teams docs to install AutoGen for ai agent workflows

Step 4: shape the workflow for real business work

Give each agent one job, one system message, and the smallest toolset that does that job. A researcher agent gets read-only search over your help pages. A drafter gets your tone rules and no sending tool. A critic gets your price list and a checklist. A human gets the send button. Least-privilege tools are how a prompt mistake stays a draft mistake instead of becoming a customer mistake.

Write tasks with expected outputs. “Reply to this customer” invites improvisation. “Draft a reply under 120 words that confirms the delivery date from the order text, names the next step, and invents no discount” gives the critic something to check. Include the source text in the task, and tell the critic to flag any claim that is not in the source. Grounded drafts are slower to write and much cheaper to trust.

Choose the team shape to match the risk. Round-robin suits draft-and-review. Selector routing suits triage, where the next specialist depends on the message. Handoffs suit staged work, where research must finish before drafting starts. Magentic-One suits open-ended web and file tasks, and its own guidance warns you to run such tasks in containers, monitor the agents, and expect prompt-injection risk from webpages. Do not use the most autonomous shape for the most sensitive work.

Log every run: task, messages, token usage, stop reason, and final output. On an archived framework, your logs are your support department. When a draft goes wrong, the log tells you whether the task, the tool, the model, or the termination rule failed.

Step 5: run it like production, not a demo

Production discipline on an archived framework means assuming no rescue is coming. Pin your package versions, run agents in a container or isolated environment, keep keys in environment variables or a secrets store, and put a human approval step in front of every external action: sending email, issuing refunds, changing records, or posting publicly. The agent drafts. The human decides. That boundary is the product.

Add budget controls outside the framework. Set provider-side spend limits where your model provider offers them, cap turns per run, cap tokens per task, and alert on daily usage. AutoGen shows token usage in its messages, but it does not manage your bill for you. A runaway team with no ceiling is a billing incident with good formatting.

Test with ugly inputs before real ones. Empty tasks, contradictory source text, a customer message that tries to talk the agent into a discount, a tool that returns an error. Watch whether the critic catches the problem and whether the termination rule still fires. The failures you find in testing are free. The same failures in production cost refunds and trust.

Plan the exit early. Keep prompts, tools, and tasks in your own files, separate from framework glue, so a move to Microsoft Agent Framework is a port, not a rewrite.

First-run security steps you must not skip

Treat code execution as the highest-risk feature. Agents that run code can read files, call networks, and change state. The Studio security note encourages Docker code execution for agents, and the Magentic-One guidance repeats the container warning. Follow it: code runs in a disposable container with no access to your keys, your customer database, or your home directory. An agent with local code execution and your API key in reach is one bad prompt away from a very bad day.

Treat every tool as a permission. Read-only tools first. Write tools behind human approval. Delete tools last, if ever. Connect only trusted MCP servers, because the official README warns that MCP servers may execute commands in your local environment or expose sensitive information. A tool you cannot explain is a tool you cannot safely grant.

Keep AutoGen Studio private. Microsoft describes Studio as a research prototype that is not meant for production, without implemented protections for jailbreaking or per-user data permissions. Run it on localhost or behind your own authenticated network controls. Never expose a Studio instance to the public internet and call it a customer portal.

Protect keys and data separately. Keys live in environment variables, never in code. Customer text lives in logs only as long as you need it for debugging, with access limited to the people who run the system. On an archived project, assume a dependency vulnerability may stay unpatched, and reduce what an attacker could reach if one appears. Isolation is your patch.

Backup and update routine for an archived project

Back up the things that recreate the system: your code, requirements.txt, system messages, tool definitions, task templates, and run logs you need for audit. Keys are not backed up in files; they are reissued from your provider account. Test the rebuild once: create a fresh virtual environment, install from your pinned requirements, set a test key, and run the first-agent test. A backup you have never restored is a hope, not a backup.

Update deliberately, never casually. Microsoft will not ship AutoGen fixes, but your dependencies and Python itself will keep moving. Review dependency updates on a schedule, test them in a copy of the environment, and keep the previous pinned set so you can roll back. Watch your model provider’s deprecation notices as well; a retired model name breaks a working team as surely as a broken package.

Re-read the archive notice quarterly: is staying still cheaper than migrating? When risk flips the answer, use the official migration guide and move with prompts and tools intact.

Common errors and fixes

Wrong package name is the classic failure. Current AgentChat installs as autogen-agentchat with autogen-ext for model clients. Old v0.2 tutorials use different names and APIs, including errors such as missing attributes on the autogen module. If an import fails, check the package name against the official installation guide before changing code. The migration guide covers v0.2 upgrades.

Python version errors come next. AutoGen requires Python 3.10 or later. If pip resolves strange versions or builds fail, print the active Python version inside the activated environment. A correct global Python does not help if the virtual environment was created from an old interpreter.

Missing model-client errors usually mean the extension extra was skipped. Installing autogen-agentchat alone does not add the OpenAI client. Install autogen-ext[openai], or autogen-ext[azure] for Azure OpenAI with AAD authentication, exactly as the installation guide shows.

Teams that never stop have a termination problem, not a creativity problem. Check that the approval word in your TextMentionTermination matches the critic’s system message exactly, and add a maximum-turn ceiling. Teams that stop instantly have the opposite problem: the approval word appears in an early draft or in the task text itself. Choose an approval token that cannot occur naturally in customer content.

Async errors appear when tutorial code is pasted into a script without an entry point. The quickstart notes that script runs need asyncio.run(main()). Close the model client when the run finishes, and reset teams between tasks so stale context does not contaminate the next run.

Tips and tricks that save money

Start with one agent. The official Teams guidance says to optimise a single agent before building a team, and the token maths backs it up. Add agents only when a measured failure, such as unchecked drafts, justifies the extra turns.

Keep contexts short. Pass the critic the draft and the source facts, not your entire help centre. Summarise long documents before they enter the team, and cap output length in the task. Input tokens are re-read on every turn, so context discipline compounds.

Use the cheapest model that passes your tests for drafting, and reserve stronger models for review. Compare error rates on the same tasks, cache stable system text where supported, and batch offline work.

Measure cost per accepted output, not cost per run. Divide logged token cost by human approvals. That is the number that matters.

The real cost maths

AutoGen’s framework licence fee is $0. The running cost is model usage plus the machine you run on, and multi-agent conversation multiplies the model line. Price it with official token rates before you commit.

On the official OpenAI pricing page checked on December 3, 2026, gpt-6.2-sol costs $2.00 per 1M input tokens and $10.00 per 1M output tokens. Take a realistic small-business scenario: 400 customer-reply drafts a month. A lean single-agent run uses about 4,000 input tokens and 1,000 output tokens. That is $0.008 in input plus $0.010 in output, or $0.018 a run. Across 400 runs, the lean choice costs $7.20 a month in model usage.

Now price the draft-and-critic team. Each run uses about 15,000 input tokens across turns and 3,000 output tokens, because the critic re-reads the draft and source before approving. That is $0.030 in input plus $0.030 in output, or $0.060 a run. Across 400 runs, the team costs $24.00 a month. The team costs $16.80 a month more than the lean agent. That premium buys a checked draft. Whether it is worth it depends on what an unchecked draft costs you in corrections, refunds, and staff time.

ScenarioTokens per runCost per run400 runs a month
Single agent4,000 in / 1,000 out$0.018$7.20
Draft-and-critic team15,000 in / 3,000 out$0.060$24.00

Hosting is the smaller line. A laptop you own adds $0; a small server adds the same rental to either scenario. Turns decide the bill: cap them and shorten context, or the same approved output can cost several times more.

Against a hosted platform, you save licence and execution fees and take on Python, containers, keys, logs, updates, and migration planning. Budget those hours honestly.

When not to self-host AutoGen

Do not self-host AutoGen for a brand-new production system that needs vendor security patches, compliance support, or a long-term roadmap. Microsoft advises against production use and points new users to Microsoft Agent Framework. Ignoring that advice to save a licence fee is false economy.

Do not self-host when nobody will own the runtime. If no one will pin dependencies, read logs, rotate keys, and test updates, choose a hosted builder instead. An unmaintained agent with write tools is worse than no agent.

Do not self-host AutoGen Studio as a public product. Studio is a prototype interface without production authentication and data-permission features. Prototype privately, then build your own application with the security features your customers require.

Do not self-host when the workflow is mostly deterministic automation. Moving data between systems belongs in an automation tool. Reserve agent teams for judgement steps where drafting, checking, and routing genuinely need a model.

Pros and cons

Pros

  • $0 framework licence fee with no seat price or usage meter from Microsoft
  • Conversation-driven teams make drafting and checking separate, inspectable steps
  • AgentChat gives a simple start, with Core available when you need lower-level control
  • Termination conditions and token reporting make run cost visible and controllable
  • Hosted or local models can be connected, so the token bill stays under your control

Cons

  • Archived and no longer maintained, with no Microsoft bug or security fixes
  • Microsoft advises against production use and directs new users elsewhere
  • You own Python, dependencies, keys, containers, logs, and migration planning
  • Multi-agent turns multiply token cost, so uncapped teams get expensive fast
  • AutoGen Studio is a research prototype, not a production-ready application

Our verdict

Install AutoGen for ai agent workflows when you already run AutoGen, need to maintain it safely, or want to learn multi-agent patterns on your own machine. Pin the environment, cap every run, keep code execution in containers, and keep a human in front of external actions. The maths is clear: $0 in framework licence fees, with a $24.00-a-month model bill in our 400-run team example. For a new production system, follow Microsoft’s own direction and start with Microsoft Agent Framework instead.

FAQ

Is AutoGen free to self-host for a business?

AutoGen costs $0 in framework licence fees to install and run on your own infrastructure. You still pay for model usage, hosting, tools, and maintenance time. Microsoft has archived the project, so budget for your own security and update work.

What does AutoGen need to run?

AutoGen requires Python 3.10 or later. Create a virtual environment, install with pip install -U "autogen-agentchat" "autogen-ext[openai]", set your model API key as an environment variable, then run an AssistantAgent or a team such as RoundRobinGroupChat.

How do I run my first AutoGen team?

Create a primary AssistantAgent and a critic AssistantAgent, add a TextMentionTermination condition for the critic’s approval word, and run them in a RoundRobinGroupChat. Read the stop reason and token usage after every run, and reset the team before the next task.

How much does AutoGen cost?

The framework licence fee is $0. Model usage is separate. At official gpt-6.2-sol prices checked on December 3, 2026, our 400-run draft-and-critic example costs $24.00 a month, against $7.20 for a lean single-agent run at the same volume.

Should a small business start a new project on AutoGen?

For new production work, no. Microsoft has archived AutoGen, provides no bug or security fixes, advises against production use, and directs new users to Microsoft Agent Framework. Use AutoGen to maintain existing systems or learn the patterns, and plan migration with the official guide.

Strategic Pivot

Before you add agents, price the whole stack honestly. Our free AI Cost Calculator lets you compare the licence, model, and hosting lines side by side, so the $0 framework saving survives contact with your real token bill.

Sources

Price note — updated December 3, 2026: Prices in this post were checked on December 3, 2026. When you are reading this, the price may be lower or higher. Check the official pricing page before you buy.

Pros

  • $0 framework licence fee with no seat price or usage meter from Microsoft
  • Conversation-driven teams make drafting and checking separate, inspectable steps
  • AgentChat gives a simple start, with Core available when you need lower-level control
  • Termination conditions and token reporting make run cost visible and controllable
  • Hosted or local models can be connected, so the token bill stays under your control

Cons

  • Archived and no longer maintained, with no Microsoft bug or security fixes
  • Microsoft advises against production use and directs new users elsewhere
  • You own Python, dependencies, keys, containers, logs, and migration planning
  • Multi-agent turns multiply token cost, so uncapped teams get expensive fast
  • AutoGen Studio is a research prototype, not a production-ready application
Our verdict

Install AutoGen for ai agent workflows when you already run AutoGen, need to maintain it safely, or want to learn multi-agent patterns on your own machine. Pin the environment, cap every run, keep code execution in containers, and keep a human in front of external actions. The maths is clear: $0 in framework licence fees, with a $24.00-a-month model bill in our 400-run team example. For a new production system, follow Microsoft's own direction and start with Microsoft Agent Framework instead.

Leave a Comment