LocalContextMiddleware(
self,
backend: _ExecutableBackend | _AsyncExecutableBackend,
*,
mcp_server_info: list[MCPServerInfo] | None | Name | Type | Description |
|---|---|---|
backend* | _ExecutableBackend | _AsyncExecutableBackend | Backend instance that provides shell command execution. |
mcp_server_info | list[MCPServerInfo] | None | Default: NoneMCP server metadata to include in the system prompt. |
tracing_project | str | None | Default: NoneLangSmith project the agent's own runs trace to, or
|
user_tracing_project | str | None | Default: None |
Inject local context (git state, project structure, etc.) into the system prompt.
Runs a bash detection script via backend.execute() on first interaction
and stores that snapshot for stable system-prompt injection. After each
summarization event, changed context is appended as an internal conversation
message so the cached prompt prefix stays byte-identical.
Because the script runs inside the backend, it works for both local shells and remote sandboxes.
User's original LANGSMITH_PROJECT used by
shell commands the agent runs.