# Scenario with a reference agent (human), a validator agent (LLM), a generator agent (LLM), and a manager agent (AgentSpeak).

This example shows a manager agent that talks with a LLM-based generator agent and 
with a LLM-based validator agent to build a list of requirements from a short specification.

## Reference agent

The reference agent is the entry-point for the human user. 

The user is prompted to validate new requirements before they are effectively taken into account
by the manager for following generation steps. 

```bash
   python3 run_reference_agent.py
```
_The validator agent should run on port 9970._


## Validator agent

We use a validator agent from the `a2a-acl` source repository. 
That agent is implemented in Python, not in AgentSpeak. 

To run the validator agent :

```bash
    python3 PATH/TO/a2a-acl/sample_agents/llm_req_validator_2/run_validator_agent.py
```

That agent needs the `litellm` package installed. 

That agent uses _Mistral_ LLM but you can change the LLM used
(change the value of the variable `llm_model`). 
    
A convenient key must be available (`MISTRAL_API_KEY` for _Mistral_).

_The validator agent should run on port 9999._

## Generator agent

The generator agent is implemented in AgentSpeak and uses an LLM to generate atomic requirements.
Each request to that agent generates exactly one requirement.

Run the generator agent :

```bash
  python3 run_requirement_generator.py 
```

That agent needs the `litellm` package installed. 

That agent uses _Mistral_ LLM but you can change the LLM used
(change the value of the variable `llm_model`). 
    
A convenient key must be available (`MISTRAL_API_KEY` for _Mistral_).

_The generator agent should run on port 9990._

## Manager agent

The manager agents send requests to the generator agent, then submits the result to the validator agent.
On reply from the validator agent, according to the answer,
the manager will either stop, or ask new inputs to the generator.

The behavior of the manager is fully described by its AgentSpeak code (no LLM, no custom Python actions).

Run the manager agent:

```bash
    python3 run_manager.py 
```

_The manager agent should run on port 9981._

## Launch a test

A scenario can be triggered by sending two messages to the reference agent : one _tell_-message with the specification, and one _achieve_-message to start working.

```bash
    python3 run_test_client.py
```

## Parameters

* The specification is defined in `run_test_client.py` .

## Collaboration
Collaboration diagram:

![Collaboration diagram (interactive)](collaboration.drawio.svg)
