Autonomous Agents Architecture¶
1. Agent Lifecycle¶
The autonomous evaluation loop consists of six distinct phases:
- Prepare — The agent initializes configuration parameters from the
run:block of the experiment YAML, defining the LLM provider, inference model, capability scope (privilege), and primary objective. The provider is dynamically instantiated via thefrom_run_config()factory. - Observe — The agent systematically reads the environment state, assessing the execution history, available tool sets, and outputs of recent operations.
- Think — The agent transmits the environment state and execution history to the LLM provider. The model evaluates the state and yields the subsequent operational directive.
- Act — The agent executes the prescribed tool via the Crucible RPC proxy layer (facilitating operations such as impersonation, balance assertions, and storage queries).
- Repeat — Iterations of steps 2-4 continue until the
is_done()constraint returns True, or the agent explicitly signals objective completion. - Verify — A final verification pass is executed against the outcome constraints.
2. Configuration Specification¶
Experiment YAML files require the following structural declarations for agent deployment:
name: my_agent_experiment
scenario: demo_scenario # Any scenario supporting a single-chain topology
attack: demo_agent # Target plugin directory: attacks/<name>/plugin.yaml
topology: single
run:
# ── Provider Parameters ───────────────────────────────────────
agent_provider: openai # Supported variants: openai | anthropic | ollama | local | custom
agent_model: gpt-4o # Model identifier supported by the declared provider
# agent_base_url: ... # Optional: Override the default provider endpoint URL
# ── Runtime Constraints ───────────────────────────────────────
agent_privilege: medium # Privilege boundary: low | medium | high
agent_temperature: 0.3 # Determinism parameter (Default: 0.7; Lower represents stricter determinism)
agent_max_iterations: 30 # Iteration boundary preventing runaway evaluation (Default: 50)
agent_llm_budget: 10000 # Maximum cumulative token consumption limit
agent_task: "Explore the forked chain and report findings"
agent_objective: "Use available tools to check chain ID, balances, and contract code"
agent_allowed_accounts: [] # Allowed Ethereum addresses (Empty evaluates to unconstrained)
# ── Deterministic Recording ───────────────────────────────────
# record_path: tests/fixtures/my_agent.jsonl # Path to capture RPC telemetry
# ── Base Experiment Parameters ────────────────────────────────
traces: false
storage_diffs: true
gas_profiling: true
tags:
- agent
1.1. Supported Providers¶
| Type | Default Model | Authentication Required | Notes |
|---|---|---|---|
openai |
gpt-4o |
OPENAI_API_KEY (.env) |
Compatible with Azure and vLLM proxying via agent_base_url. |
anthropic |
claude-sonnet-4-20250514 |
ANTHROPIC_API_KEY (.env) |
Connects via the Anthropic Messages API. |
ollama |
llama3.1 |
No | Automatically establishes connection to http://localhost:11434/v1. |
local |
local-model |
Optional | Mandates explicit agent_base_url configuration. |
custom |
local-model |
Optional | Mandates explicit agent_base_url configuration. |
1.2. Privilege Capabilities¶
| Boundary Level | Capabilities | Tools Granted |
|---|---|---|
low |
Read-only | chain_id, get_balance, get_code, get_storage, call_contract, get_logs |
medium |
Execution | Base tools + impersonate, send_transaction |
high |
Manipulation | Base and Execution tools + advance_time |
1.3. Advanced Constraint Management¶
| Key | Default | Description |
|---|---|---|
agent_temperature |
0.7 |
Model sampling parameter. Configurations between 0.1-0.3 enforce strict deterministic progression. |
agent_max_iterations |
50 |
Failsafe mechanism bounding maximum sequential tool calls before strict termination. |
agent_llm_budget |
None |
Caps cumulative token consumption to prevent runaway costs. Yields a warning at the 90% threshold and enforces a hard stop upon breach. |
agent_allowed_accounts |
[] |
White-list of Ethereum addresses permitted for agent interaction. |
record_path |
None |
JSONL path to persist all JSON-RPC calls for subsequent hermetic evaluation. |
3. Provider Auto-Configuration¶
During execution, crucible experiment run evaluates the agent_provider parameter within the YAML configuration and automatically leverages the from_run_config() factory defined on LLMAgentPlugin.
This architectural pattern externalizes provider orchestration entirely to the YAML schema, removing the necessity to alter Python source code when substituting models:
# Provider Substitution: OpenAI
agent_provider: openai
agent_model: gpt-4o
# Provider Substitution: Anthropic
agent_provider: anthropic
agent_model: claude-sonnet-4-20250514
Redundant provider re-initialization is prevented within LLMAgentPlugin.prepare() via the internal _configured_from_run_config flag.
4. Built-In Agent Packs¶
Crucible provides primary agent reference implementations within the local attacks/ directory:
3.1. Demo Agent (attacks/demo_agent/)¶
A foundational reference implementation designed for environment traversal. The agent verifies block attributes, contract initialization, and account configurations.
3.2. Nomad Exploit Agent (attacks/llm_exploit_agent/)¶
An advanced adversarial implementation explicitly targeting the Nomad bridge Replica contract (0xB923...). Operational sequence:
- Verification of Replica contract code availability.
- Retrieval of the internal
committedRootmapping. - Forgery of a
process(bytes,bytes)function call manipulating selector0x61bd0e46. - Transaction transmission exploiting the vulnerability bypass.
- Assertion verification on post-exploit root transitions.
5. Developing Custom Agents¶
Custom agent implementations necessitate subclassing LLMAgentPlugin and implementing necessary interface overrides:
from crucible.agent_loop import LLMAgentPlugin
from crucible.agent_tools import AgentContext
class MyAgent(LLMAgentPlugin):
def metadata(self) -> dict:
return {
"name": "my_agent",
"version": "1.0.0",
"type": "agent",
}
def build_objective(self, agent_ctx: AgentContext) -> str:
"""Formalize the objective constraint for the LLM."""
return "Your custom objective here."
Configuration requires explicit plugin registration within attacks/<name>/plugin.yaml.
6. Operational Telemetry and Replay¶
5.1. Reasoning Telemetry¶
Agent operations produce an agent_reasoning.jsonl log. Each recorded transaction preserves the execution context, tool parameterization, and conversational history facilitating post-run review.
5.2. Hermetic RPC Recording¶
For deterministic reproduction without external RPC dependencies, agents can record local network interactions:
crucible experiment run experiments/llm_exploit_agent.yaml \
--record tests/fixtures/llm_exploit_agent.jsonl
5.3. Isolated Testing Validation¶
To perform isolated lifecycle validation without external LLM dependencies, standard classes may override the think() evaluation routine or pass a mock provider architecture natively during configuration.
Note: For diagnostic parameters and troubleshooting workflows pertaining to LLM agents (e.g., token limits, Ollama connectivity, model segfaults), please refer directly to the centralized Crucible Troubleshooting Guide.