googleapis / googleapis/python-aiplatform

Bug: `async_stream_query` not async

Open
#5,773 2 comments 0 reactions 0 assignees View on GitHub
api: vertex-ai
Dominant language
Python
Stars
905
Forks
465
Avg merge
1d 13h
Merged PRs (30d)
44

Description

#### Environment details

- OS type and version: Linux 6.6.87.2-microsoft-standard-WSL2
- Python version: Python 3.11.9
- pip version: pip 25.2
- `google-cloud-aiplatform` version: 1.111.0

#### Steps to reproduce

1. Deploy a simple adk agent.
2. Run multiple async functions to call the agent's `async_stream_query` method.

#### Code example

```python
async def run_query(app, uid):
prompt = 'some prompts have delayed responses'
session = await app.async_create_session(user_id=uid)
async for event in app.async_stream_query(
user_id=uid,
session_id=session['id'],
message=prompt,
):
print(event)
await app.async_delete_session(user_id=uid, session_id=session['id'])

async def run():
agent = agent_engines.get(AGENT_ID)
await asyncio.gather(
run_query(agent, 'u1'),
run_query(agent, 'u2'),
run_query(agent, 'u3'),
)

if __name__ == '__main__':
asyncio.run(run())
```

#### Result

The requests are not sent concurrently to the Vertex AI Agent Engine.

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.