How to Monitor AutoGen with Vigilmon
Microsoft AutoGen is an open-source framework where multiple LLM-powered agents collaborate through structured dialogue to solve tasks. An AutoGen pipeline might have a UserProxyAgent coordinating a group of AssistantAgents — one writes code, another executes it, a third reviews the output. These chained conversations are powerful but operationally invisible without monitoring.
When your AutoGen pipeline silently fails — a code execution agent hitting a timeout, the LLM returning an unexpected termination message, a group chat deadlocking — you typically find out from a downstream consumer noticing bad output, not from an alert.
This guide shows how to monitor AutoGen pipelines with Vigilmon.
Why AutoGen Needs Dedicated Monitoring
AutoGen workflows are different from REST APIs. Their failure modes include:
- Conversation termination without success — the
is_termination_msgfunction fires early, or the max_turns limit is hit before the task completes - Code execution failures — the
UserProxyAgentwithcode_execution_configfails to execute generated code, and the pipeline loops or gives up - LLM token budget exhaustion — a complex multi-turn group chat exceeds context limits mid-conversation
- Human-in-the-loop timeouts — workflows expecting human input block indefinitely if the input never arrives
- Group chat coordinator failures — the
GroupChatManagerselects the wrong next speaker repeatedly, causing circular conversations
Standard error tracking catches unhandled exceptions. Vigilmon catches the cases where the pipeline runs to completion but produces wrong or missing output.
Key Metrics to Monitor
| Metric | Signal | |--------|--------| | Pipeline execution time | LLM latency spike or infinite loop | | Heartbeat regularity | Scheduled pipeline running on time | | Conversation round count | Runaway loops or early termination | | Code execution pass rate | UserProxyAgent code-running environment health | | LLM API latency | OpenAI / Azure OpenAI / local model degradation | | Output validation result | Pipeline completed but result was malformed |
Setup Guide
1. Add a Heartbeat Monitor for Scheduled Pipelines
For AutoGen pipelines that run on a schedule (daily data analysis, nightly report generation), configure a Vigilmon heartbeat:
- Monitors → New Monitor
- Type: Heartbeat
- Name:
AutoGen Coding Pipeline — Nightly - Expected interval: 24 hours
- Grace period: 30 minutes
- Save — copy the ping URL
Wrap your pipeline with a heartbeat ping on success:
import requests
import autogen
VIGILMON_HEARTBEAT_URL = "https://vigilmon.online/ping/your-heartbeat-id"
def run_analysis_pipeline(data_path: str) -> str:
config_list = autogen.config_list_from_json("OAI_CONFIG_LIST")
assistant = autogen.AssistantAgent(
name="DataAnalyst",
llm_config={"config_list": config_list},
system_message="You are a senior data analyst. Write Python code to analyze the data.",
)
user_proxy = autogen.UserProxyAgent(
name="UserProxy",
human_input_mode="NEVER",
max_consecutive_auto_reply=15,
is_termination_msg=lambda x: "ANALYSIS COMPLETE" in x.get("content", ""),
code_execution_config={
"work_dir": "/tmp/autogen_workspace",
"use_docker": False,
},
)
result = user_proxy.initiate_chat(
assistant,
message=f"Analyze the CSV file at {data_path} and summarize findings. End with ANALYSIS COMPLETE.",
)
# Only ping if the termination message was hit (success)
last_msg = user_proxy.last_message()
if last_msg and "ANALYSIS COMPLETE" in last_msg.get("content", ""):
requests.get(VIGILMON_HEARTBEAT_URL, timeout=5)
return result.summary
if __name__ == "__main__":
run_analysis_pipeline("/data/sales_2026.csv")
2. Expose a Health Endpoint
For AutoGen pipelines embedded in a web service, expose a status endpoint:
# health/autogen_health.py
import time
from fastapi import FastAPI
app = FastAPI()
# Updated by your pipeline runner after each successful run
pipeline_state = {
"last_success_at": None,
"last_duration_ms": None,
"last_round_count": None,
}
@app.get("/health/autogen")
def autogen_health():
ts = pipeline_state.get("last_success_at")
seconds_since = (time.time() - ts) if ts else None
# Fail if no successful run in the last 25 hours
ok = seconds_since is not None and seconds_since < 90_000
return {
"ok": ok,
"last_success_at": ts,
"last_duration_ms": pipeline_state.get("last_duration_ms"),
"last_round_count": pipeline_state.get("last_round_count"),
"seconds_since_last_run": seconds_since,
}
Monitor this endpoint in Vigilmon:
- Type: HTTP
- URL:
https://yourapp.com/health/autogen - Keyword check:
"ok":true - Interval: 15 minutes
- Response time warning: 3000ms
- Save
3. Track Conversation Metrics
AutoGen's conversation objects expose turn count and message history. Log key metrics for observability:
import time
import autogen
def run_group_chat_with_monitoring(task: str) -> dict:
config_list = autogen.config_list_from_json("OAI_CONFIG_LIST")
coder = autogen.AssistantAgent(
name="Coder",
llm_config={"config_list": config_list},
system_message="You write clean Python code.",
)
reviewer = autogen.AssistantAgent(
name="Reviewer",
llm_config={"config_list": config_list},
system_message="You review code for bugs and suggest improvements.",
)
user_proxy = autogen.UserProxyAgent(
name="UserProxy",
human_input_mode="NEVER",
max_consecutive_auto_reply=20,
is_termination_msg=lambda x: "APPROVED" in x.get("content", ""),
)
group_chat = autogen.GroupChat(
agents=[user_proxy, coder, reviewer],
messages=[],
max_round=20,
)
manager = autogen.GroupChatManager(
groupchat=group_chat,
llm_config={"config_list": config_list},
)
start = time.time()
user_proxy.initiate_chat(manager, message=task)
duration_ms = int((time.time() - start) * 1000)
round_count = len(group_chat.messages)
success = any("APPROVED" in m.get("content", "") for m in group_chat.messages)
metrics = {
"ok": success,
"duration_ms": duration_ms,
"round_count": round_count,
"max_rounds_hit": round_count >= 20,
}
print(f"[autogen] pipeline={'ok' if success else 'FAILED'} "
f"rounds={round_count} duration={duration_ms}ms")
return metrics
Flag when max_rounds_hit is true — it means the pipeline terminated by exhausting the round limit, not by reaching the success condition. This is a silent failure.
4. Monitor the LLM Backend
AutoGen relies on OpenAI, Azure OpenAI, or local models. Set up Vigilmon probes for each:
OpenAI:
URL: https://api.openai.com/v1/models
Header: Authorization: Bearer sk-your-key
Keyword: "gpt-4"
Interval: 5 minutes
Azure OpenAI:
URL: https://your-resource.openai.azure.com/openai/deployments?api-version=2024-02-01
Header: api-key: your-azure-key
Keyword: "data"
Interval: 5 minutes
Alerting
Set up Vigilmon alert channels for AutoGen monitors:
- Open monitor → Alerts → Add Channel
- Slack: Post to
#ai-opson first failure - Email: On-call engineer after 2 consecutive failures
- PagerDuty: Only if the pipeline output feeds a production system
Alert policy recommendations:
| Monitor | Condition | Action |
|---------|-----------|--------|
| Nightly heartbeat | Missed by >30 min | Slack + email |
| Health endpoint | 2 consecutive failures | Slack immediately |
| Azure OpenAI probe | Any failure | Slack #ai-ops |
| Round count anomaly | >18 rounds (near-max) | Slack warning |
Monitoring GroupChat vs Two-Agent Pipelines
GroupChat pipelines (3+ agents coordinated by GroupChatManager) are harder to monitor than simple two-agent conversations because failure can look like success — the manager selects speakers in an unproductive cycle and eventually hits the max round limit.
For GroupChat pipelines, always:
- Use a strict
is_termination_msgthat requires explicit success keywords - Log
max_rounds_hitas a metric - Set the Vigilmon heartbeat grace period shorter than your max acceptable latency — if a 15-minute pipeline is hitting 25 minutes, it's probably looping
Conclusion
AutoGen pipelines surface a class of failures that HTTP monitoring alone can't catch: successful completions that produced wrong outputs, round-limit exhaustions mistaken for success, and LLM provider slowdowns that triple pipeline runtime. Vigilmon heartbeat monitors give you the most reliable signal for scheduled pipelines — if the pipeline doesn't ping, something went wrong. Combine that with health endpoint monitoring and LLM provider probes for complete coverage.