4aad81e11e
Add three Hermes-inspired capabilities to Shira: - Skills system: firm-wide workflow templates (list/view/manage tools), 4 pre-seeded skills (case summary, hearing prep, direct access report, deadline tracker), auto-learning via post-conversation meta-prompt - Cross-conversation memory: per-lawyer profiles and per-case memory stored as bounded markdown files, injected into system prompts - Sub-agent delegation: spawn up to 3 child AgentRunner instances for parallel document analysis and complex multi-step tasks New files: skills.py, memory.py, delegate.py, learner.py, 4 SKILL.md Updated: agent_runner (6 new tools, depth/blocked_tools support), prompt_builder (skills/memory injection), route (memory loading, background learning), main.py (data dirs), Dockerfile (pyyaml, skills) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
"""shira-hermes — FastAPI application."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import logging
|
|
from pathlib import Path
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from api.routes.health import router as health_router
|
|
from api.routes.smart_assistant import router as smart_assistant_router
|
|
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s [%(name)s] %(levelname)s: %(message)s",
|
|
)
|
|
|
|
logger = logging.getLogger("shira.app")
|
|
|
|
app = FastAPI(
|
|
title="shira-hermes",
|
|
description="Shira AI Assistant — Hermes Agent backend for EspoCRM SmartAssistant",
|
|
version="0.2.0",
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_methods=["GET", "POST", "OPTIONS"],
|
|
allow_headers=["Content-Type", "X-Api-Key"],
|
|
)
|
|
|
|
app.include_router(health_router)
|
|
app.include_router(smart_assistant_router)
|
|
|
|
|
|
@app.on_event("startup")
|
|
async def ensure_data_dirs():
|
|
"""Create persistent data directories if they don't exist."""
|
|
data_dir = os.environ.get("SHIRA_DATA_DIR", "/opt/data")
|
|
dirs = [
|
|
f"{data_dir}/skills",
|
|
f"{data_dir}/profiles",
|
|
f"{data_dir}/cases",
|
|
]
|
|
for d in dirs:
|
|
Path(d).mkdir(parents=True, exist_ok=True)
|
|
logger.info("Data directories ready at %s", data_dir)
|