{"name":"Qwen-Agent: A Comprehensive Framework for LLM Applications and Agent Development","description":"Qwen-Agent is a powerful framework designed for developing advanced Large Language Model (LLM) applications, built upon Qwen models. It offers robust capabilities including function calling, a code interpreter, RAG, and multi-context protocol (MCP) support. The framework enables developers to create sophisticated AI agents with planning, tool usage, and memory features, serving as the backend for applications like Qwen Chat.","github":"https://github.com/QwenLM/Qwen-Agent","url":"https://osrepos.com/repo/qwenlm-qwen-agent","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/qwenlm-qwen-agent","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/qwenlm-qwen-agent.md","json":"https://osrepos.com/repo/qwenlm-qwen-agent.json","topics":["Python","LLM","AI Agents","Framework","Function Calling","Code Interpreter","RAG","Qwen"],"keywords":["Python","LLM","AI Agents","Framework","Function Calling","Code Interpreter","RAG","Qwen"],"stars":null,"summary":"Qwen-Agent is a powerful framework designed for developing advanced Large Language Model (LLM) applications, built upon Qwen models. It offers robust capabilities including function calling, a code interpreter, RAG, and multi-context protocol (MCP) support. The framework enables developers to create sophisticated AI agents with planning, tool usage, and memory features, serving as the backend for applications like Qwen Chat.","content":"## Introduction\n\nQwen-Agent is an innovative framework for building and deploying sophisticated Large Language Model (LLM) applications. It leverages the advanced capabilities of Qwen models, particularly Qwen>=3.0, to provide a comprehensive toolkit for agent development. The framework is designed to facilitate instruction following, efficient tool usage, intelligent planning, and robust memory management for AI agents.\n\nKey features of Qwen-Agent include:\n\n*   **Function Calling**: Enables agents to interact with external tools and APIs.\n*   **Multi-Context Protocol (MCP)**: Supports advanced context management and tool integration.\n*   **Code Interpreter**: Allows agents to write and execute code within a sandboxed environment.\n*   **Retrieval Augmented Generation (RAG)**: Enhances LLM responses with external knowledge.\n*   **Browser Assistant**: Provides an example application for web interaction.\n*   **Chrome Extension**: Extends agent capabilities to browser environments.\n\nQwen-Agent also serves as the powerful backend for [Qwen Chat](https://chat.qwen.ai/), demonstrating its real-world applicability and scalability.\n\n## Installation\n\nGetting started with Qwen-Agent is straightforward. You can install it via pip or from the source repository.\n\n**Install from PyPI (stable version):**\n\nbash\npip install -U \"qwen-agent[gui,rag,code_interpreter,mcp]\"\n# For minimal requirements:\npip install -U qwen-agent\n\n\nThe optional requirements in double brackets provide support for:\n*   `[gui]` for Gradio-based GUI support\n*   `[rag]` for RAG support\n*   `[code_interpreter]` for Code Interpreter support\n*   `[mcp]` for MCP support\n\n**Install from source (latest development version):**\n\nbash\ngit clone https://github.com/QwenLM/Qwen-Agent.git\ncd Qwen-Agent\npip install -e ./\"[gui,rag,code_interpreter,mcp]\"\n# For minimal requirements:\npip install -e ./\n\n\nAfter installation, ensure you configure your LLM service, either using Alibaba Cloud's [DashScope](https://help.aliyun.com/zh/dashscope/developer-reference/quick-start) with an API key or by deploying your own OpenAI-compatible model service (e.g., with vLLM or Ollama).\n\n## Examples\n\nQwen-Agent provides a rich set of examples to help you develop your own agents and applications. Here are some highlights:\n\n*   **Developing Your Own Agent**: The framework offers atomic components like LLMs with function calling and `BaseTool` for custom tools, alongside high-level `Agent` classes. You can easily create agents capable of reading files, using built-in tools like `code_interpreter`, and integrating custom functionalities.\n\n    python\n    from qwen_agent.agents import Assistant\n    from qwen_agent.tools.base import BaseTool, register_tool\n    import json5\n    import urllib.parse\n\n    @register_tool('my_image_gen')\n    class MyImageGen(BaseTool):\n        description = 'AI painting (image generation) service, input text description, and return the image URL drawn based on text information.'\n        parameters = [{\n            'name': 'prompt',\n            'type': 'string',\n            'description': 'Detailed description of the desired image content, in English',\n            'required': True\n        }]\n\n        def call(self, params: str, **kwargs) -> str:\n            prompt = json5.loads(params)['prompt']\n            prompt = urllib.parse.quote(prompt)\n            return json5.dumps({'image_url': f'https://image.pollinations.ai/prompt/{prompt}'}, ensure_ascii=False)\n\n    llm_cfg = {\n        'model': 'qwen-max-latest',\n        'model_type': 'qwen_dashscope',\n        # 'api_key': 'YOUR_DASHSCOPE_API_KEY',\n    }\n\n    bot = Assistant(llm=llm_cfg,\n                    system_message='''After receiving the user's request, you should:\n    - first draw an image and obtain the image url,\n    - then run code `request.get(image_url)` to download the image,\n    - and finally select an image operation from the given document to process the image.\n    Please show the image using `plt.show()`.''',\n                    function_list=['my_image_gen', 'code_interpreter'],\n                    files=['./examples/resource/doc.pdf'])\n\n    # Example chat loop\n    # messages = []\n    # while True:\n    #     query = input('\\nuser query: ')\n    #     messages.append({'role': 'user', 'content': query})\n    #     for response in bot.run(messages=messages):\n    #         # Streaming output logic\n    #         pass\n    #     messages.extend(response)\n    \n\n*   **Gradio Web UI**: The framework includes a convenient Gradio-based web UI for rapid deployment and interaction with your agents.\n\n    python\n    from qwen_agent.gui import WebUI\n    # Assuming 'bot' is your configured agent instance\n    # WebUI(bot).run()\n    \n\n*   **Code Interpreter**: Learn how to enable and use the built-in `code_interpreter` tool, which executes code securely in Docker containers.\n*   **MCP (Model Context Protocol)**: Explore examples demonstrating how to integrate and utilize MCP servers for enhanced context and tool management.\n*   **Function Calling**: Detailed examples showcase the native support for parallel function calls within the LLM classes.\n*   **RAG for Long Documents**: Discover solutions for question-answering over super-long documents, outperforming native long-context models in efficiency and accuracy.\n\nMore usage examples can be found in the [examples directory](https://github.com/QwenLM/Qwen-Agent/tree/main/examples) of the repository.\n\n## Why Use Qwen-Agent?\n\nQwen-Agent stands out as a robust choice for LLM application development due to several compelling reasons:\n\n*   **Comprehensive Agent Capabilities**: It provides a full suite of features for building intelligent agents, including advanced planning, memory, and tool-use mechanisms, all built on the powerful Qwen models.\n*   **Rich Tool Ecosystem**: With built-in support for function calling, a secure code interpreter (Docker-based), and integration with the Multi-Context Protocol (MCP), agents can interact with a wide array of external services and perform complex tasks.\n*   **Scalability and Performance**: The framework is designed for efficiency, offering solutions like fast RAG for handling super-long documents, which can outperform traditional long-context models.\n*   **Flexibility and Customization**: Developers can easily extend the framework by creating custom tools and agents, adapting it to specific use cases and requirements.\n*   **Practical Applications**: Qwen-Agent powers real-world applications like Qwen Chat and BrowserQwen, demonstrating its effectiveness and reliability in production environments.\n*   **Active Development and Community**: The project is actively maintained by the Qwen team, with continuous updates and a growing community, ensuring ongoing support and innovation.\n\n## Links\n\n*   **GitHub Repository**: [https://github.com/QwenLM/Qwen-Agent](https://github.com/QwenLM/Qwen-Agent){:target=\"_blank\"}\n*   **Qwen Chat**: [https://chat.qwen.ai/](https://chat.qwen.ai/){:target=\"_blank\"}\n*   **Hugging Face**: [https://huggingface.co/Qwen](https://huggingface.co/Qwen){:target=\"_blank\"}\n*   **ModelScope**: [https://modelscope.cn/organization/qwen](https://modelscope.cn/organization/qwen){:target=\"_blank\"}\n*   **Documentation**: [https://qwenlm.github.io/Qwen-Agent/en/](https://qwenlm.github.io/Qwen-Agent/en/){:target=\"_blank\"}\n*   **Discord**: [https://discord.gg/CV4E9rpNSD](https://discord.gg/CV4E9rpNSD){:target=\"_blank\"}","metrics":{"detailViews":4,"githubClicks":5},"dates":{"published":null,"modified":"2026-04-01T19:32:17.000Z"}}