API Reference

CLI argument types, serialization helpers, and command entry points.

Argument types

class agentgrep.FindArgs
class
class
class agentgrep.FindArgs

Bases: object

Typed arguments for agentgrep find.

fd-shaped: pattern_mode defaults to regex like fd does. -F selects literal-substring (which was the previous default before the fd alignment landed); -g selects glob; --exact selects exact adapter_id matching. type_filter constrains by record kind; extensions restricts to paths with matching suffixes.

Serialization

agentgrep.serialize_search_record(record)
function
function
agentgrep.serialize_search_record(record)

Serialize a search record to a JSON-compatible mapping.

Parameters:

record (SearchRecord)

Return type:

SearchRecordPayload

agentgrep.serialize_find_record(record)
function
function
agentgrep.serialize_find_record(record)

Serialize a find record to a JSON-compatible mapping.

Parameters:

record (FindRecord)

Return type:

FindRecordPayload

agentgrep.serialize_source_handle(source)
function
function
agentgrep.serialize_source_handle(source)

Serialize a source handle to a JSON-compatible mapping.

Parameters:

source (SourceHandle)

Return type:

SourceHandlePayload

agentgrep.build_envelope(command, query_data, results)
function
function
agentgrep.build_envelope(command, query_data, results)

Build a JSON envelope.

Parameters:
Return type:

EnvelopePayload

Entry points

agentgrep.run_find_command(args)
function
function
agentgrep.run_find_command(args)

Execute agentgrep find.

Routes through either the live streaming path (stream_find_results(), used for text / NDJSON / --print0) or the eager list path (print_find_results(), used for --json and --list-details). See _find_path_is_eager() for the routing decision.

The --ui overlay translates the find filters into a SearchQuery seeded with the same agent / type narrowing, then opens the Textual explorer. This mirrors the tig model: same query semantics, different presentation.

Parameters:

args (FindArgs)

Return type:

int

agentgrep.run_ui_command(args)
function
function
agentgrep.run_ui_command(args)

Execute agentgrep ui.

Parameters:

args (UIArgs)

Return type:

int

agentgrep.main(argv=None)
function
function
agentgrep.main(argv=None)

Run the CLI.

Parameters:

argv (Sequence[str] | None)

Return type:

int