On this tutorial, you’ll use AgentScope to construct a sophisticated multi-agent incident response system. We coordinate a number of ReAct brokers, every with clearly outlined roles reminiscent of routing, triage, evaluation, writing, and reviewing, and join them by structured routing and a shared message hub. By integrating OpenAI fashions, light-weight software calls, and easy inside runbooks, we present how advanced real-world agent workflows may be configured in pure Python with out heavy infrastructure or brittle glue code. Take a look at the whole code right here.
Arrange the execution atmosphere and set up all required dependencies to make sure the tutorial runs on Google Colab. Securely hundreds the OpenAI API key and initializes the core AgentScope element that’s shared between all brokers. Take a look at the whole code right here.
{“id”: “P0”, “title”: “Severity Policy”, “text”: “P0 critical outage, P1 major degradation, P2 minor issue”},
{“id”: “IR1”, “title”: “Incident Triage Checklist”, “text”: “Assess blast radius, timeline, deployments, errors, mitigation”},
{“id”: “SEC7”, “title”: “Phishing Escalation”, “text”: “Disable account, reset sessions, block sender, preserve evidence”},
]
def _score(q, d): q = set(re.findall(r”[a-z0-9]+”, q. decrease())) d = re.findall(r”[a-z0-9]+”, d. decrease()) return sum(1 for w in d if w in q) / max(1, len(d)) async def search_runbook(question: str, top_k: int = 2) -> ToolResponse: Rank =sorted(RUNBOOK, key=lambda r: _score(question, r)[“title”] +r[“text”]), reverse = True)[: max(1, int(top_k))]
textual content = “nn”.be a part of(f”[{r[‘id’]}]{r[‘title’]}n{r[‘text’]}” for ranked r) return ToolResponse(content material=[TextBlock(type=”text”, text=text)]) Toolkit = Toolkit() Toolkit.register_tool_function(search_runbook) Toolkit.register_tool_function(execute_python_code)
Outline a light-weight inside runbook and implement a easy relevance-based search software on prime of it. Registering this perform with a Python execution software permits the agent to acquire coverage information and dynamically compute outcomes. This exhibits how brokers may be enhanced with exterior capabilities past pure linguistic reasoning. Take a look at the whole code right here.
Construct a number of specialised ReAct brokers and a structured router that decides easy methods to deal with every person’s requests. We assign clear duties to triage, evaluation, writing, and reviewers to make sure separation of considerations. Take a look at the whole code right here.
We current pattern log information and a utility perform that normalizes agent output to scrub textual content. It ensures that downstream brokers can safely use and enhance on earlier responses with out introducing formatting points. It focuses on making communication between brokers strong and predictable. Take a look at the whole code right here.
Coordinate your complete workflow by routing requests, working the suitable brokers, and utilizing message hubs to carry out collaborative coordination loops. Tune a number of brokers in sequence to enhance the ultimate output earlier than returning it to the person. This integrates all earlier elements right into a constant end-to-end agent pipeline.
In conclusion, now we have proven that AgentScope can be utilized to design strong, modular, and collaborative agent techniques that transcend single-prompt interactions. Inside a clear and reproducible Colab setup, we dynamically routed duties, invoked instruments solely when mandatory, and refined outputs by multi-agent coordination. This sample exhibits easy methods to scale from easy agent experiments to production-style inference pipelines whereas sustaining readability, management, and scalability for agent AI functions.
Take a look at the whole code right here. Additionally, be happy to observe us on Twitter. Additionally, do not forget to hitch the 100,000+ ML SubReddit and subscribe to our e-newsletter. grasp on! Are you on telegram? Now you can additionally take part by telegram.
Asif Razzaq is the CEO of Marktechpost Media Inc. As a visionary entrepreneur and engineer, Asif is dedicated to harnessing the potential of synthetic intelligence for social good. His newest endeavor is the launch of Marktechpost, a man-made intelligence media platform. It stands out for its thorough protection of machine studying and deep studying information, which is technically sound and simply understood by a large viewers. The platform boasts over 2 million views per 30 days, demonstrating its recognition amongst viewers.


