惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
V
Visual Studio Blog
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
B
Blog
I
InfoQ
博客园 - 三生石上(FineUI控件)
阮一峰的网络日志
阮一峰的网络日志
F
Fortinet All Blogs
H
Help Net Security
博客园 - Franky
宝玉的分享
宝玉的分享
博客园 - 司徒正美
C
Check Point Blog
G
Google Developers Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
MongoDB | Blog
MongoDB | Blog
云风的 BLOG
云风的 BLOG
A
About on SuperTechFans
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家

OpenAI Developers

API deployment checklist | OpenAI API Sora 2 Prompting Guide Codex Prompting Guide Docs MCP | OpenAI Developers Gpt-image-1.5 Prompting Guide GPT-5.2 Prompting Guide Transcribing User Audio with a Separate Realtime Request Modernizing your Codebase with Codex GitHub - openai/openai-sora-sample-app: Sample app to get started using the Video API with Sora GitHub - openai/openai-apps-sdk-examples: Example apps for the Apps SDK GitHub - openai/openai-chatkit-advanced-samples: Starter app to build with OpenAI ChatKit SDK GitHub - openai/openai-chatkit-starter-app: Starter app to build with OpenAI ChatKit + Agent Builder Rate limits | OpenAI API Web search | OpenAI API Getting started with datasets | OpenAI API Prompt optimizer | OpenAI API Verifying gpt-oss implementations How to run gpt-oss locally with LM Studio Fine-tuning with gpt-oss and Hugging Face Transformers How to run gpt-oss locally with Ollama Function calling | OpenAI API Models | OpenAI API Reasoning best practices | OpenAI API Reasoning models | OpenAI API Background mode | OpenAI API Batch API | OpenAI API Conversation state | OpenAI API File search | OpenAI API Flex processing | OpenAI API MCP and Connectors | OpenAI API
GitHub - openai/openai-support-agent-demo: Demo of a cust...
2025-07-18 · via OpenAI Developers

Customer Support Agent with Human in the Loop Demo

MIT License NextJS OpenAI API

This repository contains a NextJS demo app of a Customer Service with a Human in the loop (HITL) use case built on top of the Responses API. It leverages the file search built-in tool and implements 2 views of a chat interface: one for the customer, and one for the human agent.

This demo is an example flow where a human agent would be assisted by an AI agent to answer customer questions, while staying in control of sensitive actions.

screenshot

Features:

  • Multi-turn conversation handling
  • File search tool
  • Vector store creation & file upload for use with the file search
  • Knowledge base display
  • Function calling
  • Streaming suggested responses
  • Suggested actions to execute tool calls
  • Auto-execution of tool calls for non-sensitive actions

Feel free to customize this demo to suit your specific use case.

How to use

  1. Set up the OpenAI API:

  2. Clone the Repository:

    git clone https://github.com/openai/openai-support-agent-demo.git
  3. Set the OpenAI API key:

    2 options:

    • Set the OPENAI_API_KEY environment variable globally in your system
    • Set the OPENAI_API_KEY environment variable in the project: Create a .env file at the root of the project and add the following line (see .env.example for reference):
    OPENAI_API_KEY=<your_api_key>
  4. Install dependencies:

    Run in the project root:

  5. Run the app:

    The app will be available at http://localhost:3000.

  6. Initialize the vector store:

    Go to /init_vs to create a vector store and initialize it with the knowledge base. Once you have created the vector store, update config/constants.ts with your own vector store ID.

Demo Flow

To try out the demo, you can ask questions that will trigger a file search.

Example questions:

  • What is the return policy?
  • How do I return a product?
  • How can I cancel an order?

When an answer is generated, it will be displayed as a suggested response for the customer support representative. In the agent view, you can edit the message or send it as is.

You can also click on the "Relevant articles" to see the corresponding articles in the knowledge base or FAQ.

You can then continue the conversation as the user.

You can ask for help to trigger actions.

Example questions:

  • Help me cancel order ORD1001 => Should suggest the cancel_order action
  • Help me reset my password => Should suggest the reset_password action
  • Give me a list of my past orders => Should trigger the execution of get_order_history

End-to-end demo flow

  1. Ask as the user "How can I cancel my order?"
  2. Confirm the suggested response
  3. Ask as the user "Help me cancel order ORD1001"
  4. Confirm the suggested response
  5. Confirm the suggested action to cancel the order
  6. Confirm the suggested response

Limitations

Note that the functions that are executed are just placeholders and are not actually modifying any data, so the actions will not have any effect. For example, calling cancel_order won't change the status of the order.

Customization

To customize this demo you can:

  • Edit prompts, initial message and model in config/constants.ts
  • Edit available functions in config/tools-list.ts
  • Edit functions logic in config/functions.ts
  • (optional) Edit the demo data in config/demoData.ts

You can also customize the endpoints in the /api folder to call your own backend or external services.

If you want to use this code repository as a starting point for your own project in production, please note that this demo is not production-ready and that you would need to implement safety measures such as input guardrails, user authentication, etc.

Contributing

You are welcome to open issues or submit PRs to improve this app, however, please note that we may not review all suggestions.

License

This project is licensed under the MIT License. See the LICENSE file for details.