Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ddupont808
Copy link
Collaborator

This PR allows you to specify the api_key or api_base at the ComputerAgent level, which is then passed to LiteLLM. This allows you to write cleaner code without using env variables which are specific to providers.

Before: (Still works)

api_key = "sk-or-v1-examplekey123"

import os
os.environ["OPENROUTER_API_KEY"] = api_key
agent = ComputerAgent("openrouter/qwen/qwen3-vl-235b-a22b-instruct", tools=[computer])
async for _ in agent.run("Open Firefox and navigate to github.com"):
    pass

After:

api_key = "sk-or-v1-examplekey123"

agent = ComputerAgent("openrouter/qwen/qwen3-vl-235b-a22b-instruct", tools=[computer], api_key=api_key)
async for _ in agent.run("Open Firefox and navigate to github.com"):
    pass

or

api_key = "sk-or-v1-examplekey123"

agent = ComputerAgent("openrouter/qwen/qwen3-vl-235b-a22b-instruct", tools=[computer])
async for _ in agent.run("Open Firefox and navigate to github.com", api_key=api_key):
    pass

@codecov-commenter
Copy link

codecov-commenter commented Oct 30, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 15.00000% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
libs/python/agent/agent/agent.py 23.07% 10 Missing ⚠️
libs/python/agent/agent/loops/anthropic.py 0.00% 4 Missing ⚠️
libs/python/agent/agent/loops/glm45v.py 0.00% 2 Missing ⚠️
libs/python/agent/agent/loops/uitars.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ddupont808 ddupont808 merged commit 3a4827b into main Oct 31, 2025
9 of 11 checks passed
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.

3 participants