Skip to content

fsajjad/OpenAI-SDK-shopify-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI-SDK-shopify-agent

A Shopify MCP (Model Context Protocol) agent built with the OpenAI Agent SDK, featuring real-time streaming responses and AWS Bedrock Claude integration.

Features

  • 🤖 AI Agent: Built with OpenAI Agent SDK for intelligent product recommendations
  • 🛍️ Shopify MCP Integration: Connects to Shopify stores via MCP protocol
  • Real-time Streaming: Live streaming of agent responses as they're generated
  • ☁️ AWS Bedrock: Uses Claude 3.7 Sonnet via AWS Bedrock for powerful AI capabilities
  • 🔧 LiteLLM: Unified interface for multiple LLM providers

Project Structure

├── main.py                    # Basic agent implementation
├── main_advanced_streaming.py # Advanced streaming agent
├── requirements.txt           # Python dependencies
├── .env.example              # Environment variables template
└── examples/
    └── simple_example.py     # Usage examples

Setup

  1. Install Dependencies

    pip install -r requirements.txt
  2. Configure Environment

    cp .env.example .env
    # Edit .env with your credentials
  3. Required Environment Variables

    # AWS Configuration
    AWS_ACCESS_KEY_ID=your_access_key
    AWS_SECRET_ACCESS_KEY=your_secret_key
    AWS_DEFAULT_REGION=us-east-1
    
    # Shopify Store Configuration
    SHOPIFY_STORE_DOMAIN=your-store.myshopify.com

Usage

Basic Agent

python3 main.py

Streaming Agent

python3 main_advanced_streaming.py

Features Demonstrated

  • Real-time Streaming: Character-by-character streaming of AI responses
  • MCP Tool Integration: Automatic discovery and use of Shopify MCP tools
  • AWS Bedrock: Claude 3.7 Sonnet integration via LiteLLM
  • Error Handling: Graceful fallback when MCP tools are unavailable
  • Product Search: Intelligent product recommendations and search

Technical Details

  • Agent SDK Version: 0.2.11 (downgraded to avoid logprobs validation issues)
  • Model: Claude 3.7 Sonnet via AWS Bedrock
  • MCP Endpoint: https://happywax.com/api/mcp (working example)
  • Streaming: Real-time event processing with Runner.run_streamed()

Troubleshooting

MCP Connection Issues

If you encounter MCP connection errors, ensure:

  • The Shopify store has MCP enabled
  • The MCP endpoint is accessible
  • The store domain is correct

Streaming Issues

For streaming problems:

  • Use Agent SDK version 0.2.11 or earlier
  • Check AWS credentials are properly configured
  • Verify Bedrock model access permissions

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

MIT License - see LICENSE file for details

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages