fc644ecd6e
Reemplaza el scaffold del echobot por la plataforma completa de bots traida desde ~/DataProyects/Github/agents_and_robots tras la operacion Matrix-out: los bots ya no hablan por Matrix sino por el bus unibus (modelo todo-rooms + E2E via shell/transportunibus sobre github.com/enmanuel/unibus/pkg/client). - go.mod: replace de unibus -> ../unibus y de fn-registry -> ../../../.. (paths relativos reajustados a la nueva ubicacion dentro de fn_registry). - app.md: bump a 0.2.0, descripcion + arquitectura + comandos + gotchas reales. - modulo Go conservado como github.com/enmanuel/agents (sin reescribir imports). agents_and_robots queda archivado como museo de la era Matrix.
2.0 KiB
2.0 KiB
Template: agent.go
Plantilla para agents/<agent-id>/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
_botsi existe - Ejemplos:
monitor-bot→package monitorasistente-2→package asistente2deploy-agent→package deployagentmy-bot→package my
Agente con LLM (estandar)
Regla basica: DM o mencion → LLM.
package <pkgname>
import "github.com/enmanuel/agents/pkg/decision"
// Rules returns the decision rules for the <agent-id> 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.
package <pkgname>
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
{
Name: "dm-greeting",
Match: func(ctx decision.MessageContext) bool {
return ctx.IsDirectMsg
},
Actions: []decision.Action{{
Kind: decision.ActionKindReply,
Reply: &decision.ReplyAction{Content: "Hola, soy <nombre>. Usa !help para ver mis comandos."},
}},
},
Composicion con And/Or
{
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