Files
MetaCrate/crates/metacrate-grid-agent
Chili Palmer a46bc42a8f
Some checks failed
CI / rust-skia (Rust only) (push) Successful in 2m50s
CI / required (push) Failing after 2m46s
feat(grid-agent): add generic LLM tool loop (#119)
2026-08-17 20:45:56 +00:00
..

MetaCrate grid agent

This package is the bounded, provider-neutral foundation for the MetaCrate OpenSim grid agent. It contains a reusable library and the metacrate-grid-agent service binary. The default service graph is deliberately offline: it publishes a deterministic ready event, accepts control commands, and shuts down both owned tasks without contacting a grid or LLM. The library also provides the bounded exact-endpoint LLM transport and tool loop for live adapters. The live-grid feature exposes the side-effect-free owner for the existing libremetaverse::GridClient; later live adapters must extend that manager graph instead of adding a protocol client.

The LLM connection identity has exactly two resolved fields: llm.endpoint_url and llm.api_key. The endpoint is used exactly as supplied; there are no providers, presets, base-URL rewrites, model catalogs, discovery, or provider SDKs. Debug/Display output removes API keys, grid passwords, URL user information, and URL query values. Secret wrappers are not serializable.

Configuration precedence, from lowest to highest, is built-in defaults, an optional JSON file, its referenced secret files, then environment values (an environment-referenced secret file is below a direct environment secret). Supported secret environment variables are METACRATE_AGENT_LLM_API_KEY[_FILE] and METACRATE_AGENT_GRID_PASSWORD[_FILE]. Secret files must be bounded regular, non-symlink UTF-8 files containing one line. Operators must restrict their OS ACLs to the service identity; the core uses only portable std::fs checks and does not assume Unix permission bits.

Run the focused offline gate with:

cargo test --locked -p metacrate-grid-agent
cargo clippy --locked -p metacrate-grid-agent --all-targets -- -D warnings
cargo run --locked -p metacrate-grid-agent -- \
  --config config/grid-agent.example.json --check-config
cargo run --locked -p metacrate-grid-agent -- \
  --config config/grid-agent.example.json --run-once

See ../../docs/grid-agent-architecture.md for queue/task ownership, shutdown, and trust boundaries. See ../../docs/grid-agent-llm.md for the LLM wire compatibility envelope, retry rules, and tool-loop safety contract.