runner
code_context_agent.agent.runner ¶
Agent runner with event streaming and display.
This module provides functions to run the analysis agent and stream events to consumers for display or further processing.
AnalysisContext ¶
Bases: BaseModel
Container for analysis components and configuration.
StreamResult ¶
Bases: BaseModel
Result of streaming analysis execution.
run_analysis async ¶
run_analysis(
repo_path,
output_dir=None,
focus=None,
consumer=None,
quiet=False,
issue_context=None,
since_context=None,
mode="standard",
)
Run code context analysis on a repository.
This function orchestrates the analysis by: 1. Creating an agent with tools, prompt, hooks, and structured output 2. Wrapping it with ag-ui-strands for typed event streaming 3. Streaming events to the consumer for display 4. Returning analysis results
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_path | str | Path | Path to the repository to analyze. | required |
output_dir | str | Path | None | Output directory for context files. Defaults to repo/.code-context | None |
focus | str | None | Optional focus area to steer analysis (e.g., "authentication", "API layer"). | None |
consumer | EventConsumer | None | Event consumer for display. Defaults to RichEventConsumer. | None |
quiet | bool | If True and no consumer, use QuietConsumer. | False |
issue_context | str | None | Optional XML-wrapped issue context for issue-focused analysis. | None |
since_context | str | None | Optional XML-wrapped incremental analysis context from --since. | None |
mode | str | Analysis mode ("standard", "full", "full+focus", "focus", "incremental"). | 'standard' |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Dict with analysis status and output paths. |
Source code in src/code_context_agent/agent/runner.py
run_analysis_sync ¶
Synchronous wrapper for run_analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_path | str | Path | Path to the repository. | required |
output_dir | str | Path | None | Output directory for context files. | None |
quiet | bool | Suppress live display. | False |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Dict with analysis status and output paths. |