# rony-llm-agent β€” DocumentaciΓ³n > 🌐 **Idioma:** [English](README.md) | [EspaΓ±ol](README.es.md) DocumentaciΓ³n tΓ©cnica detallada de la librerΓ­a. ## πŸ“ Arquitectura ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ rony-llm-agent (pkg/) β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ agent β”‚ β”‚ persona β”‚ β”‚ tools β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Agent loop │◄── Persona β”‚ β”‚ Tool registry β”‚ β”‚ β”‚ β”‚ con guard- β”‚ β”‚ + AGENTS.md β”‚ β”‚ + JSON Schema β”‚ β”‚ β”‚ β”‚ rails β”‚ β”‚ discovery β”‚ β”‚ + execution β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ llm β”‚ β”‚ rag β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ LLMClient β”‚ β”‚ Memory + β”‚ β”‚ β”‚ β”‚ interface + β”‚ β”‚ Embeddings β”‚ β”‚ β”‚ β”‚ providers β”‚ β”‚ + VectorDB β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## πŸ“¦ Paquetes | Paquete | Responsabilidad | Docs | |---|---|---| | `pkg/agent` | Bucle iterativo, termination conditions, approval gates | [Ver](../pkg/agent/README.md) | | `pkg/llm` | `LLMClient` interface, streaming, providers | [Ver](../pkg/llm/README.md) | | `pkg/rag` | Memoria, embeddings, bΓΊsqueda semΓ‘ntica | [Ver](../pkg/rag/README.md) | | `pkg/persona` | System prompts, AGENTS.md, few-shot examples | [Ver](../pkg/persona/README.md) | | `pkg/tools` | Tool registry, JSON Schema, sandboxing | [Ver](../pkg/tools/README.md) | | `pkg/config` | YAML loading, precedence, env override | [Ver](../pkg/config/README.md) | ## 🎯 Principios de diseΓ±o ### 1. Streaming-first Usa `iter.Seq2[T, error]` de Go 1.23+ para streaming natural: ```go for token, err := range llmClient.StreamTokens(ctx, req) { if err != nil { return err } fmt.Print(token) } ``` ### 2. Hexagonal puro Cada paquete expone interfaces, las implementaciones concretas estΓ‘n separadas: ```go // pkg/rag/rag.go (puerto) type VectorDB interface { Search(ctx context.Context, embedding []float32, topK int) ([]Document, error) } // pkg/rag/backends/chroma/chroma.go (adapter) type ChromaDB struct { ... } func (c *ChromaDB) Search(...) { ... } ``` ### 3. Seguridad por defecto - `os.Root` para sandbox de filesystem (Go 1.24+) - Approval gates antes de tools destructivos - Bash sandbox con denylist + timeout - Network egress control opcional ### 4. Zero magic No hay reflection, no hay code generation, no hay DSLs. Todo es Go idiomΓ‘tico y explΓ­cito. ## πŸ”„ Versionado - **Semver estricto** (`vMAJOR.MINOR.PATCH`) - **MAJOR**: breaking changes en `pkg/` (interfaces, signatures, tipos pΓΊblicos) - **MINOR**: nuevas features, nuevos paquetes, nuevos adapters - **PATCH**: bugfixes Los adapters privados (`pkg/llm/providers/openai/`) pueden cambiar sin bump de MAJOR si la interfaz `LLMClient` no cambia. ## 🚧 Estado actual ⚠️ **Esta librerΓ­a estΓ‘ en diseΓ±o activo.** El cΓ³digo todavΓ­a no estΓ‘ implementado. La especificaciΓ³n completa estΓ‘ en estos docs (propios de la librerΓ­a): - [`./architecture.md`](./architecture.md) β€” Arquitectura core (interfaces, agent loop, sandbox, seguridad) - [`./components.md`](./components.md) β€” Referencia por paquete - [`./phase2.md`](./phase2.md) β€” Features avanzadas (MCP, RAG completo, Skills, Sub-agents, Observability) Una vez que `harness/` estΓ© implementado, esta librerΓ­a se extraerΓ‘ como cΓ³digo real, siguiendo estas specs.