LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
Pythonlangsmithsandbox_async_sandboxAsyncSandboxgrep
Methodā—Since v0.13

grep

Copy
grep(
  self,
  pattern: str,
  path: str,
  *,
  glob: Optional[
View source on GitHub
str
]
=
None
,
limit
:
Optional
[
int
]
=
None
,
timeout
:
int
=
60
,
headers
:
RequestHeaders
=
None
)
->
GrepResult

Parameters

NameTypeDescription
pattern*str

Literal text to search for. Not a regular expression.

path*str

Absolute path of the directory to search under.

globOptional[str]
Default:None

Restrict which files are searched. A bare *.py matches by basename at any depth; a pattern containing / or ** matches the path relative to path.

limitOptional[int]
Default:None
timeoutint
Default:60
headersRequestHeaders
Default:None

Search file contents for a literal string.

Maximum matches to return.

Request timeout in seconds.

Extra request headers.