2026-06-30 21:43:00 +00:00
|
|
|
# rony-llm-agent — Documentation
|
2026-06-28 23:03:57 +00:00
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
> 🌐 **Language:** [English](./README.md) | [Español](./README.es.md)
|
2026-06-28 23:03:57 +00:00
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
Technical documentation for the library.
|
|
|
|
|
|
|
|
|
|
## 📐 Architecture
|
2026-06-28 23:03:57 +00:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
┌────────────────────────────────────────────────────────────────┐
|
2026-06-30 21:43:00 +00:00
|
|
|
│ rony-llm-agent (pkg/) │
|
2026-06-28 23:03:57 +00:00
|
|
|
│ │
|
|
|
|
|
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
|
|
|
|
|
│ │ agent │ │ persona │ │ tools │ │
|
|
|
|
|
│ │ │ │ │ │ │ │
|
|
|
|
|
│ │ Agent loop │◄─┤ Persona │ │ Tool registry │ │
|
2026-06-30 20:40:37 +00:00
|
|
|
│ │ with guard- │ │ + AGENTS.md │ │ + JSON Schema │ │
|
2026-06-28 23:03:57 +00:00
|
|
|
│ │ rails │ │ discovery │ │ + execution │ │
|
|
|
|
|
│ └──────┬───────┘ └──────────────┘ └────────┬─────────┘ │
|
|
|
|
|
│ │ │ │
|
|
|
|
|
│ ▼ ▼ │
|
|
|
|
|
│ ┌──────────────┐ ┌──────────────┐ │
|
|
|
|
|
│ │ llm │ │ rag │ │
|
|
|
|
|
│ │ │ │ │ │
|
|
|
|
|
│ │ LLMClient │ │ Memory + │ │
|
|
|
|
|
│ │ interface + │ │ Embeddings │ │
|
|
|
|
|
│ │ providers │ │ + VectorDB │ │
|
|
|
|
|
│ └──────────────┘ └──────────────┘ │
|
|
|
|
|
│ │
|
|
|
|
|
└────────────────────────────────────────────────────────────────┘
|
|
|
|
|
```
|
|
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
## 📦 Packages
|
2026-06-28 23:03:57 +00:00
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
| Package | Responsibility | Docs |
|
2026-06-28 23:03:57 +00:00
|
|
|
|---|---|---|
|
2026-06-30 20:40:37 +00:00
|
|
|
| `pkg/agent` | Iterative loop, termination conditions, approval gates | [View](../pkg/agent/README.md) |
|
|
|
|
|
| `pkg/llm` | `LLMClient` interface, streaming, providers | [View](../pkg/llm/README.md) |
|
|
|
|
|
| `pkg/rag` | Memory, embeddings, semantic search | [View](../pkg/rag/README.md) |
|
|
|
|
|
| `pkg/persona` | System prompts, AGENTS.md, few-shot examples | [View](../pkg/persona/README.md) |
|
|
|
|
|
| `pkg/tools` | Tool registry, JSON Schema, sandboxing | [View](../pkg/tools/README.md) |
|
|
|
|
|
| `pkg/config` | YAML loading, precedence, env override | [View](../pkg/config/README.md) |
|
2026-06-28 23:03:57 +00:00
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
## 🎯 Design principles
|
2026-06-28 23:03:57 +00:00
|
|
|
|
|
|
|
|
### 1. Streaming-first
|
2026-06-30 20:40:37 +00:00
|
|
|
Uses `iter.Seq2[T, error]` from Go 1.23+ for natural streaming:
|
2026-06-28 23:03:57 +00:00
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
for token, err := range llmClient.StreamTokens(ctx, req) {
|
|
|
|
|
if err != nil { return err }
|
|
|
|
|
fmt.Print(token)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
### 2. Pure Hexagonal
|
|
|
|
|
Each package exposes interfaces, concrete implementations are separated:
|
2026-06-28 23:03:57 +00:00
|
|
|
|
|
|
|
|
```go
|
2026-06-30 20:40:37 +00:00
|
|
|
// pkg/rag/rag.go (port)
|
2026-06-28 23:03:57 +00:00
|
|
|
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(...) { ... }
|
|
|
|
|
```
|
|
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
### 3. Secure by default
|
|
|
|
|
- `os.Root` for filesystem sandbox (Go 1.24+)
|
|
|
|
|
- Approval gates before destructive tools
|
|
|
|
|
- Bash sandbox with denylist + timeout
|
|
|
|
|
- Optional network egress control
|
2026-06-28 23:03:57 +00:00
|
|
|
|
|
|
|
|
### 4. Zero magic
|
2026-06-30 20:40:37 +00:00
|
|
|
No reflection, no code generation, no DSLs. Everything is idiomatic and explicit Go.
|
2026-06-28 23:03:57 +00:00
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
## 🔄 Versioning
|
2026-06-28 23:03:57 +00:00
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
- **Strict semver** (`vMAJOR.MINOR.PATCH`)
|
|
|
|
|
- **MAJOR**: breaking changes in `pkg/` (interfaces, signatures, public types)
|
|
|
|
|
- **MINOR**: new features, new packages, new adapters
|
2026-06-28 23:03:57 +00:00
|
|
|
- **PATCH**: bugfixes
|
|
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
Private adapters (`pkg/llm/providers/openai/`) can change without a MAJOR bump if the `LLMClient` interface doesn't change.
|
2026-06-28 23:03:57 +00:00
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
## 🚧 Current status
|
2026-06-28 23:03:57 +00:00
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
⚠️ **This library is in active design.** The code is not implemented yet. The complete specification is in these docs (own of the library):
|
2026-06-28 23:03:57 +00:00
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
- [`./architecture.md`](./architecture.md) — Core architecture (interfaces, agent loop, sandbox, security)
|
|
|
|
|
- [`./components.md`](./components.md) — Reference per package
|
|
|
|
|
- [`./phase2.md`](./phase2.md) — Advanced features (MCP, full RAG, Skills, Sub-agents, Observability)
|
2026-06-28 23:03:57 +00:00
|
|
|
|
2026-06-30 20:40:37 +00:00
|
|
|
Once `rony-harness/` is implemented, this library will be extracted as real code, following these specs.
|