# tiny-agents

[tiny-agents](https://huggingface.co/blog/python-tiny-agents) propose un modèle minimal pour créer des agents utilisant des outils. Une petite boucle Python connecte un client MCP aux outils fournis par des serveurs MCP. Les Hugging Face Spaces fonctionnent comme des serveurs MCP. Trouvez d'autres Spaces compatibles sur le [Hub](https://huggingface.co/spaces?filter=mcp-server).

Créez un fichier de configuration qui pointe vers votre modèle local et le serveur d’outils. Cet exemple utilise un [Space](https://evalstate-flux1-schnell.hf.space/) de génération d’images.

```json
{
    "model": "Menlo/Jan-nano",
    "endpointUrl": "http://localhost:8000",
    "servers": [
        {
            "type": "sse",
            "url": "https://evalstate-flux1-schnell.hf.space/gradio_api/mcp/sse"
        }
    ]
}
```

Lancez l'agent avec votre configuration.

```bash
tiny-agents run path/to/your/config.json
```

Vérifiez que `transformers serve` est en cours d'exécution en arrière-plan. L'agent utilisera votre modèle local pour exécuter l'outil de génération d'images.

```bash
Agent loaded with 1 tools:
 • flux1_schnell_infer
»  Generate an image of a cat on the moon
<Tool req_0_tool_call>flux1_schnell_infer {"prompt": "a cat on the moon", "seed": 42, "randomize_seed": true, "width": 1024, "height": 1024, "num_inference_steps": 4}

Tool req_0_tool_call
[Binary Content: Image image/webp, 57732 bytes]
The task is complete and the content accessible to the User
Image URL: https://evalstate-flux1-schnell.hf.space/gradio_api/file=/tmp/gradio/3dbddc0e53b5a865ed56a4e3dbdd30f3f61cf3b8aabf1b456f43e5241bd968b8/image.webp
380576952

I have generated an image of a cat on the moon using the Flux 1 Schnell Image Generator. The image is 1024x1024 pixels and was created with 4 inference steps. Let me know if you would like to make any changes or need further assistance!
```

