Skip to content

Commit e7af1f5

Browse files
BCeZnclaude
andcommitted
docs: fix README — align with current implementation
- Move RockEnvironmentConfig to trial/config.py in file structure diagram - Remove duplicate environment: EnvironmentConfig from class diagram - Fix syntax errors in code examples (env: → env={) - Fix envs → env in 6.2 model_copy example - Fix stale sandbox_config in 3.3 async example - Fix OssRegistryInfo import (from rock.sdk.agent directly) - Fix environment field type in harbor fields table Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1bba1a1 commit e7af1f5

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

docs/dev/agent/README.md

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,14 @@ rock/sdk/agent/
5252
├── orchestrator_type.py # OrchestratorType (enum)
5353
├── job/
5454
│ ├── __init__.py
55-
│ ├── config.py # JobConfig, RockEnvironmentConfig,
56-
│ │ # OrchestratorConfig, RetryConfig
55+
│ ├── config.py # JobConfig, OrchestratorConfig, RetryConfig
5756
│ │ # OssRegistryInfo, RemoteRegistryInfo, LocalRegistryInfo
5857
│ │ # BaseDatasetConfig, LocalDatasetConfig, RegistryDatasetConfig
5958
│ └── result.py # JobResult, JobStatus
6059
├── trial/
6160
│ ├── __init__.py
62-
│ ├── config.py # AgentConfig, EnvironmentConfig, VerifierConfig
63-
│ │ # TaskConfig, ArtifactConfig
61+
│ ├── config.py # AgentConfig, EnvironmentConfig, RockEnvironmentConfig
62+
│ │ # VerifierConfig, TaskConfig, ArtifactConfig
6463
│ └── result.py # TrialResult, ExceptionInfo, AgentInfo, ModelInfo
6564
│ # AgentResult, VerifierResult, TimingInfo
6665
└── metric/
@@ -161,13 +160,6 @@ JobConfig (Pydantic, rock/sdk/agent/models/job/config.py)
161160
│ │ ├── wait_multiplier: float
162161
│ │ ├── min_wait_sec / max_wait_sec: float
163162
│ └── kwargs: dict[str, Any]
164-
├── environment: EnvironmentConfig
165-
│ ├── type: EnvironmentType
166-
│ ├── import_path: str | None
167-
│ ├── force_build / delete: bool
168-
│ ├── override_cpus / memory_mb / storage_mb / gpus
169-
│ ├── mounts_json: list[dict] | None
170-
│ ├── env / kwargs: dict
171163
├── verifier: VerifierConfig
172164
│ ├── override_timeout_sec / max_timeout_sec
173165
│ └── disable: bool
@@ -368,10 +360,9 @@ harbor jobs start -c /tmp/rock_job_xxx.yaml
368360
jobs = []
369361
for task in task_batch:
370362
config = JobConfig(
371-
sandbox_config=sandbox_cfg,
363+
environment=base_env,
372364
tasks=[task],
373365
agents=[agent_cfg],
374-
...
375366
)
376367
job = Job(config)
377368
await job.submit() # 启动后立即返回,不返回 job_id
@@ -463,7 +454,7 @@ JobConfig 分为两部分:Harbor 原生字段直接透传给 `harbor jobs star
463454
| `agent_setup_timeout_multiplier` | `float \| None` | `None` | `--agent-setup-timeout-multiplier` |
464455
| `environment_build_timeout_multiplier` | `float \| None` | `None` | `--environment-build-timeout-multiplier` |
465456
| `orchestrator` | `OrchestratorConfig` | `{}` | `-n`, `-r`, `--orchestrator` |
466-
| `environment` | `EnvironmentConfig` | `{}` | `-e`, `--ek`, `--ee` |
457+
| `environment` | `RockEnvironmentConfig` | `RockEnvironmentConfig()` | `-e`, `--ek`, `--ee` |
467458
| `agents` | `list[AgentConfig]` | `[AgentConfig()]` | `-a`, `-m`, `--ak`, `--ae` |
468459
| `datasets` | `list[...]` | `[]` | `-d`, `--dataset` |
469460
| `tasks` | `list[TaskConfig]` | `[]` | `-p/--path` |
@@ -516,8 +507,7 @@ LocalRegistryInfo(
516507
### 4.2 配置示例
517508

518509
```python
519-
from rock.sdk.agent import Job, JobConfig, RegistryDatasetConfig, AgentConfig, RockEnvironmentConfig
520-
from rock.sdk.agent.models.job.config import OssRegistryInfo
510+
from rock.sdk.agent import Job, JobConfig, RegistryDatasetConfig, AgentConfig, RockEnvironmentConfig, OssRegistryInfo
521511

522512
config = JobConfig(
523513
environment=RockEnvironmentConfig(
@@ -531,12 +521,11 @@ config = JobConfig(
531521
("/local/tasks", "/workspace/tasks"),
532522
("/local/config.yaml", "/workspace/config.yaml"),
533523
],
534-
env:
524+
env={
535525
"OSS_ACCESS_KEY_ID": "xxx",
536526
"OSS_ACCESS_KEY_SECRET": "yyy",
537527
},
538528
# Harbor advanced fields (optional)
539-
type="docker",
540529
force_build=True,
541530
delete=True,
542531
),
@@ -671,8 +660,7 @@ Harbor 生成的 trial 级 `result.json` 结构:
671660
### 6.1 基本用法 — TB2 Benchmark
672661

673662
```python
674-
from rock.sdk.agent import Job, JobConfig, RegistryDatasetConfig, AgentConfig, RockEnvironmentConfig
675-
from rock.sdk.agent.models.job.config import OssRegistryInfo
663+
from rock.sdk.agent import Job, JobConfig, RegistryDatasetConfig, AgentConfig, RockEnvironmentConfig, OssRegistryInfo
676664

677665
config = JobConfig(
678666
environment=RockEnvironmentConfig(
@@ -682,7 +670,7 @@ config = JobConfig(
682670
memory="16g",
683671
cpus=4,
684672
setup_commands=["pip install harbor --quiet"],
685-
env:
673+
env={
686674
"OSS_ACCESS_KEY_ID": "xxx",
687675
"OSS_ACCESS_KEY_SECRET": "yyy",
688676
},
@@ -731,7 +719,7 @@ class RockJobService(AgenticTaskService):
731719
async def submit_task(self, task_config: AgenticTaskConfig) -> TaskId:
732720
job_config = JobConfig(
733721
environment=self._base_env.model_copy(update={
734-
"envs": {
722+
"env": {
735723
"LLM_API_KEY": task_config.llm_config.api_key,
736724
"LLM_BASE_URL": task_config.infer_callback_url,
737725
},
@@ -781,7 +769,7 @@ async def run_rollout(task_path, agent_config):
781769
base_url="http://rock-admin:8080",
782770
memory="16g",
783771
setup_commands=["pip install harbor --quiet"],
784-
env:"LLM_API_KEY": "sk-xxx"},
772+
env={"LLM_API_KEY": "sk-xxx"},
785773
auto_stop=True,
786774
),
787775
tasks=[TaskConfig(path=task_path)],

0 commit comments

Comments
 (0)