# Agenten Plattform # # (c) 2024 Magnus Bender # Institute of Humanities-Centered Artificial Intelligence (CHAI) # Universitaet Hamburg # https://www.chai.uni-hamburg.de/~bender # # source code released under the terms of GNU Public License Version 3 # https://www.gnu.org/licenses/gpl-3.0.txt """ ## Run as Agent The env. variable `AGENTS_LIST` is used to identify the agents classes/ task handlers. It must contain he the package name and a variable name in this package divided by `:`. Then, the variable contains a list of agent classes (subclasses of `ums.agent.agent.BasicAgent`) For example `AGENTS_LIST=ums.example.example:AGENT_CLASSES`, then in file `./ums/example/example.py` a variable `AGENT_CLASSES` exists. One line in this file, e.g., is `AGENT_CLASSES = [MyExtractAudioAgent, MyExtractImageAgent]`. When starting the Docker container of the agent, the classes specified in `AGENTS_LIST` are loaded and if the agent receives a task, the task is sent to the agent classes' `handle` methods. ## Run Single Task For development it might be cumbersome to always require a running management container and sending messages. Hence, tasks can be run manually from the terminal (still in the container and using the agent classes), but without having a management. This also uses the `AGENTS_LIST` env. variable, but the tasks are sent via command line: There are three ways to send a task (if the agent's Docker container is running): - `docker compose exec agent_all python -m ums.agent -d` - Run a dummy task - Possibly `agent_all` needs to be changed to the service name (see `docker-compose.yml`) of the agent's Docker container - `cat ./msg.json | docker compose exec -T agent_all python -m ums.agent -i` - Send the task (json of `AgentMessage`) via STDIN from file `./msg.json` to the agent - `docker compose exec agent_all python -m ums.agent -f msg.json` - Get the task from the json file, the files are searched for by full name, in the shared, and the persistent directory. If the Agent's Docker container is not running, a temporary container can be started. For the dummy message, the command would be `docker compose run --rm --entrypoint "" agent_all python -m ums.agent -d`. (Again, change `agent_all` for the service name in `docker-compose.yml`.) """ from ums.agent.agent import ( AgentCapability, BasicAgent, ExtractAgent, ExtractAudioAgent, ExtractImageAgent, ExtractTextAgent, SolveAgent, GatekeeperAgent )