Hosted with nbsanity. See source notebook on GitHub.

Building Effective Agents (with Pydantic AI)

Examples for the agentic workflows discussed in Building Effective Agents by Erik Schluntz and Barry Zhang of Anthropic, inspired, ported and adapted from the code samples by the authors using Pydantic AI.

Basic Workflows

%pip install -r requirements.txt
from IPython.display import clear_output ; clear_output()
from util import initialize, show
AI_MODEL = initialize()

import asyncio
from typing import List, Dict

from pydantic import BaseModel, Field
from pydantic_ai import Agent
Available AI models:
['openai:gpt-4o',
 'openai:gpt-4o-mini',
 'gemini-1.5-pro',
 'gemini-2.0-flash-exp',
 'claude-3-5-haiku-latest',
 'claude-3-5-sonnet-latest']

Using AI model: openai:gpt-4o

Workflow: Prompt Chaining

The first and simplest workflow, chaining, we feed the output of one LLM call to the next one, and complete our task step by step.

All LLM calls are handled by the Agent class. One feature we take advantage of here is a consistent interface for different LLM providers. The model name is provided to the constructor and from there, the calls are the same regardless of which provider and model we are using.

async def chain(input: str, prompts: List[str]) -> str:
    """Chain multiple LLM calls sequentially, passing results between steps."""
    agent = Agent(AI_MODEL)
    result = input
    for i, prompt in enumerate(prompts, 1):
        agent = Agent(AI_MODEL, system_prompt=prompt)
        response = await agent.run(f"nInput:\n{result}")
        result = response.data
        show(result, title=f"Step {i}")
    return result
data_processing_steps = [
    """Extract only the numerical values and their associated metrics from the text.
    Format each as 'value: metric' on a new line.
    Example format:
    92: customer satisfaction
    45%: revenue growth""",
    
    """Convert all numerical values to percentages where possible.
    If not a percentage or points, convert to decimal (e.g., 92 points -> 92%).
    Keep one number per line.
    Example format:
    92%: customer satisfaction
    45%: revenue growth""",
    
    """Sort all lines in descending order by numerical value.
    Keep the format 'value: metric' on each line.
    Example:
    92%: customer satisfaction
    87%: employee satisfaction""",
    
    """Format the sorted data as a markdown table with columns:
    | Metric | Value |
    |:--|--:|
    | Customer Satisfaction | 92% |"""
]

report = """
Q3 Performance Summary:
Our customer satisfaction score rose to 92 points this quarter.
Revenue grew by 45% compared to last year.
Market share is now at 23% in our primary market.
Customer churn decreased to 5% from 8%.
New user acquisition cost is $43 per user.
Product adoption rate increased to 78%.
Employee satisfaction is at 87 points.
Operating margin improved to 34%.
""".strip()

show(report, title="Input text")
formatted_result = await chain(report, data_processing_steps)
show(formatted_result, title="Result")

Input text
----------

Q3 Performance Summary:
Our customer satisfaction score rose to 92 points this quarter.
Revenue grew by 45% compared to last year.
Market share is now at 23% in our primary market.
Customer churn decreased to 5% from 8%.
New user acquisition cost is $43 per user.
Product adoption rate increased to 78%.
Employee satisfaction is at 87 points.
Operating margin improved to 34%.


Step 1
------

92: customer satisfaction  
45%: revenue growth  
23%: market share  
5%: customer churn  
43: user acquisition cost  
78%: product adoption rate  
87: employee satisfaction  
34%: operating margin


Step 2
------

92%: customer satisfaction  
45%: revenue growth  
23%: market share  
5%: customer churn  
43%: user acquisition cost  
78%: product adoption rate  
87%: employee satisfaction  
34%: operating margin


Step 3
------

92%: customer satisfaction  
87%: employee satisfaction  
78%: product adoption rate  
45%: revenue growth  
43%: user acquisition cost  
34%: operating margin  
23%: market share  
5%: customer churn  


Step 4
------

| Metric                  | Value |
|:------------------------|------:|
| Customer Satisfaction   |   92% |
| Employee Satisfaction   |   87% |
| Product Adoption Rate   |   78% |
| Revenue Growth          |   45% |
| User Acquisition Cost   |   43% |
| Operating Margin        |   34% |
| Market Share            |   23% |
| Customer Churn          |    5% |


Result
------

| Metric                  | Value |
|:------------------------|------:|
| Customer Satisfaction   |   92% |
| Employee Satisfaction   |   87% |
| Product Adoption Rate   |   78% |
| Revenue Growth          |   45% |
| User Acquisition Cost   |   43% |
| Operating Margin        |   34% |
| Market Share            |   23% |
| Customer Churn          |    5% |

Workflow: Routing

In the routing workflow, we rely on an LLM call to decide which of several options to take. An AI agent is now handling part of the logic of the app.

One of the most powerful features of Pydantic AI is … Pydantic! Returing results using structured outputs and validating them against the schema specified is built-in. We can specify a result_type for every agent and receive the parsed and validated Pydantic model instance from the LLM call. This is easily one of the best ways of interfacing between code and LLM calls, and we’ll be using it for most workflows.

class RouteSelection(BaseModel):
    reasoning: str = Field(..., description=(
        'Brief explanation of why this ticket should be routed '
        'to a specific team. Consider key terms, user intent, '
        'and urgency level.'
    ))
    selection: str = Field(..., description='The chosen team name')


async def route(input: str, routes: Dict[str, str]) -> str:
    """Route input to specialized prompt using content classification."""

    # First, determine appropriate route using LLM with chain-of-thought
    show(f"{list(routes.keys())}", title="Available Routes")
    
    routing_agent = Agent(
        AI_MODEL,
        system_prompt=(
            'Analyze the input and select the most appropriate support team '
            f'from these options: {list(routes.keys())}'
        ),
        result_type=RouteSelection,
    )
    route_response = await routing_agent.run(input)
    reasoning = route_response.data.reasoning
    route_key = route_response.data.selection.strip().lower()
    
    show(reasoning, title="Routing Analysis")
    show(f"{route_key}", title="Selected Route")
    
    # Process input with selected specialized prompt
    worker_agent = Agent(AI_MODEL, system_prompt=routes[route_key])
    return (await worker_agent.run(input)).data
support_routes = {
    "billing": """You are a billing support specialist. Follow these guidelines:
    1. Always start with "Billing Support Response:"
    2. First acknowledge the specific billing issue
    3. Explain any charges or discrepancies clearly
    4. List concrete next steps with timeline
    5. End with payment options if relevant
    
    Keep responses professional but friendly.""",
    
    "technical": """You are a technical support engineer. Follow these guidelines:
    1. Always start with "Technical Support Response:"
    2. List exact steps to resolve the issue
    3. Include system requirements if relevant
    4. Provide workarounds for common problems
    5. End with escalation path if needed
    
    Use clear, numbered steps and technical details.""",
    
    "account": """You are an account security specialist. Follow these guidelines:
    1. Always start with "Account Support Response:"
    2. Prioritize account security and verification
    3. Provide clear steps for account recovery/changes
    4. Include security tips and warnings
    5. Set clear expectations for resolution time
    
    Maintain a serious, security-focused tone.""",
    
    "product": """You are a product specialist. Follow these guidelines:
    1. Always start with "Product Support Response:"
    2. Focus on feature education and best practices
    3. Include specific examples of usage
    4. Link to relevant documentation sections
    5. Suggest related features that might help
    
    Be educational and encouraging in tone."""
}

# Test with different support tickets
tickets = [
    """Subject: Can't access my account
    Message: Hi, I've been trying to log in for the past hour but keep getting an 'invalid password' error. 
    I'm sure I'm using the right password. Can you help me regain access? This is urgent as I need to 
    submit a report by end of day.
    - John""",
    
    """Subject: Unexpected charge on my card
    Message: Hello, I just noticed a charge of $49.99 on my credit card from your company, but I thought
    I was on the $29.99 plan. Can you explain this charge and adjust it if it's a mistake?
    Thanks,
    Sarah""",
    
    """Subject: How to export data?
    Message: I need to export all my project data to Excel. I've looked through the docs but can't
    figure out how to do a bulk export. Is this possible? If so, could you walk me through the steps?
    Best regards,
    Mike"""
]

print("Processing support tickets...\n")
for i, ticket in enumerate(tickets, 1):
    show(ticket, title=f"Ticket {i}")
    response = await route(ticket, support_routes)
    show(response, title=f"Response {i}")
Processing support tickets...


Ticket 1
--------

Subject: Can't access my account
    Message: Hi, I've been trying to log in for the past hour but keep getting an 'invalid password' error. 
    I'm sure I'm using the right password. Can you help me regain access? This is urgent as I need to 
    submit a report by end of day.
    - John


Available Routes
----------------

['billing', 'technical', 'account', 'product']


Routing Analysis
----------------

The user is experiencing issues accessing their account, specifically with login credentials. The frustration of repeated login failures and the urgency of needing access suggests that they are locked out due to some authentication problem, which is typically handled by the account support team. Since the query is tightly associated with account access, routing this ticket to the account team is appropriate.


Selected Route
--------------

account


Response 1
----------

Account Support Response:

Dear John,

I understand the urgency of your situation and I am here to assist you in regaining access to your account securely. Please follow these steps to recover your account:

1. **Password Reset:** Initiate a password reset by clicking on the "Forgot Password?" link on the login page. Follow the instructions sent to your registered email address to set a new, strong password.

2. **Verify Email Security:** Ensure that you have access to the email address connected to your account. Check for any suspicious activity or unauthorized access to your email.

3. **Check Device Security:** Ensure that the device you are using to access your account is secure and free from malware. Use updated antivirus software to scan for any threats.

4. **Enable Two-Factor Authentication (2FA):** Once access is restored, enable 2FA for an additional layer of security. This will help protect your account in the future.

5. **Review Account Activity:** After regaining access, review recent account activity for any unauthorized transactions or changes. Report any suspicious activity immediately.

Please allow up to 24 hours for password reset processes to take full effect. We recommend taking these actions promptly to prevent any potential breaches.

**Security Tip:** Avoid using the same password across multiple platforms and update your passwords regularly.

Should you continue experiencing issues or require further assistance, do not hesitate to contact our support team directly.

Thank you for your vigilance and cooperation in keeping your account secure.

Sincerely,
Account Security Specialist


Ticket 2
--------

Subject: Unexpected charge on my card
    Message: Hello, I just noticed a charge of $49.99 on my credit card from your company, but I thought
    I was on the $29.99 plan. Can you explain this charge and adjust it if it's a mistake?
    Thanks,
    Sarah


Available Routes
----------------

['billing', 'technical', 'account', 'product']


Routing Analysis
----------------

The issue raised by Sarah pertains to a financial transaction error - an unexpected charge on her credit card. The key terms indicating this include "charge on my card," "thought I was on the $29.99 plan," and "adjust if it's a mistake." These suggest that this is a billing issue and should be directed to the billing support team for resolution.


Selected Route
--------------

billing


Response 2
----------

Billing Support Response:

Hello Sarah,

Thank you for reaching out regarding the unexpected charge on your credit card. Let's address this billing issue and find a solution.

Upon reviewing your account, I see that you were indeed signed up for the $29.99 monthly plan previously. However, it appears there was an upgrade to the $49.99 plan on [specific date, if known]. This upgrade might have been initiated either through a selection within your account or via an automatic update based on usage which sometimes triggers a tier change.

Here are the steps we'll take to ensure this is resolved:

1. **Immediate Review**: We'll verify if this upgrade was accidental. This will be completed within 24-48 hours.
2. **Adjustment**: If this upgrade was not authorized or appears to be an error, we will adjust your charge back to $29.99 and issue a refund of the difference. This process usually takes 5-7 business days to reflect back on your credit card.
3. **Confirmation**: You will receive an email confirmation once the refund has been processed or if there's any action needed on your part to adjust your plan settings.

If this was an authorized plan upgrade and you still prefer the $29.99 plan, I can assist you in switching back immediately. 

For your convenience, we accept payments via major credit cards and PayPal. Please let me know if there is anything else you need assistance with.

Thank you,

Billing Support Team


Ticket 3
--------

Subject: How to export data?
    Message: I need to export all my project data to Excel. I've looked through the docs but can't
    figure out how to do a bulk export. Is this possible? If so, could you walk me through the steps?
    Best regards,
    Mike


Available Routes
----------------

['billing', 'technical', 'account', 'product']


Routing Analysis
----------------

The user is inquiring about how to export data from a project to Excel, which is primarily a technical process related to the functionality of the product. The user's request pertains to understanding and using the software's features to achieve their goal, rather than issues related to billing or account queries.


Selected Route
--------------

technical


Response 3
----------

Technical Support Response:

To export your project data to Excel, please follow these steps:

1. **Open the Software**: Launch the application where your project data is stored.
   
2. **Navigate to the Export Section**: Go to the 'File' menu and look for an 'Export' or 'Data Export' option. This option might also be in a separate 'Data' or 'Tools' menu, depending on the software.

3. **Select Data to Export**: Choose the specific project or projects you wish to export. Some applications provide a checklist to select multiple projects at once.

4. **Choose Export Format**: Select 'Excel' or 'CSV' as your export format. If 'Excel' is not directly available, choose 'CSV', which can easily be opened with Excel.

5. **Configure Export Settings**: You may have options like 'Export all fields' or 'Include headers'. Ensure they are checked according to your need.

6. **Choose Destination**: Specify where you want to save the exported file on your computer.

7. **Export Data**: Click on the 'Export' button to start the process. 

8. **Open with Excel**: Once exported, go to the saved location and open the file with Excel to confirm the data is correct.

**System Requirements**: Ensure you have Microsoft Excel installed. The basic version of Microsoft Excel 2010 or later is recommended.

**Workarounds for Common Problems**:
- If the 'Export' option is not visible, check your software’s documentation or user permissions. Sometimes, only admin users can perform bulk exports.
- If exporting to Excel results in format errors, export to CSV instead, then open the CSV file in Excel and use the 'Text to Columns' feature to organize your data properly.

**Escalation Path**:
If these steps do not resolve your issue, please contact our support team directly at [Support Email] with the description of your problem. Additionally, provide screenshots if possible, and mention any error messages received during the export process. Our advanced technical team will assist you further.

Thank you for reaching out, and we hope this assists you in exporting your project data smoothly.

Best regards,
[Your Name]

Workflow: Parallelization

LLM calls are typically long-running, I/O-bound operations. They are also stateless, so in cases where one call doesn’t depend on the other, it makes a lot of sense to parallelize the calls and continue processing once we receive the responses from all of them.

Agent.run() is an asynchronous call, and in the code here is asnchronous by default. Pydantic AI also provides an Agent.run_sync() method for cases where you’re writing synchronous code.

async def parallel(prompt: str, inputs: List[str]) -> List[str]:
    """Process multiple inputs concurrently with the same prompt."""
    agent = Agent(AI_MODEL, system_prompt=prompt)
    results = await asyncio.gather(*[
        agent.run(input)
        for input in inputs
    ])
    return [result.data for result in results]
stakeholders = [
    """Customers:
    - Price sensitive
    - Want better tech
    - Environmental concerns""",
    
    """Employees:
    - Job security worries
    - Need new skills
    - Want clear direction""",
    
    """Investors:
    - Expect growth
    - Want cost control
    - Risk concerns""",
    
    """Suppliers:
    - Capacity constraints
    - Price pressures
    - Tech transitions"""
]

impact_results = await parallel(
    """Analyze how market changes will impact this stakeholder group.
    Provide specific impacts and recommended actions.
    Format with clear sections and priorities.""",
    stakeholders
)

for stakeholder, result in zip(stakeholders, impact_results):
    show(result, stakeholder.split(':')[0])

Customers
---------

**Introduction**

As the market undergoes various changes, it is crucial to understand and address the impacts these changes may have on different stakeholder groups. Customers, particularly those who are price sensitive, demand better technology, and are concerned about environmental issues, will be influenced by shifting market dynamics. This analysis will explore these impacts and provide recommendations to help businesses adapt and meet customer expectations effectively.

---

**1. Price Sensitivity**

**Impact:**

- **Inflation and Raw Material Costs:** Rising inflation and increasing raw material costs can lead to higher product prices, which may affect price-sensitive customers adversely, causing them to cut back on spending or switch to more affordable alternatives.
- **Competitive Pricing Pressure:** Competitors might offer similar products at lower prices or provide discounts which may impact market share.

**Recommended Actions:**

- **Cost Optimization:** Streamline supply chain efficiencies and reduce operational costs to maintain or lower product prices.
- **Promotional Strategies:** Implement targeted promotions, discounts, and loyalty programs to retain price-sensitive customers.
- **Tiered Product Offerings:** Develop a range of products at different price points to cater to varying budgets without compromising on quality.

---

**2. Demand for Better Technology**

**Impact:**

- **Rapid Technological Advancements:** As technology evolves, customers expect the latest and most efficient solutions, which requires continual updates and innovation.
- **Increased Competition:** Competitors leveraging advanced technologies may attract customers seeking superior tech features and functionalities.

**Recommended Actions:**

- **Continuous R&D Investment:** Allocate resources for research and development to innovate and integrate cutting-edge technology into product offerings.
- **Customer Feedback Loop:** Engage customers actively to gather feedback on technological needs and preferences for future product development.
- **Collaborations and Partnerships:** Partner with tech companies or innovators to integrate advanced technology quickly and effectively into offerings.

---

**3. Environmental Concerns**

**Impact:**

- **Shift Towards Sustainable Products:** There's an increasing demand for environmentally-friendly products as customers become more conscious of their ecological footprint.
- **Regulatory Changes:** Stricter environmental regulations may necessitate changes in product design or manufacturing processes.

**Recommended Actions:**

- **Sustainable Practices:** Adopt sustainable practices across operations, from sourcing eco-friendly materials to reducing carbon emissions.
- **Transparent Communication:** Clearly communicate sustainability initiatives and certifications to customers, enhancing brand reputation and trust.
- **Eco-Innovation:** Focus on creating innovative green products that reduce environmental impact, using recyclable or biodegradable materials.

---

**Conclusion**

Understanding and addressing the needs of customers who are price sensitive, desire better technology, and are concerned about environmental impact are critical for businesses in adapting to market changes. By focusing on cost-effective strategies, technological advancements, and sustainable practices, organizations can not only meet customer expectations but also strengthen their market position. Prioritizing these actions will ensure long-term success and customer satisfaction.


Employees
---------

**Impact of Market Changes on Employees**

1. **Job Security Worries**
   - **Market Changes**: Economic downturns, industry disruptions through technological advancements, or organizational restructuring can lead to job cuts or reassignments.
   - **Impact**: Heightened anxiety and stress among employees, decreased productivity and motivation, potential increase in turnover as employees seek stability elsewhere.
   - **Recommended Actions**:
     - **Transparent Communication**: Regular updates from management about the company’s financial health and strategic direction can alleviate uncertainties.
     - **Employee Involvement**: Engage employees in problem-solving and innovation discussions to make them feel part of the solution and increase investment in the company’s future.
     - **Retention Programs**: Implement retention strategies such as competitive compensation packages, benefits, and recognition programs to reassure employees of their value to the company.

2. **Need for New Skills**
   - **Market Changes**: Rapid technological advancements and shifts in consumer demands require employees to adapt and acquire new competencies.
   - **Impact**: Skills gaps can hinder productivity and innovation, limiting both individual and company growth opportunities.
   - **Recommended Actions**:
     - **Training and Development**: Develop targeted training programs and workshops to upskill employees, focusing on current and anticipated industry needs.
     - **Mentorship Programs**: Pair less experienced employees with seasoned veterans to facilitate knowledge transfer and personal growth.
     - **Educational Support**: Offer subsidies or sponsorships for further education, certifications, or courses relevant to evolving market needs.

3. **Want for Clear Direction**
   - **Market Changes**: Shifting company goals and market positions can create confusion about priorities and individual roles.
   - **Impact**: Misalignment with company objectives, decreased engagement, and inefficiencies in workflow and resource allocation.
   - **Recommended Actions**:
     - **Strategic Alignment Sessions**: Conduct regular meetings and workshops where company leaders clarify strategic goals and how each team and individual contribute to these objectives.
     - **Structured Feedback Mechanisms**: Implement systems for employees to provide feedback and receive guidance on performance relative to the company’s direction.
     - **Leadership Accessibility**: Ensure that leaders are approachable and actively engage with employees, providing the necessary context and support to navigate market changes effectively.

**Priorities for Action**

1. **Enhance Communication and Transparency:**
   - Initiate clear and open lines of communication to address job security fears and convey market-driven changes in company strategy.

2. **Focus on Skill Development:**
   - Prioritize training initiatives that align employee capabilities with market demands to ensure long-term employability and company competitiveness.

3. **Define and Communicate Direction:**
   - Foster a strong, clear sense of strategic direction that resonates with all employees to align efforts across the organization. 

By addressing these priorities, companies can effectively mitigate the negative impacts of market changes on employees while empowering them with the confidence and capabilities needed to thrive.


Investors
---------

**Impact of Market Changes on Investors**

**1. Expectation of Growth**

*Current Market Trends*:
- Economic fluctuations and tech advancements are creating dynamic market conditions.
- There is an increasing focus on sustainable and socially responsible investments.

*Impacts on Investors*:
- Investors anticipating growth may encounter mixed results; sectors like technology and renewable energy may offer higher growth potential, while traditional sectors could face stagnation.
- Opportunities for investment in green technologies and digital transformation present potential for high returns.

*Recommended Actions*:
- Diversify investment portfolios to include emerging markets and growth-oriented sectors such as technology, renewable energy, and ESG-focused stocks.
- Conduct thorough market analysis to identify high-growth opportunities within trending sectors.
- Consider long-term growth strategies with an emphasis on sustainability and innovation.

**2. Desire for Cost Control**

*Current Market Trends*:
- Increasing operational costs due to inflation and supply chain disruptions.
- Companies are pressured to maintain profitability amidst rising expenses.

*Impacts on Investors*:
- Companies struggling with cost control may see reduced margins, affecting investor returns.
- Pressure on profit margins can lead to slower dividend growth and potential stock price volatility.

*Recommended Actions*:
- Evaluate companies with strong operating efficiencies and robust cost management strategies.
- Advocate for transparency and fiscal responsibility in companies’ financial practices.
- Support investments in companies leveraging technology to enhance productivity and cost savings.

**3. Risk Concerns**

*Current Market Trends*:
- Economic uncertainty, geopolitical tensions, and regulatory changes pose significant risks.
- Market volatility is heightened, impacting investment stability.

*Impacts on Investors*:
- Higher risk levels can lead to increased volatility in portfolio performance.
- Heightened geopolitical risks may affect global market accessibility and capital flows.

*Recommended Actions*:
- Implement a risk-based portfolio diversification strategy across various asset classes and geographies.
- Invest in hedge instruments or funds that cushion against market volatility.
- Regularly review and adjust the risk profile of investments in response to changing market conditions.

**Priorities for Investors**

1. **Focus on Growth Sectors**: Prioritize investments in sectors with high growth potential and those aligned with future trends, such as renewable energy and digital innovation.
2. **Cost Efficiency**: Invest in companies with strong cost control mechanisms and efficient operations to ensure sustained profitability.
3. **Risk Management**: Maintain a well-diversified portfolio to mitigate risks and navigate market volatility effectively.

By taking these actions, investors can align their strategies with current market dynamics, balancing growth potential with cost control and risk management.


Suppliers
---------

## Market Changes Impact on Suppliers

### 1. Capacity Constraints

#### Specific Impacts
- **Decreased Efficiency**: Suppliers experiencing capacity constraints may struggle to meet demand, leading to delayed shipments and potential disruptions in the supply chain.
- **Increased Operational Costs**: Efforts to expand capacity or enhance efficiency, such as hiring additional staff or investing in new equipment, could result in higher operational costs.
- **Customer Dissatisfaction**: Inability to meet delivery schedules may lead to customer dissatisfaction and potential loss of business to competitors who can manage demand better.

#### Recommended Actions
- **Optimize Current Resources**: Implement lean manufacturing practices to reduce waste and improve production efficiency.
- **Strategic Partnerships**: Form partnerships with other suppliers to share resources and balance capacity demands.
- **Flexible Sourcing Agreements**: Establish flexible contracts with clients that allow for demand fluctuations without severe penalties.

### 2. Price Pressures

#### Specific Impacts
- **Reduced Profit Margins**: Suppliers may face tightening profit margins due to inputs' rising costs and customers' demands for lower prices.
- **Competitive Disadvantages**: Suppliers unable to manage costs effectively may become less competitive compared to those who can offer lower prices.
- **Pressure for Cost Reductions**: Existing customer contracts might pressure suppliers to find innovative cost-reduction methods, impacting quality or service levels.

#### Recommended Actions
- **Cost Analysis and Control**: Conduct detailed cost analysis to identify opportunities for cost savings and areas where efficiencies can be implemented.
- **Diversify Supplier Base**: By sourcing materials from various suppliers, companies can mitigate price volatility and negotiate better terms.
- **Price Adjustment Strategies**: Introduce dynamic pricing models or renegotiate contracts to reflect market conditions without eroding customer relationships.

### 3. Tech Transitions

#### Specific Impacts
- **Investment Burden**: Transitioning to new technologies may require significant investment in equipment, training, and infrastructure.
- **Operational Disruptions**: Integrating new technologies can disrupt existing operations and require downtime for implementation and training.
- **Competitive Edge**: Suppliers that successfully adapt to tech transitions may gain a competitive advantage through increased efficiency and innovation.

#### Recommended Actions
- **Gradual Implementation**: Introduce new technologies incrementally to minimize disruptions and manage costs more effectively.
- **Training and Upskilling**: Invest in workforce training programs to ensure employees can efficiently use new technologies.
- **Collaboration with Tech Experts**: Partner with technology firms for expertise in seamless integration and optimization of new systems.

### Prioritization of Actions

1. **Address Immediate Capacity Constraints**: To prevent supply chain disruptions and customer dissatisfaction, optimizing current operations and forming strategic partnerships should be prioritized.
2. **Manage Price Pressures**: With immediate and long-term financial impacts, implementing cost control measures should be a top priority to maintain competitiveness.
3. **Plan and Invest in Technology Transitions**: While crucial for future competitiveness, technology transitions should be strategically planned to align with financial capabilities and operational readiness.

By addressing these areas, suppliers can better navigate market changes, maintain competitiveness, and ensure sustainable growth.