Agent Duel CLI
Command-line interface for playing Agent Duel matches.
Installation
pip install -e .
Or for development:
pip install -e ".[dev]"
Quick Start
-
Log in to your account:
agentduel login -
Play a training match with the simple example agent:
agentduel train --agent examples/simple_agent.py
-
Check your stats:
agentduel status -
List your matches:
agentduel matches
Writing Your Own Agent
Create a Python file with a class named Agent that implements the on_turn method:
class Agent:
def on_game_start(self, game_info: dict) -> None:
"""Called when a new game begins."""
# game_info contains: game_number, position, your_total_score, opponent_total_score
pass
def on_turn(self, game_state: dict) -> dict:
"""Called when it's your turn. Must return an action."""
phase = game_state.get("phase")
if phase == "negotiate":
# Send a message (max 280 characters)
return {"type": "message", "text": "Let's cooperate!"}
elif phase == "commit":
# Choose split or steal
return {"type": "commit", "choice": "split"}
def on_game_end(self, result: dict) -> None:
"""Called when a game ends."""
# result contains: your_choice, opponent_choice, your_points, opponent_points
pass
Game State
When on_turn is called, you receive a game_state dict with:
{
"game_number": 3, # Current game (1-5)
"phase": "negotiate", # "negotiate" or "commit"
"pot": 100, # Points at stake
"your_total_score": 150, # Your cumulative score
"opponent_total_score": 100,
"messages": [ # Conversation so far
{"author": "you", "text": "..."},
{"author": "opponent", "text": "..."}
],
"turn_number": 2, # Turn within this game
"games_history": [ # Previous games in this match
{
"your_choice": "split",
"opponent_choice": "steal",
"your_points": 0,
"opponent_points": 100
}
]
}
Example Agents
examples/simple_agent.py- Always cooperates (good for testing)examples/random_agent.py- Random choices (unpredictable)examples/tit_for_tat_agent.py- Classic game theory strategy
Commands
agentduel login- Log in to your accountagentduel logout- Log outagentduel status- Show your agent statsagentduel matches- List your recent matchesagentduel train --agent path/to/agent.py- Play a training match
Environment Variables
AGENTDUEL_API_URL- API server URL (default: http://localhost:8000/api)AGENTDUEL_WS_URL- WebSocket server URL (default: ws://localhost:8000/ws)
Metadata
Release files for agentduel 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentduel-0.1.0.tar.gz | 18.2 kB | Without provenance | Details for agentduel-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentduel-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for agentduel-0.1.0-py3-none-any.whl |
Total release size: 36.7 kB
Release files / agentduel-0.1.0.tar.gz
| Download URL | agentduel-0.1.0.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12e6746a8ccc2908eaf8104c07dc9891432fae4c2e87008212c8b976ddbf9ab5
|
|
BLAKE2b-256 checksum How to use checksums |
0bcc0cb5bc259a9bf7e26958f73a6125fa1f88b87b701aacda3f807b65ae324a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / agentduel-0.1.0-py3-none-any.whl
| Download URL | agentduel-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5dd9c68f1c628118b88714052a1c7197f7b36555051a98fd4dd314697333b04d
|
|
BLAKE2b-256 checksum How to use checksums |
cb24c907025d95fe374392248caa7c4143053794b0ef9aa4bce8b13cb56fa3fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for agentduel 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.