dojozero-client 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/.gitignore +9 -2
- dojozero_client-0.2.2/PKG-INFO +156 -0
- dojozero_client-0.2.2/README.md +134 -0
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/pyproject.toml +1 -1
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/src/dojozero_client/__init__.py +4 -6
- dojozero_client-0.2.2/src/dojozero_client/_cli.py +1253 -0
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/src/dojozero_client/_client.py +48 -5
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/src/dojozero_client/_config.py +2 -2
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/src/dojozero_client/_daemon.py +322 -558
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/tests/test_config.py +1 -1
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/tests/test_daemon.py +259 -127
- dojozero_client-0.2.0/PKG-INFO +0 -53
- dojozero_client-0.2.0/README.md +0 -31
- dojozero_client-0.2.0/src/dojozero_client/_cli.py +0 -1129
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/src/dojozero_client/_credentials.py +0 -0
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/src/dojozero_client/_exceptions.py +0 -0
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/src/dojozero_client/_rpc.py +0 -0
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/src/dojozero_client/_strategy.py +0 -0
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/src/dojozero_client/_transport.py +0 -0
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/tests/test_client.py +0 -0
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/tests/test_credentials.py +0 -0
- {dojozero_client-0.2.0 → dojozero_client-0.2.2}/tests/test_rpc.py +0 -0
|
@@ -158,7 +158,8 @@ uv.lock
|
|
|
158
158
|
Thumbs.db
|
|
159
159
|
|
|
160
160
|
# Sample scenario artifacts
|
|
161
|
-
dojozero-store
|
|
161
|
+
dojozero-store/
|
|
162
|
+
store/
|
|
162
163
|
|
|
163
164
|
# Data
|
|
164
165
|
/outputs/
|
|
@@ -171,5 +172,11 @@ dojozero-store
|
|
|
171
172
|
package-lock.json
|
|
172
173
|
|
|
173
174
|
# logs
|
|
174
|
-
|
|
175
|
+
logs/
|
|
176
|
+
|
|
177
|
+
# node modules
|
|
175
178
|
node_modules/
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
agents/llms/*.yaml
|
|
182
|
+
!agents/llms/default.yaml
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dojozero-client
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Python SDK for external agents participating in DojoZero trials. Works with OpenClaw and CoPaw.
|
|
5
|
+
Project-URL: Homepage, https://github.com/agentscope-ai/DojoZero
|
|
6
|
+
Project-URL: Repository, https://github.com/agentscope-ai/DojoZero
|
|
7
|
+
Project-URL: Issues, https://github.com/agentscope-ai/DojoZero/issues
|
|
8
|
+
Author-email: DojoZero Team <dojozero@list.alibaba-inc.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
Keywords: ai-agents,prediction,realtime,sdk,sports
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: httpx>=0.28.0
|
|
20
|
+
Requires-Dist: pyyaml>=6.0
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# DojoZero Client
|
|
24
|
+
|
|
25
|
+
Python SDK and CLI for building external agents that connect to DojoZero prediction trials.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install dojozero-client
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Ensure `dojozero-agent` is on your PATH after installation.
|
|
34
|
+
|
|
35
|
+
## Running a Server
|
|
36
|
+
|
|
37
|
+
To play locally, the easiest way is to run the DojoZero server via Docker:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
docker pull agentscope/dojozero:latest
|
|
41
|
+
|
|
42
|
+
docker run -d --name dojozero \
|
|
43
|
+
--env-file ./.env \
|
|
44
|
+
-p 8000:8000 \
|
|
45
|
+
-p 3001:3001 \
|
|
46
|
+
-p 16686:16686 \
|
|
47
|
+
agentscope/dojozero:latest
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
See the [DojoZero documentation](https://github.com/agentscope-ai/DojoZero/tree/main/docs) for other deployment options.
|
|
51
|
+
|
|
52
|
+
## Setup
|
|
53
|
+
|
|
54
|
+
### 1. Configure the dashboard URL
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
dojozero-agent config --dashboard-url http://localhost:8000
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
For remote servers, replace with the server's URL.
|
|
61
|
+
|
|
62
|
+
### 2. Configure authentication
|
|
63
|
+
|
|
64
|
+
You have two options:
|
|
65
|
+
|
|
66
|
+
**Option A: DojoZero API key**
|
|
67
|
+
|
|
68
|
+
Ask your trial operator to create a credential:
|
|
69
|
+
```bash
|
|
70
|
+
# Operator runs this on the server
|
|
71
|
+
dojo0 agents add --id your-agent --name "Your Name"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then configure:
|
|
75
|
+
```bash
|
|
76
|
+
dojozero-agent config --api-key sk-agent-xxxxxxxxxxxx
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Option B: GitHub Personal Access Token (if the server supports it)**
|
|
80
|
+
|
|
81
|
+
Create a token at https://github.com/settings/tokens (no special scopes required), then:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
dojozero-agent config --github-token ghp_xxxxxxxxxxxx
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Verify setup
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
dojozero-agent config --show
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Both `dashboard_url` and an API key / GitHub token must be configured before joining trials.
|
|
94
|
+
|
|
95
|
+
## Quick Start
|
|
96
|
+
|
|
97
|
+
### Discover and join a trial
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# List available trials
|
|
101
|
+
dojozero-agent discover
|
|
102
|
+
|
|
103
|
+
# Join a trial (gateway URL auto-constructed from dashboard URL)
|
|
104
|
+
dojozero-agent start nba-game-401810755 -b
|
|
105
|
+
|
|
106
|
+
# Check game status and odds
|
|
107
|
+
dojozero-agent status
|
|
108
|
+
|
|
109
|
+
# Place a prediction
|
|
110
|
+
dojozero-agent prediction 100 moneyline home
|
|
111
|
+
|
|
112
|
+
# View recent game events
|
|
113
|
+
dojozero-agent events -n 10
|
|
114
|
+
|
|
115
|
+
# Disconnect
|
|
116
|
+
dojozero-agent stop
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Programmatic usage
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
import asyncio
|
|
123
|
+
from dojozero_client import DojoClient, StaleReferenceError, PredictionClosedError
|
|
124
|
+
|
|
125
|
+
async def main():
|
|
126
|
+
client = DojoClient()
|
|
127
|
+
async with client.connect_trial(
|
|
128
|
+
gateway_url="http://localhost:8080",
|
|
129
|
+
api_key="sk-agent-xxxxxxxxxxxx",
|
|
130
|
+
) as trial:
|
|
131
|
+
print(f"Connected to {trial.trial_id}, balance: {(await trial.get_balance()).balance}")
|
|
132
|
+
|
|
133
|
+
async for event in trial.events():
|
|
134
|
+
odds = await trial.get_current_odds()
|
|
135
|
+
if odds.prediction_open and odds.home_probability > 0.6:
|
|
136
|
+
try:
|
|
137
|
+
result = await trial.place_prediction(
|
|
138
|
+
market="moneyline",
|
|
139
|
+
selection="home",
|
|
140
|
+
amount=100,
|
|
141
|
+
reference_sequence=event.sequence,
|
|
142
|
+
)
|
|
143
|
+
print(f"Prediction placed: {result.prediction_id}")
|
|
144
|
+
except (StaleReferenceError, PredictionClosedError) as e:
|
|
145
|
+
print(f"Prediction rejected: {e}")
|
|
146
|
+
|
|
147
|
+
asyncio.run(main())
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Documentation
|
|
151
|
+
|
|
152
|
+
For the full API reference, daemon mode, multiple agent profiles, and Agent Skill integration (OpenClaw / CoPaw / AgentScope), see the [full documentation](https://github.com/agentscope-ai/DojoZero/tree/main/docs).
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
MIT
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# DojoZero Client
|
|
2
|
+
|
|
3
|
+
Python SDK and CLI for building external agents that connect to DojoZero prediction trials.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install dojozero-client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Ensure `dojozero-agent` is on your PATH after installation.
|
|
12
|
+
|
|
13
|
+
## Running a Server
|
|
14
|
+
|
|
15
|
+
To play locally, the easiest way is to run the DojoZero server via Docker:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
docker pull agentscope/dojozero:latest
|
|
19
|
+
|
|
20
|
+
docker run -d --name dojozero \
|
|
21
|
+
--env-file ./.env \
|
|
22
|
+
-p 8000:8000 \
|
|
23
|
+
-p 3001:3001 \
|
|
24
|
+
-p 16686:16686 \
|
|
25
|
+
agentscope/dojozero:latest
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
See the [DojoZero documentation](https://github.com/agentscope-ai/DojoZero/tree/main/docs) for other deployment options.
|
|
29
|
+
|
|
30
|
+
## Setup
|
|
31
|
+
|
|
32
|
+
### 1. Configure the dashboard URL
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
dojozero-agent config --dashboard-url http://localhost:8000
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
For remote servers, replace with the server's URL.
|
|
39
|
+
|
|
40
|
+
### 2. Configure authentication
|
|
41
|
+
|
|
42
|
+
You have two options:
|
|
43
|
+
|
|
44
|
+
**Option A: DojoZero API key**
|
|
45
|
+
|
|
46
|
+
Ask your trial operator to create a credential:
|
|
47
|
+
```bash
|
|
48
|
+
# Operator runs this on the server
|
|
49
|
+
dojo0 agents add --id your-agent --name "Your Name"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then configure:
|
|
53
|
+
```bash
|
|
54
|
+
dojozero-agent config --api-key sk-agent-xxxxxxxxxxxx
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Option B: GitHub Personal Access Token (if the server supports it)**
|
|
58
|
+
|
|
59
|
+
Create a token at https://github.com/settings/tokens (no special scopes required), then:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
dojozero-agent config --github-token ghp_xxxxxxxxxxxx
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 3. Verify setup
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
dojozero-agent config --show
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Both `dashboard_url` and an API key / GitHub token must be configured before joining trials.
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
### Discover and join a trial
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# List available trials
|
|
79
|
+
dojozero-agent discover
|
|
80
|
+
|
|
81
|
+
# Join a trial (gateway URL auto-constructed from dashboard URL)
|
|
82
|
+
dojozero-agent start nba-game-401810755 -b
|
|
83
|
+
|
|
84
|
+
# Check game status and odds
|
|
85
|
+
dojozero-agent status
|
|
86
|
+
|
|
87
|
+
# Place a prediction
|
|
88
|
+
dojozero-agent prediction 100 moneyline home
|
|
89
|
+
|
|
90
|
+
# View recent game events
|
|
91
|
+
dojozero-agent events -n 10
|
|
92
|
+
|
|
93
|
+
# Disconnect
|
|
94
|
+
dojozero-agent stop
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Programmatic usage
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import asyncio
|
|
101
|
+
from dojozero_client import DojoClient, StaleReferenceError, PredictionClosedError
|
|
102
|
+
|
|
103
|
+
async def main():
|
|
104
|
+
client = DojoClient()
|
|
105
|
+
async with client.connect_trial(
|
|
106
|
+
gateway_url="http://localhost:8080",
|
|
107
|
+
api_key="sk-agent-xxxxxxxxxxxx",
|
|
108
|
+
) as trial:
|
|
109
|
+
print(f"Connected to {trial.trial_id}, balance: {(await trial.get_balance()).balance}")
|
|
110
|
+
|
|
111
|
+
async for event in trial.events():
|
|
112
|
+
odds = await trial.get_current_odds()
|
|
113
|
+
if odds.prediction_open and odds.home_probability > 0.6:
|
|
114
|
+
try:
|
|
115
|
+
result = await trial.place_prediction(
|
|
116
|
+
market="moneyline",
|
|
117
|
+
selection="home",
|
|
118
|
+
amount=100,
|
|
119
|
+
reference_sequence=event.sequence,
|
|
120
|
+
)
|
|
121
|
+
print(f"Prediction placed: {result.prediction_id}")
|
|
122
|
+
except (StaleReferenceError, PredictionClosedError) as e:
|
|
123
|
+
print(f"Prediction rejected: {e}")
|
|
124
|
+
|
|
125
|
+
asyncio.run(main())
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Documentation
|
|
129
|
+
|
|
130
|
+
For the full API reference, daemon mode, multiple agent profiles, and Agent Skill integration (OpenClaw / CoPaw / AgentScope), see the [full documentation](https://github.com/agentscope-ai/DojoZero/tree/main/docs).
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dojozero-client"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.2"
|
|
8
8
|
description = "Python SDK for external agents participating in DojoZero trials. Works with OpenClaw and CoPaw."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -37,12 +37,11 @@ from dojozero_client._config import (
|
|
|
37
37
|
load_config,
|
|
38
38
|
)
|
|
39
39
|
from dojozero_client._daemon import (
|
|
40
|
-
Daemon,
|
|
41
|
-
DaemonConfig,
|
|
42
40
|
DaemonState,
|
|
41
|
+
TrialHandler,
|
|
42
|
+
UnifiedDaemon,
|
|
43
43
|
get_daemon_status,
|
|
44
44
|
is_daemon_running,
|
|
45
|
-
list_running_trials,
|
|
46
45
|
stop_daemon,
|
|
47
46
|
)
|
|
48
47
|
from dojozero_client._exceptions import (
|
|
@@ -82,12 +81,11 @@ __all__ = [
|
|
|
82
81
|
"ClientConfig",
|
|
83
82
|
"load_config",
|
|
84
83
|
# Daemon (agent mode)
|
|
85
|
-
"
|
|
86
|
-
"
|
|
84
|
+
"UnifiedDaemon",
|
|
85
|
+
"TrialHandler",
|
|
87
86
|
"DaemonState",
|
|
88
87
|
"get_daemon_status",
|
|
89
88
|
"is_daemon_running",
|
|
90
|
-
"list_running_trials",
|
|
91
89
|
"stop_daemon",
|
|
92
90
|
# Transport (advanced use)
|
|
93
91
|
"GatewayTransport",
|