3.1 KiB
3.1 KiB
Agent Template
This template provides everything needed to connect an AI agent to the AI Skills API on your home network (helm:8675).
Structure
.
├── docker-compose.yml # Bring up your agent + skills API integration
├── agent.py # Example agent implementation
├── .env.example # Environment variables template
├── requirements.txt # Python dependencies
└── README.md # This file
Quick Start
- Copy
.env.exampleto.envand customize if needed - Run
docker compose up -d(or run agent.py directly) - Your agent now has access to skills, conventions, and memory
How It Works
The agent uses the AI Skills API at http://helm:8675 to:
- Fetch relevant context (
/context/rag) before each query - Store learnings in memory (
/memory) after interactions - Compress conversation history (
/compress) periodically
This reduces token usage by 60-70% compared to sending everything.
Integration Pattern
import os
import httpx
from typing import List, Dict
API_URL = os.getenv("API_URL", "http://helm:8675")
API_KEY = os.getenv("API_KEY") # Optional if auth enabled
async def get_context(query: str, project: str = None) -> Dict:
"""Fetch relevant skills and conventions for the query"""
params = {"query": query}
if project:
params["project"] = project
async with httpx.AsyncClient() as client:
resp = await client.get(f"{API_URL}/context/rag", params=params)
resp.raise_for_status()
return resp.json()
async def store_memory(project: str, key: str, content: str):
"""Save decision or learning for future reference"""
async with httpx.AsyncClient() as client:
headers = {"X-API-Key": API_KEY} if API_KEY else {}
resp = await client.post(
f"{API_URL}/memory",
json={"id": key[:8], "project": project, "key": key, "content": content},
headers=headers
)
resp.raise_for_status()
return resp.json()
Docker Setup
The provided docker-compose.yml runs the agent in a container and links it to the skills API. Ensure the skills API is running on helm:8675 first.
# Start the skills API on helm (if not already running)
docker compose -f /path/to/ai-skills-api/docker-compose.yml up -d
# Start your agent
docker compose up -d
Configuration
Edit config.yaml on the skills API side to adjust:
- RAG limits (
max_skills,max_conventions,max_snippets) - Compression strategy (
extractiveorollama) - Authentication toggle
Adding Your Own Skills
Use the skills API to add custom skills:
curl -X POST http://helm:8675/skills \
-H "Content-Type: application/json" \
-d '{
"id": "my-custom-skill",
"name": "My Skill",
"category": "custom",
"content": "Your instructions here...",
"tags": ["custom", "mytag"]
}'
Or use the MCP tools if you're in Claude Desktop:
skills/create_skilltool
Resources
- Skills API docs: http://helm:8675/docs
- AI Skills API repo: https://git.bouncypixel.com/helm/ai-skills-api