@@ -23,14 +23,13 @@ The best way to understand AgentOS is to use it, so let’s install agentos and
23
23
write a simple agent in Python that behaves randomly. Installation is easy::
24
24
25
25
$ pip install agentos
26
- $ pip install gym # AgentOS uses OpenAI Gym's Environment abstraction.
27
26
28
27
Writing a trivial agent is also easy::
29
28
30
29
# Save this code in ./simple_agent.py
31
- from agentos import Agent
30
+ import agentos
32
31
33
- class SimpleAgent(Agent):
32
+ class SimpleAgent(agentos. Agent):
34
33
def advance(self):
35
34
obs, reward, done, _ = self.env.step(self.env.action_space.sample())
36
35
print(f"Took a random step, done = {done}.")
@@ -76,7 +75,8 @@ Now, instead of writing our own while loop, let’s run the agent in a Python
76
75
Thread using a convenience function that AgentOS provides which serves as an
77
76
Agent Runner::
78
77
79
- >>> agentos.run_agent(SimpleAgent, CartPoleEnv)
78
+ >>> from agentos import run_agent
79
+ >>> run_agent(SimpleAgent, CartPoleEnv)
80
80
Took a random step, done = False.
81
81
…
82
82
Took a random step, done = False.
@@ -94,8 +94,9 @@ As an alternative to using our custom agent above, let’s go back into the
94
94
Python shell we opened above and use AgentOS’s RandomAgent::
95
95
96
96
>>> from agentos.agents import RandomAgent
97
+ >>> from agentos import run_agent
97
98
>>> from gym.envs.classic_control import CartPoleEnv
98
- >>> agentos. run_agent(RandomAgent, CartPoleEnv)
99
+ >>> run_agent(RandomAgent, CartPoleEnv)
99
100
Took a random step, done = False.
100
101
…
101
102
Took a random step, done = False.
0 commit comments