from plato.worlds import (
BaseWorld,
RunConfig,
Agent,
AgentConfig,
Secret,
Observation,
StepResult,
register_world,
)
from typing import Annotated
class CodeWorldConfig(RunConfig):
repository_url: str
prompt: str
coder: Annotated[AgentConfig, Agent(description="Coding agent")]
git_token: Annotated[str | None, Secret(description="GitHub token")] = None
@register_world("code")
class CodeWorld(BaseWorld[CodeWorldConfig]):
name = "code"
description = "Run coding agents on git repositories"
async def reset(self) -> Observation:
# Clone repository, setup environment
...
return Observation(data={"ready": True})
async def step(self) -> StepResult:
# Run agent
...
return StepResult(observation=Observation(data={"done": True}), done=True)