genesis-skills / academy
AGENTS.md30 starsChanged 49 days agoBSD-2-ClauseView on GitHub
Every Academy agent inherits from the Agent base class: Overrides must be re-decorated. When a subclass overrides an @action method (including abstract ones), the override must itself be decorated with @action — otherwise the live agent raises AttributeError: ... does not have an action named "..." when the action is called through a real handle. ProxyHandle does NOT catch this (it calls the method directly), so test it through a launched agent at least once. Every loop has the exact…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository30 other files it gives its agents.
- academySkill
- amsc-data-movement-apiSkill
- amsc-magSkill
- amsc-python-clientSkill
- globus-computeSkill
- i2-apiSkill
- iri-apiSkill
- skill-explorerSkill
- croissant-validatorSkill
- datacard-generatorSkill
- hdmf-schema-builderSkill
- skill-creatorSkill
- well-convertSkill
- card-eval-updaterSkill
- agentic-vulnerabilities-scanSkill
- ai-fingerprintSkill
- battleprintSkill
- fingerprintingSkill
- uncertainty-quantificationSkill
- uq-metrics-evaluatorSkill
- skill-searchSkill
- auroraSkill
- frontierSkill
- pbsSkill
- perlmutterSkill
- slurmSkill
- literature-searchSkill
- multi-agent-systemsSkill
- gkeyllSkill
- gs2Skill
The file
We split this agents.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 5
Every Academy agent inherits from the Agent base class:
- Very specific: line 34
Overrides must be re-decorated: When a subclass overrides an @action method (including abstract ones), the override must itself be …
- Very specific: line 122
Every loop has the exact signature (self, shutdown: asyncio.Event) and must check the shutdown event each iteration — a loop that ignores …
- Very specific: line 185
Use the built-in lifecycle hooks rather than custom actions (do not define an action named shutdown — handles already have a real …
- Distinctive: line 207
Prefer returning error information over raising exceptions:
- Distinctive: line 285
Return structured data: - Use dicts with consistent keys
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Academy Agents Reference
Agent Class Structure
Every Academy agent inherits from the Agent base class:
import asyncio
from academy.agent import Agent, action, loop
class MyAgent(Agent):
def __init__(self):
super().__init__()
# Initialize instance state
self._results = []
@action
async def do_work(self, task: str) -> dict:
"""Actions are remote-callable methods."""
result = await self._process(task)
self._results.append(result)
return result
@loop
async def background_task(self, shutdown: asyncio.Event) -> None:
"""Loops run continuously and autonomously."""
while not shutdown.is_set():
await self._check_conditions()
await asyncio.sleep(1)Actions
Overrides must be re-decorated. When a subclass overrides an @action
method (including abstract ones), the override must itself be decorated with
@action — otherwise the live agent raises AttributeError: ... does not have
an action named "..." when the action is called through a real handle.
ProxyHandle does NOT catch this (it calls the method directly), so test it
through a launched agent at least once.
Basic Action Pattern
@action
async def calculate(self, expression: str) -> str:
"""Evaluate a mathematical expression.
Args:
expression: Math expression like "2 + 2"
Returns:
Result as formatted string
"""
result = eval(expression, {"__builtins__": {}}, {})
return f"{expression} = {result}"Action with Complex Parameters
@action
async def run_simulation(
self,
structure: dict,
temperature: float = 300.0,
pressure: float = 1.0,
steps: int = 1000
) -> dict:
"""Run molecular dynamics simulation.
Args:
structure: Molecular structure definition
temperature: Temperature in Kelvin
pressure: Pressure in atmospheres
steps: Number of simulation steps
Returns:
Simulation results with energy and trajectory
"""
# Validate inputs
if temperature <= 0:
return {"error": "Temperature must be positive"}
# Run simulation
trajectory = await self._run_md(structure, temperature, pressure, steps)
return {
"final_energy": trajectory[-1]["energy"],
"trajectory": trajectory,
"converged": self._check_convergence(trajectory)
}Action Receiving Handles
from academy.handle import Handle
@action
async def register_worker(self, name: str, worker: Handle) -> None:
"""Register a worker agent for later use.
Args:
name: Identifier for this worker
worker: Handle to the worker agent
"""
self._workers[name] = worker
@action
async def delegate_task(self, worker_name: str, task: dict) -> dict:
"""Delegate work to a registered worker."""
worker = self._workers.get(worker_name)
if not worker:
return {"error": f"Unknown worker: {worker_name}"}
# Call the worker's action via its Handle
return await worker.process(task)Loops
Every loop has the exact signature (self, shutdown: asyncio.Event) and must
check the shutdown event each iteration — a loop that ignores it will hang the
agent at shutdown.
Basic Monitoring Loop
@loop
async def monitor(self, shutdown: asyncio.Event) -> None:
"""Continuously monitor a data source."""
while not shutdown.is_set():
data = await self._collect_data()
if self._should_trigger(data):
await self._handle_trigger(data)
await asyncio.sleep(self._poll_interval)Loop with State Updates
@loop
async def autonomous_search(self, shutdown: asyncio.Event) -> None:
"""Autonomously search for optimal parameters."""
while not shutdown.is_set() and not self._converged:
# Generate next candidate
candidate = self._suggest_next()
# Evaluate (possibly via remote worker)
if self._evaluator:
result = await self._evaluator.evaluate(candidate)
else:
result = await self._local_evaluate(candidate)
# Update search state
self._update_model(candidate, result)
self._check_convergence()Agent Lifecycle
Initialization
class ScientificAgent(Agent):
def __init__(self, config: dict = None):
super().__init__()
self._config = config or {}
self._initialized = False
self._resources = {}
@action
async def initialize(self, resources: dict) -> bool:
"""One-time setup after launch."""
self._resources = resources
await self._load_models()
self._initialized = True
return TrueStartup and Shutdown Hooks
Use the built-in lifecycle hooks rather than custom actions (do not define an
action named shutdown — handles already have a real shutdown() method):
class ScientificAgent(Agent):
async def agent_on_startup(self) -> None:
"""Runs when the agent starts, before it serves requests.
Do first contact with other agents here, never in __init__.
"""
await self._load_models()
async def agent_on_shutdown(self) -> None:
"""Runs when the agent is shutting down."""
await self._save_state()
await self._release_resources()Error Handling
Return Errors as Data
Prefer returning error information over raising exceptions:
@action
async def process_file(self, path: str) -> dict:
"""Process a data file."""
try:
data = await self._load_file(path)
result = await self._analyze(data)
return {"status": "success", "result": result}
except FileNotFoundError:
return {"status": "error", "message": f"File not found: {path}"}
except Exception as e:
return {"status": "error", "message": str(e)}Validation Pattern
@action
async def validate_and_run(self, params: dict) -> dict:
"""Validate parameters before execution."""
# Validation
errors = self._validate_params(params)
if errors:
return {"status": "validation_error", "errors": errors}
# Execution
result = await self._execute(params)
return {"status": "success", "result": result}State Management
Persistent State
class StatefulAgent(Agent):
def __init__(self):
super().__init__()
self._history = []
self._model_state = None
@action
async def get_state(self) -> dict:
"""Return current agent state for checkpointing."""
return {
"history": self._history,
"model_state": self._model_state
}
@action
async def restore_state(self, state: dict) -> bool:
"""Restore agent from checkpoint."""
self._history = state.get("history", [])
self._model_state = state.get("model_state")
return TrueTesting Agents with ProxyHandle
ProxyHandle wraps an agent instance in-process so tests can await its actions
directly — no manager or exchange needed. Call it exactly like a real handle:
from academy.handle import ProxyHandle
async def test_simulation():
agent = ProxyHandle(SimulationAgent())
result = await agent.run_simulation({"temp": 300})
assert result["status"] == "completed"Best Practices
- Keep actions focused - Each action should do one thing well
- Use type hints - Helps with serialization and documentation
- Document parameters - Docstrings help when debugging distributed systems
- Return structured data - Use dicts with consistent keys
- Handle errors gracefully - Return error info rather than raising
- Initialize lazily - Heavy resources can be loaded on first use
- Make state serializable - Enables checkpointing and recovery
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

