- Chat interattiva, Server web, Dashboard, API - CLI configurazione, TUI, Analytics - Comandi memory, planning, skills - Struttura progetto e troubleshooting
4.8 KiB
4.8 KiB
LangCode Agent - Guida Rapida
Installazione
# 1. Clona il repository
git clone http://192.168.0.183:8085/truetype/langcode_agent.git
cd langcode_agent
# 2. Crea e attiva virtual environment
python3 -m venv venv
source venv/bin/activate
# 3. Installa dipendenze
pip install -r requirements.txt
Configurazione Rapida
# Imposta variabili d'ambiente
export MODEL_PROVIDER=ollama
export MODEL_NAME=gemma2:9b
export OLLAMA_BASE_URL=http://192.168.0.50:11434
Oppure usa la CLI interattiva per salvare configurazioni persistenti:
langcode config add -n ollama -p ollama -m gemma2:9b -u http://192.168.0.50:11434 --set-active
langcode config test
Modalità di Utilizzo
1. Chat Interattiva (Agent AI)
langcode
# oppure
langcode chat
Chatta con l'agent AI in tempo reale.
2. Server Web (API + Dashboard)
langcode server
langcode server --port 8080
langcode server --host 0.0.0.0 --port 3000
Accesso dopo l'avvio:
- 🌐 Web UI: http://localhost:8000
- 📊 Dashboard: http://localhost:8000/monitoring
- 🛒 Marketplace: http://localhost:8000/marketplace
- 📖 API Docs: http://localhost:8000/docs
3. CLI Configurazione
langcode config list # Lista configurazioni
langcode config add -n nome -p ollama -m gemma2:9b -u http://... # Aggiungi
langcode config use nome # Attiva configurazione
langcode config active # Mostra attiva
langcode config test # Testa connessione
langcode config search ollama # Cerca
langcode config export -f json # Esporta
langcode config import backup.json # Importa
4. TUI Interattiva
langcode tui
Interfaccia testuale per gestire configurazioni.
5. Analytics
langcode analytics # Riepilogo rapido
langcode analytics --report # Report completo
langcode dashboard # Dashboard performance
Comandi Interni (nella Chat)
Durante la chat interattiva (langcode chat):
/help # Aiuto
/status # Stato sistema
/config list # Lista configurazioni
/config use <nome> # Cambia configurazione
/models # Elenca modelli
/clear # Pulisci schermo
/exit # Esci
Memory (Memoria Persistente)
/memory remember <testo> # Salva un fatto
/memory recall <query> # Cerca fatti
/memory preference set <key> <value> # Imposta preferenza
/memory preference get <key> # Leggi preferenza
/memory stats # Statistiche
Planning (Pianificazione)
/plan create "<nome piano>" "<task1; task2; task3>" # Crea piano
/plan list # Elenca piani
/plan progress <plan_id> # Mostra progresso
/plan start <task_id> # Inizia task
/plan complete <task_id> # Completa task
Skills (Gestione Skills)
/skills list # Skills installate
/skills search <query> # Cerca skills
/skills install <nome> # Installa skill
/skills details <nome> # Dettagli skill
/skills uninstall <nome> # Disinstalla
Struttura
langcode_agent/
├── langcode.py # CLI unificato (langcode)
├── main.py # Agent principale
├── api_server.py # Server web + API
├── config_manager.py # Gestione configurazioni
├── config_cli.py # CLI configurazione
├── config_tui.py # TUI configurazione
├── skill_manager.py # Gestione skills
├── mcp_client.py # Client MCP
├── analytics.py # Analytics
├── dashboard.py # Dashboard performance
├── monitoring.py # Monitoraggio
├── enhancements/ # Memory e Planning
│ ├── simple_memory.py
│ └── planning_enhancement.py
├── web/ # Frontend web
├── plugins/ # Plugin sistema
└── venv/ # Virtual environment
Provider Supportati
| Provider | Variabili necessarie |
|---|---|
| Ollama | OLLAMA_BASE_URL |
| OpenAI | OPENAI_API_KEY |
| OpenRouter | OPENROUTER_API_KEY |
| Anthropic | ANTHROPIC_API_KEY |
GOOGLE_API_KEY |
Troubleshooting
Agent non si avvia:
source venv/bin/activate
pip install -r requirements.txt
Ollama non risponde:
curl http://192.168.0.50:11434/api/tags
Porta già in uso:
langcode server --port 8080
Tempo installazione: ~5 minuti