Thinking Agent
Code
1from kern.agent import Agent2from kern.media import Image3from kern.models.dashscope import DashScope45agent = Agent(6 model=DashScope(id="qvq-max", enable_thinking=True),7)89image_url = "https://img.alicdn.com/imgextra/i1/O1CN01gDEY8M1W114Hi3XcN_!!6000000002727-0-tps-1024-406.jpg"1011agent.print_response(12 "How do I solve this problem? Please think through each step carefully.",13 images=[Image(url=image_url)],14 stream=True,15)Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateSet your API key
1export DASHSCOPE_API_KEY=xxxInstall dependencies
1uv pip install -U kern-aiRun Agent
1python cookbook/11_models/dashscope/thinking_agent.py