agentgrep¶
The top-level package contains the CLI parser, search pipeline, terminal progress renderer, and serializer helpers used by the command-line interface and MCP server.
Core data¶
-
class agentgrep.PrivatePath¶class agentgrep.PrivatePath¶
Bases:
PosixPathPath subclass that hides the user’s home directory in textual output.
-
agentgrep.format_display_path(path, *, directory=False)¶agentgrep.format_display_path(path, *, directory=False)¶
Return a privacy-safe display path.
-
class agentgrep.BackendSelection¶class agentgrep.BackendSelection¶
Bases:
objectSelected optional subprocess backends.
-
class agentgrep.SearchArgs¶class agentgrep.SearchArgs¶
Bases:
objectTyped arguments for
agentgrep search.
-
class agentgrep.FindArgs¶class agentgrep.FindArgs¶
Bases:
objectTyped arguments for
agentgrep find.
-
class agentgrep.SearchQuery¶class agentgrep.SearchQuery¶
Bases:
objectCompiled search configuration.
-
class agentgrep.SourceHandle¶class agentgrep.SourceHandle¶
Bases:
objectA discovered, parseable source file or SQLite database.
Search control and progress¶
-
class agentgrep.SearchControl¶class agentgrep.SearchControl¶
Bases:
objectThread-safe cooperative controls for an active search.
-
class agentgrep.SearchProgress¶class agentgrep.SearchProgress¶
Bases:
ProtocolProgress reporter used by search internals.
Discovery and search¶
-
agentgrep.select_backends()¶agentgrep.select_backends()¶
Return the best available subprocess helpers.
- Return type:
-
agentgrep.discover_sources(home, agents, backends)¶agentgrep.discover_sources(home, agents, backends)¶
Discover all known parseable sources for the selected agents.
- Parameters:
home (
Path)agents (
tuple[AgentName, ...])backends (
BackendSelection)
- Return type:
-
agentgrep.run_search_query(home, query, *, backends=None, progress=None, control=None)¶agentgrep.run_search_query(home, query, *, backends=None, progress=None, control=None)¶
Discover sources and run a normalized search query.
- Parameters:
home (
Path)query (
SearchQuery)backends (
BackendSelection|None)progress (
SearchProgress|None)control (
SearchControl|None)
- Return type:
-
agentgrep.search_sources(query, sources, backends, *, progress=None, control=None)¶agentgrep.search_sources(query, sources, backends, *, progress=None, control=None)¶
Parse and filter search results across all selected sources.
- Parameters:
query (
SearchQuery)sources (
list[SourceHandle])backends (
BackendSelection)progress (
SearchProgress|None)control (
SearchControl|None)
- Return type:
-
agentgrep.run_find_query(home, agents, *, pattern, limit, backends=None)¶agentgrep.run_find_query(home, agents, *, pattern, limit, backends=None)¶
Discover sources and build normalized
findresults.- Parameters:
- Return type:
Serialization and CLI¶
-
agentgrep.serialize_search_record(record)¶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)¶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)¶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)¶agentgrep.build_envelope(command, query_data, results)¶
Build a JSON envelope.
-
agentgrep.run_search_command(args)¶agentgrep.run_search_command(args)¶
Execute
agentgrep search.- Parameters:
args (
SearchArgs)- Return type: