Skip to content

Commit

Permalink
update test file
Browse files Browse the repository at this point in the history
  • Loading branch information
BowenBryanWang committed Feb 8, 2025
1 parent 77ae2e1 commit a9acfcd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 33 deletions.
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,21 @@ If the tests pass, your environment is ready!
> Check out our [Contributing Guide](CONTRIBUTING.md) to learn how you can plugin your agent to improve Computer Agent Arena!
### Test Customized Agents
Once you have implemented your agent, you can test it by running:
Once you have implemented your agent, you can add it to the test suite by adding a new test function in `test/test_agents.py`.
```bash
# Activate the virtual environment
source .env

# Run the tests
python test/test_agents.py --agent [your_agent_name]
# Run the tests and pass
python test/test_agents.py
```

After testing, submit a pull request (PR) with your implementation. Refer to the [Contributing Guide](CONTRIBUTING.md) for detailed instructions.

Once your PR is submitted, email us at [[email protected]](mailto:[email protected]) for further details.
Once your PR is submitted, email us at [here](mailto:[email protected]) for further details.

We really appreciate any contributions to improve Computer Agent Arena! If there are any questions, feel free to open an issue or contact us via [email](mailto:[email protected]).

## 📚 Documentation

For detailed information about the platform and APIs, refer to the official [Documentation](https://xlang-ai.github.io/computer-agent-arena).

## 📄 Citation

If you find this project useful, please consider citing our project:
Expand Down
39 changes: 14 additions & 25 deletions test/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
from AgentManager import SessionConfig
from hub.Anthropic.utils import APIProvider

env = DesktopEnv()
config = SessionConfig(
user_id="test_user",
session_id="test_session",
region="test_region",
agent_idx=0,
session=None,
conversation=None,
socketio=None,
stop_event=None
)

def get_api_key(key_name):
"""Get API key from environment variable API_KEYS"""
Expand All @@ -24,20 +35,7 @@ def get_api_key(key_name):

@pytest.mark.skipif(not get_api_key("ANTHROPIC_API_KEY"), reason="Anthropic API key not set")
def test_anthropic_agent():
# return True
"""Test agent prediction functionality"""
env = DesktopEnv()
config = SessionConfig(
user_id="test_user",
session_id="test_session",
region="test_region",
agent_idx=0,
session=None,
conversation=None,
socketio=None,
stop_event=None
)

agent = AnthropicComputerDemoAgent(
env=env,
obs_options=["screenshot"],
Expand All @@ -51,17 +49,6 @@ def test_anthropic_agent():
@pytest.mark.skipif(not get_api_key("OPENAI_API_KEY"), reason="OpenAI API key not set")
def test_prompt_agent():
"""Test prompt agent"""
env = DesktopEnv()
config = SessionConfig(
user_id="test_user",
session_id="test_session",
region="test_region",
agent_idx=0,
session=None,
conversation=None,
socketio=None,
stop_event=None
)
agent = PromptAgent(env=env,
model_name="gpt-4o-mini-2024-07-18",
obs_options=["screenshot"],
Expand All @@ -72,7 +59,9 @@ def test_prompt_agent():

# TODO: Add tests for customized agents
"""
def test_customized_agent():
@pytest.mark.skipif(not get_api_key("MY_KEY"), reason="MY_KEY not set")
def test_my_agent():
# Test your agent here
pass
"""

Expand Down

0 comments on commit a9acfcd

Please sign in to comment.