Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions emily-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# Chat goes to Emily local at :8642.
#
# Usage:
# bash emily-start.sh # default: uses broker.ecoseek.org for auth
# DEEPSEEK_API_KEY=sk-... bash emily-start.sh # use DeepSeek as local LLM
# DEEPSEEK_API_KEY=sk-... HERMES_ECOSEEK_API_KEY=agenticplu-... bash emily-start.sh
# DEEPSEEK_API_KEY=sk-... bash emily-start.sh # local only (no remote delegation)
# OLLAMA_BASE_URL=http://host:11434 bash emily-start.sh # use local Ollama
#
# No Python, Node.js, or npm required — only Docker.
Expand Down Expand Up @@ -42,6 +42,8 @@ fi
# ── Configuration ─────────────────────────────────────────────────────
BROKER_URL="${ECOSEEK_BROKER_URL:-https://broker.ecoseek.org}"
BROKER_KEY="${ECOSEEK_BROKER_KEY:-}"
HERMES_KEY="${HERMES_ECOSEEK_API_KEY:-}"
HERMES_URL="${HERMES_REMOTE_URL:-https://hermes.ecoseek.org}"
EMILY_PORT="${EMILY_PORT:-8642}"
FRONTEND_PORT="${FRONTEND_PORT:-4000}"
DEEPSEEK_KEY="${DEEPSEEK_API_KEY:-}"
Expand Down Expand Up @@ -76,6 +78,8 @@ EMILY_ENV=()
EMILY_ENV+=(-e "ECOSEEK_BROKER_URL=$BROKER_URL")
EMILY_ENV+=(-e "API_SERVER_KEY=$EMILY_KEY")
EMILY_ENV+=(-e "API_SERVER_CORS_ORIGINS=http://localhost:${FRONTEND_PORT},http://127.0.0.1:${FRONTEND_PORT}")
EMILY_ENV+=(-e "HERMES_REMOTE_URL=$HERMES_URL")
[ -n "$HERMES_KEY" ] && EMILY_ENV+=(-e "HERMES_ECOSEEK_API_KEY=$HERMES_KEY")
[ -n "$BROKER_KEY" ] && EMILY_ENV+=(-e "ECOSEEK_BROKER_KEY=$BROKER_KEY")
[ -n "$DEEPSEEK_KEY" ] && EMILY_ENV+=(-e "DEEPSEEK_API_KEY=$DEEPSEEK_KEY") && EMILY_ENV+=(-e "DEEPSEEK_MODEL=$DEEPSEEK_MODEL")
[ -n "$OLLAMA_URL" ] && EMILY_ENV+=(-e "OLLAMA_BASE_URL=$OLLAMA_URL")
Expand Down Expand Up @@ -119,9 +123,15 @@ docker run -d \
echo ""
emily "I'm ready! Here's what's running:"
echo ""
info " Emily agent: http://localhost:${EMILY_PORT} (chat)"
info " Emily agent: http://localhost:${EMILY_PORT} (Alpha, local)"
info " Hermes Beta: ${HERMES_URL} (remote, reumanlab)"
info " Broker: ${BROKER_URL} (auth)"
info " Frontend: http://localhost:${FRONTEND_PORT}"
if [ -n "$HERMES_KEY" ]; then
info " DiDAL: Enabled (escalate_remote + dialectical_exchange)"
else
warn " DiDAL: Disabled (set HERMES_ECOSEEK_API_KEY to enable remote delegation)"
fi
echo ""
info " Open http://localhost:${FRONTEND_PORT} in your browser."
info " Sign in with GitHub to start chatting with Emily."
Expand Down
51 changes: 38 additions & 13 deletions emily/config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Emily — EcoSeek Ecological AI Assistant
# Hermes agent configuration for the Emily local agent.
# Emily — EcoSeek Ecological AI Assistant (DiDAL Phase 2)
# Hermes agent configuration for the Emily local agent (Alpha).
#
# LLM provider is configured via environment variables:
# DEEPSEEK_API_KEY → DeepSeek API (default)
# OLLAMA_BASE_URL → local Ollama instance
#
# Remote delegation to Hermes Beta (reumanlab) requires:
# HERMES_ECOSEEK_API_KEY → API key for hermes.ecoseek.org
#
# The entrypoint script (entrypoint.sh) writes ~/.hermes/.env with the
# appropriate keys before starting the gateway.

Expand All @@ -27,6 +30,7 @@ agent:
emily:
system_prompt: |
You are Emily, an expert ecological scientist and AI assistant for EcoSeek.
You are Alpha in the DiDAL (Dialectical Dual-Agent Loop) system.

## Your Expertise
- Ecological niche modeling (ENM) and species distribution models (SDMs)
Expand All @@ -46,18 +50,39 @@ agent:
- You encourage best practices in open science and data provenance
- You know about GBIF, WoRMS, IUCN, and other biodiversity databases

## Remote Escalation
When a task requires heavy computation, large datasets, HPC resources,
or capabilities beyond your local model, use the escalate_remote tool
to delegate to the remote Hermes agent on reumanlab. Examples:
- Running MaxEnt on thousands of occurrence records
- Downloading and processing large GBIF datasets
- Submitting HPC jobs (Slurm) for model training
- Complex multi-step ecological pipelines
- Tasks requiring DeepSeek v4 Pro reasoning
## DiDAL — Dual-Agent Delegation (IMPORTANT)
You have a powerful remote partner: Hermes Beta on reumanlab, accessible
via hermes.ecoseek.org. Beta has access to:
- DeepSeek v4 Pro (advanced reasoning, large context)
- KU HPC cluster (A100/MI210 GPUs via Slurm)
- eco_analyze tool (17 ecological actions: GBIF queries, SDMs, MaxEnt,
diversity indices, taxonomy resolution, phylogenetic analysis)
- ku_hpc tool (submit/monitor/cancel HPC jobs)
- Shell access, GitHub CLI, file operations on reumanlab

### When to delegate to Beta (PREFER delegation for these):
- ANY task involving data download, processing, or analysis
- Running ecological pipelines (SDMs, MaxEnt, diversity calculations)
- GBIF data queries with more than a few hundred records
- HPC jobs (model training, large spatial analyses)
- Code that needs execution (not just generation)
- Complex multi-step workflows
- Tasks requiring reumanlab infrastructure

### When to handle locally:
- Simple Q&A about ecology, species, methods
- Generating short code snippets for the user to run
- Explaining concepts, reviewing approach, literature guidance
- Quick calculations, taxonomy lookups

### How to delegate:
- For simple one-shot tasks: use `escalate_remote` tool
- For complex tasks needing iteration: use `dialectical_exchange` tool
- To check Beta's status: use `hermes_status` tool

For simple questions, code snippets, explanations, and quick lookups,
handle them locally — you are capable and fast.
When you delegate, ALWAYS tell the user what you're doing:
"Let me ask Hermes Beta on reumanlab to handle this..."
And share Beta's response with the user, adding your own analysis.

Always introduce yourself as Emily on the first interaction.
Keep responses focused and scientifically rigorous.
Expand Down
15 changes: 14 additions & 1 deletion emily/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,20 @@ if [ -n "${OLLAMA_BASE_URL:-}" ]; then
echo "[emily] Ollama configured at ${OLLAMA_BASE_URL}"
fi

# EcoSeek broker credentials (for escalate_remote tool)
# Hermes remote credentials (for DiDAL escalation to hermes.ecoseek.org)
if [ -n "${HERMES_ECOSEEK_API_KEY:-}" ]; then
echo "HERMES_ECOSEEK_API_KEY=${HERMES_ECOSEEK_API_KEY}" >> "$ENV_FILE"
echo "[emily] Hermes remote configured: key=***${HERMES_ECOSEEK_API_KEY: -4}"
fi
if [ -n "${HERMES_REMOTE_URL:-}" ]; then
echo "HERMES_REMOTE_URL=${HERMES_REMOTE_URL}" >> "$ENV_FILE"
echo "[emily] Hermes remote URL: ${HERMES_REMOTE_URL}"
fi
if [ -n "${HERMES_REMOTE_MODEL:-}" ]; then
echo "HERMES_REMOTE_MODEL=${HERMES_REMOTE_MODEL}" >> "$ENV_FILE"
fi

# Legacy broker credentials (kept for backward compatibility)
if [ -n "${ECOSEEK_BROKER_URL:-}" ]; then
echo "ECOSEEK_BROKER_URL=${ECOSEEK_BROKER_URL}" >> "$ENV_FILE"
fi
Expand Down
74 changes: 39 additions & 35 deletions emily/plugins/ecoseek/README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,55 @@
# EcoSeek Plugin for Hermes Agent
# EcoSeek Plugin — DiDAL Phase 2

Remote escalation plugin that lets a local Emily agent delegate heavy tasks to
the remote Hermes instance on reumanlab.
Emily (Alpha, local) ↔ Hermes (Beta, remote on reumanlab) via `hermes.ecoseek.org`.

## Tools

| Tool | Description |
|------|-------------|
| `hermes_status` | Check if Hermes Beta is available |
| `escalate_remote` | One-shot delegation to Beta (simple tasks) |
| `dialectical_exchange` | DiDAL structured debate (complex multi-step tasks) |

## Setup

```bash
hermes plugins enable ecoseek
```

Add to `~/.hermes/.env`:
# Pass your Hermes API key when starting Emily:
HERMES_ECOSEEK_API_KEY=agenticplu... DEEPSEEK_API_KEY=sk-... bash emily-start.sh
```
ECOSEEK_BROKER_URL=https://broker.ecoseek.org
ECOSEEK_BROKER_KEY=<your-session-key>
```

## Tool: `escalate_remote`

Sends a task to the remote Hermes agent via the AgenticPlug broker.

**When to use:**
- Heavy computation (HPC cluster, GPU jobs)
- Access to reumanlab resources (ku-hpc, deployed services)
- Advanced reasoning beyond your local model
- Large dataset processing (GBIF downloads, spatial analysis)
- Running ecological pipelines (SDMs, phylogenetics)

**When NOT to use:**
- Simple Q&A about ecology or species
- Generating short code snippets (R/Python)
- Explaining concepts or reviewing manuscripts
- Quick calculations or unit conversions

## Configuration

| Variable | Default | Description |
|----------|---------|-------------|
| `ECOSEEK_BROKER_URL` | `https://broker.ecoseek.org` | Broker endpoint URL |
| `ECOSEEK_BROKER_KEY` | *(required)* | Session key for authentication |
| `ECOSEEK_MODEL` | `openclaw/main` | Model name on the remote Hermes |
| `ECOSEEK_TIMEOUT` | `300` | Request timeout in seconds |
| `HERMES_REMOTE_URL` | `https://hermes.ecoseek.org` | Remote Hermes endpoint |
| `HERMES_ECOSEEK_API_KEY` | *(required for escalation)* | API key for hermes.ecoseek.org |
| `HERMES_REMOTE_MODEL` | `hermes` | Model name on the remote |
| `HERMES_REMOTE_TIMEOUT` | `300` | Request timeout in seconds |
| `DIDAL_MAX_TURNS` | `12` | Max dialectical dialogue turns |
| `DIDAL_STUCK_THRESHOLD` | `3` | Repeated errors before stopping |

## Architecture

```
Emily Local (Hermes) → escalate_remote tool
→ POST broker.ecoseek.org/v1/chat/completions
→ Hermes Remote (reumanlab, DeepSeek v4 Pro)
→ ku-hpc → KU HPC cluster (A100/MI210)
User → localhost:4000 (frontend)
→ localhost:8642 (Emily/Alpha)
→ hermes.ecoseek.org (Hermes/Beta on reumanlab)
→ eco_analyze (GBIF, SDM, diversity, taxonomy)
→ ku_hpc (Slurm → A100/MI210 GPUs)
→ shell, GitHub CLI, DeepSeek v4 Pro
```

## When Emily escalates to Beta

- Heavy computation (HPC cluster, GPU jobs, model training)
- Ecological pipelines (SDMs, MaxEnt, phylogenetics, GBIF bulk downloads)
- Large dataset processing (spatial analysis, raster operations)
- Code execution on reumanlab infrastructure
- Tasks requiring DeepSeek v4 Pro reasoning

## When Emily handles locally

- Simple Q&A about ecology, species, methods
- Generating short code snippets (R/Python)
- Explaining concepts, reviewing manuscripts
- Quick calculations, literature guidance
Loading