# Template: agent.go Plantilla para `agents//agent.go`. Adaptar segun el tipo de agente. ## Regla de package name El nombre del package se deriva del agent-id: - Eliminar guiones - Eliminar sufijo `_bot` si existe - Ejemplos: - `monitor-bot` → `package monitor` - `asistente-2` → `package asistente2` - `deploy-agent` → `package deployagent` - `my-bot` → `package my` ## Agente con LLM (estandar) Regla basica: DM o mencion → LLM. ```go package import "github.com/enmanuel/agents/pkg/decision" // Rules returns the decision rules for the agent. func Rules() []decision.Rule { return []decision.Rule{ { Name: "llm-all", Match: func(ctx decision.MessageContext) bool { return ctx.IsDirectMsg || ctx.IsMention }, Actions: []decision.Action{{ Kind: decision.ActionKindLLM, LLM: &decision.LLMAction{}, }}, }, } } ``` ## Robot (solo comandos, sin LLM) Sin reglas — solo responde a comandos `!xxx`. ```go package import "github.com/enmanuel/agents/pkg/decision" // Rules returns no rules — this robot only responds to commands. func Rules() []decision.Rule { return nil } ``` ## Reglas avanzadas (solo si el usuario lo pide) ### Respuesta estatica a DMs ```go { Name: "dm-greeting", Match: func(ctx decision.MessageContext) bool { return ctx.IsDirectMsg }, Actions: []decision.Action{{ Kind: decision.ActionKindReply, Reply: &decision.ReplyAction{Content: "Hola, soy . Usa !help para ver mis comandos."}, }}, }, ``` ### Composicion con And/Or ```go { Name: "admin-llm", Match: decision.And( func(ctx decision.MessageContext) bool { return ctx.IsDirectMsg }, func(ctx decision.MessageContext) bool { return ctx.PowerLevel >= 50 }, ), Actions: []decision.Action{{Kind: decision.ActionKindLLM, LLM: &decision.LLMAction{}}}, }, ``` ## Reglas estrictas - **PURO**: solo imports de `pkg/decision`, cero I/O - **No usar reglas para comandos** — los comandos se gestionan via `RegisterCommand` - ActionKind disponibles: `ActionKindReply`, `ActionKindLLM`