Skip to content

Conversation

@Zhuofeng-Li
Copy link

Overview

This commit introduces non-streaming asynchronous agents built on the Qwen-Agent framework, integrated with a vLLM server.

Usage

python examples/async_assistant_qwen_tool_call.py

Implementation Principles

1. Async Agent Architecture

The async agent implementation leverages asyncio and aiohttp for concurrent execution. All components are designed to align with the existing synchronous implementations closely:

  • AsyncAssistant: The main asynchronous agent class that follows the Assistant logic while enabling fully async execution.
  • TextChatAtOAIAsync: The asynchronous LLM interface that supports non-blocking OpenAI API calls.
  • Async Tools: Custom tools implement an async def call() method to support non-blocking I/O.

2. Key Components

# Async tool definition
@register_tool('get_weather')
class GetWeatherTool(BaseTool):
    async def call(self, params: str, **kwargs) -> str:
        # Async implementation here
        pass

# Async agent setup
bot = AsyncAssistant(
    llm={'model_type': 'oai_async', ...},
    function_list=['get_weather']
)

# Async execution
response = await bot.run(messages=messages)

3. Benefits of Async

  • Concurrent I/O: Non-blocking API calls and tool executions
  • Better Performance: Handle multiple requests simultaneously
  • Resource Efficiency: Lower memory footprint during I/O waits
  • Scalability: Suitable for production environments with high concurrency

Changes

  • Add AsyncAssitant and TextChatAtOAIAsync class
  • Add async example to examples/ directory

@Zhuofeng-Li Zhuofeng-Li changed the title Feature/async agent new Feature: support async qwen agent Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant