Built-in Agents
Gravity ships with five core agents, each exposing a structured descriptor defining name, description, write capability, and actions with parameters.
FileAgent (code_editor)
Primary file system operations agent. All actions support both absolute and workspace-relative paths.
read_file— Read entire file or specify line rangewrite_file— Create or overwrite file contentapply_diff— Surgical edits via unified diff formatlist_directory— Directory listing with file metadatasearch_in_files/grep— Content search with regex supportglob— Pattern-based file finding (e.g.,**/*.cs)delete— Remove files (requires Review/Assisted mode approval)read_range— Read specific line range from large files
ShellAgent (terminal)
Command execution agent with specialized helpers for common development tasks.
run_command— Arbitrary shell command with timeoutdotnet—dotnet build|test|run|restore|publishwith project detectiongit—git status|diff|log|add|commit|push|pullpowershell— PowerShell scripts and cmdletswhere— Locate binary on PATH
KnowledgeAgent (knowledge)
Persistent knowledge base management for SOPs and learned patterns.
list— List all knowledge itemsread— Read a knowledge item by keyadd— Create new knowledge item (SOP) at runtime
Knowledge items stored as markdown in knowledge/ directory.
GravityAgent (gravity)
Meta-agent for system introspection and task planning.
about— System information and versioncontext— Project context dump for debugginghelp— Available tools and usageplan— Create task plan from natural languagepropose— Create implementation planwalkthrough— Generate walkthrough of changes
SearchAgent (search)
Web search and content extraction.
web— Wikipedia & LangSearch multi-source searchfetch/read_url— Deep page scraping, markdown conversion, link extraction
IAgent Interface
public interface IAgent
{
Task ExecuteAsync(AgentRequest request, CancellationToken ct);
AgentDescriptor Descriptor { get; }
}
All agents implement this interface. The ExecuteAsync method receives an AgentRequest containing the tool name, parameters, and context, and returns an AgentResult with success status, output, and any artifacts.
Agent Descriptors
Each agent exposes metadata via AgentDescriptor:
public class AgentDescriptor
{
public string Name { get; set; }
public string Description { get; set; }
public bool CanWrite { get; set; }
public List Actions { get; set; }
}
ActionMetadata includes name, description, JSON schema for parameters, and mutation flags (IsDestructive, RequiresApproval).
Reasoning Router
The ReasoningRouter resolves tool calls from the LLM to concrete IAgent implementations. It validates parameters against the action's JSON schema, enforces approval policies based on IsDestructive flags, and handles both built-in and dynamic/MCP agents uniformly.