958 B
958 B
Publishing your agent
Once your agent behaves the way you want, you can expose it over HTTP so other clients can play against it.
You only need this if you want other programs to connect to your agent.
Use this repository
- Open
server.py. - Replace the agent passed to
PyServerwith your own. For example:
from agents.my_agent import MyAgent
player = PyServer(MyAgent())
- Start the server. Run:
python server.py
By default, the server listens on port 5000.
- Open your browser and visit
http://localhost:5000/. You should receive a JSON document describing your agent and the games it supports. If that works, your agent is ready to receive game requests.
Writing your own server
The included server is the easiest way to publish a Python agent.
If you want to implement the protocol yourself (for example in another language) you can use the specification in the protocol specification.