Skip to content

BaseEnv

Environment interface for agents.

Source code in utu/env/base_env.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class BaseEnv:
    """Environment interface for agents."""

    @abc.abstractmethod
    def get_state(self) -> str:
        """Get the current state of the environment."""
        raise NotImplementedError

    @abc.abstractmethod
    async def get_tools(self) -> list[Tool]:
        """Get the tools available in the environment."""
        raise NotImplementedError

    async def build(self):
        """Build the environment."""
        pass

    async def cleanup(self):
        """Cleanup the environment."""
        pass

    async def __aenter__(self):
        await self.build()
        return self

    async def __aexit__(self, exc_type, exc_val, exc_tb):
        await self.cleanup()

get_state abstractmethod

get_state() -> str

Get the current state of the environment.

Source code in utu/env/base_env.py
10
11
12
13
@abc.abstractmethod
def get_state(self) -> str:
    """Get the current state of the environment."""
    raise NotImplementedError

get_tools abstractmethod async

get_tools() -> list[Tool]

Get the tools available in the environment.

Source code in utu/env/base_env.py
15
16
17
18
@abc.abstractmethod
async def get_tools(self) -> list[Tool]:
    """Get the tools available in the environment."""
    raise NotImplementedError

build async

build()

Build the environment.

Source code in utu/env/base_env.py
20
21
22
async def build(self):
    """Build the environment."""
    pass

cleanup async

cleanup()

Cleanup the environment.

Source code in utu/env/base_env.py
24
25
26
async def cleanup(self):
    """Cleanup the environment."""
    pass