In 2026, large language models (LLMs) are powering a new era of workflow automation—especially with the rise of LLM plugins and prompt chaining. If you’re looking to streamline multi-step business processes, orchestrate data flows, or build AI-powered automations that interact with external systems, LLM plugins are a game changer.
This tutorial will guide you through automating a complex, multi-step workflow using LLM plugins. We’ll cover concrete implementation steps, code examples, and troubleshooting tips. If you’re new to prompt chaining or want a broader context, see our parent pillar on building reliable multi-stage AI workflows.
Prerequisites
- LLM Platform: OpenAI GPT-5 or Anthropic Claude 3, with plugin support (2026 versions)
- Plugin Framework: OpenAI Plugin SDK v2.3+ or LangChain v0.5+
- Programming Language: Python 3.11+
- API Access: Keys for any external APIs you’ll use (e.g., Google Calendar, Slack, internal databases)
- Basic Knowledge: Familiarity with Python, REST APIs, and JSON
- Environment: UNIX-like terminal (macOS/Linux), or Windows with WSL
Scenario: Automating a Multi-Step Incident Response Workflow
Let’s automate an IT incident response workflow:
- LLM receives an incident report via API.
- Classifies severity using LLM plugin.
- Creates a ticket in Jira (external API).
- Notifies the correct Slack channel.
- Summarizes the incident and logs it in a database.
1. Set Up Your Development Environment
-
Install Python and pip (if not already installed):
sudo apt update sudo apt install python3 python3-pip -
Create a virtual environment:
python3 -m venv llm-workflow-env source llm-workflow-env/bin/activate -
Install required libraries:
pip install openai-plugin-sdk==2.3.1 fastapi requests uvicorn -
Set up your API keys as environment variables:
export OPENAI_API_KEY="sk-..." export JIRA_API_KEY="your-jira-key" export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/..." export DB_URL="postgresql://user:pass@localhost:5432/incidents"
Screenshot description: Terminal showing successful installation of packages and environment variable export.
2. Design the Workflow as a Prompt Chain
Before coding, outline your workflow steps as a prompt chain. Each step’s output feeds the next step’s input. For a deep dive into chaining strategies, see Prompt Chaining for Workflow Automation: Best Patterns and Real-World Examples (2026).
- Step 1: Receive incident report (JSON payload)
- Step 2: Classify severity with LLM plugin
- Step 3: Create Jira ticket
- Step 4: Notify Slack
- Step 5: Summarize and log incident
Here’s a simple flow diagram:
[Incident API] → [LLM Plugin: Classify] → [Jira API] → [Slack API] → [DB Log]
Screenshot description: Diagram showing arrows from Incident API through each plugin/API step.
3. Implement the LLM Plugin for Classification
-
Create a new plugin project:
openai-plugin-sdk init incident-plugin cd incident-plugin -
Define the classification endpoint in
main.py:from fastapi import FastAPI, Request from openai_plugin_sdk import Plugin app = FastAPI() plugin = Plugin(app) @plugin.function( name="classify_incident", description="Classifies incident severity based on report text." ) async def classify_incident(report: str) -> dict: # Call LLM to classify severity import openai response = openai.ChatCompletion.create( model="gpt-5-plugin", messages=[{ "role": "system", "content": "Classify the severity of the following IT incident as 'Critical', 'High', 'Medium', or 'Low'." }, { "role": "user", "content": report }] ) severity = response['choices'][0]['message']['content'] return {"severity": severity} -
Run your plugin locally for testing:
uvicorn main:app --reload --port 3333 -
Test the endpoint:
curl -X POST "http://localhost:3333/classify_incident" \ -H "Content-Type: application/json" \ -d '{"report": "Database outage affecting all users"}'Expected response:
{"severity": "Critical"}
Screenshot description: Terminal with server running and sample curl request/response.
4. Integrate External APIs (Jira, Slack, Database)
Now, let’s add the steps to create a Jira ticket, notify Slack, and log the incident.
-
Add helper functions to
main.py:import requests import psycopg2 def create_jira_ticket(summary, description, severity): url = "https://your-domain.atlassian.net/rest/api/3/issue" headers = { "Authorization": f"Bearer {os.getenv('JIRA_API_KEY')}", "Content-Type": "application/json" } payload = { "fields": { "project": {"key": "IT"}, "summary": summary, "description": description, "issuetype": {"name": "Incident"}, "priority": {"name": severity} } } resp = requests.post(url, json=payload, headers=headers) return resp.json().get('key', 'UNKNOWN') def notify_slack(channel, message): webhook_url = os.getenv('SLACK_WEBHOOK_URL') payload = {"channel": channel, "text": message} resp = requests.post(webhook_url, json=payload) return resp.status_code == 200 def log_incident_to_db(summary, severity, ticket_id): conn = psycopg2.connect(os.getenv('DB_URL')) cur = conn.cursor() cur.execute( "INSERT INTO incidents (summary, severity, ticket_id) VALUES (%s, %s, %s)", (summary, severity, ticket_id) ) conn.commit() cur.close() conn.close() -
Extend your classification endpoint to trigger these steps:
@plugin.function( name="handle_incident", description="Classifies incident and orchestrates response workflow." ) async def handle_incident(report: str) -> dict: # Step 1: Classify severity = (await classify_incident(report))["severity"] # Step 2: Create Jira ticket ticket_id = create_jira_ticket( summary=f"Incident: {report[:50]}", description=report, severity=severity ) # Step 3: Notify Slack notify_slack("#incident-response", f"New {severity} incident: {report} (Jira: {ticket_id})") # Step 4: Log to DB log_incident_to_db(report, severity, ticket_id) return {"severity": severity, "ticket_id": ticket_id}
This function can now be called by the LLM as a plugin, handling the full multi-step workflow.
Screenshot description: IDE showing the extended plugin code with helper functions and orchestration logic.
5. Register and Test the Plugin with Your LLM Platform
-
Generate the plugin manifest (if using OpenAI):
openai-plugin-sdk manifest generate - Register the plugin endpoint URL in your LLM platform’s plugin directory or admin console.
-
Test the end-to-end workflow:
curl -X POST "http://localhost:3333/handle_incident" \ -H "Content-Type: application/json" \ -d '{"report": "Email service is down for 2 hours."}'Expected response:
{"severity": "High", "ticket_id": "IT-1234"} - Check Jira, Slack, and your database to confirm all steps executed.
Screenshot description: LLM platform UI showing plugin registration and successful test run.
Common Issues & Troubleshooting
- Plugin not recognized by LLM platform: Double-check your manifest, endpoint URL, and that your server is accessible from the LLM platform.
- API authentication errors: Ensure all API keys are set as environment variables and have correct permissions.
- LLM returns ambiguous or inconsistent classifications: Refine your system prompt and add more examples for few-shot learning.
-
Database connection issues: Verify your
DB_URLand that the database server is running and accessible. - Rate limiting or timeouts: Add retry logic to your API calls, and monitor for limits on Jira or Slack APIs.
For advanced prompt chaining troubleshooting, see Designing Effective Prompt Chaining for Complex Enterprise Automations.
Next Steps
- Expand your workflow: Add more steps, such as automated remediation or human-in-the-loop review. See how to build human-AI collaboration into automated workflows.
- Secure your plugins: Implement authentication and logging for compliance.
- Monitor and optimize: Track plugin usage, latency, and accuracy. Refine prompts and error handling as needed.
Automating multi-step workflows with LLM plugins is a powerful strategy for 2026 and beyond. For more advanced tactics, revisit our parent pillar on prompt chaining best practices.
