Overview
TheKapso class is the main entry point for the framework. It provides methods for research, learning, evolving, and deploying solutions.
Constructor
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
config_path | str | src/config.yaml | Path to configuration file |
kg_index | str | None | Path to existing .index file for KG |
Examples
Methods
research()
Run deep web research for an objective.Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
objective | str | - | What to research |
mode | str | "both" | "idea", "implementation", or "both" |
depth | str | "deep" | "light" or "deep" |
Returns
Source.Research object with:
report_markdown: Full research reportto_context_string(): Format for prompt injection
Example
learn()
Learn from knowledge sources.Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
*sources | Source.* | - | One or more source objects |
wiki_dir | str | "data/wikis" | Wiki directory path |
skip_merge | bool | False | Only extract, don’t merge |
kg_index | str | None | Index path for MCP server |
Returns
PipelineResult with:
sources_processed: Number of sources processedtotal_pages_extracted: Pages extractedcreated: New pages createdmerged: Pages merged with existingerrors: List of errors
Example
evolve()
Evolve a solution through experimentation.Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
goal | str | - | High-level objective |
context | List | None | Sources to learn before evolving |
constraints | List[str] | None | Constraints (e.g., “latency < 50ms”) |
output_path | str | None | Where to save generated code |
starting_repo_path | str | None | Existing repo to improve |
max_iterations | int | 10 | Maximum experiment iterations |
mode | str | None | Config mode (GENERIC, MINIMAL, etc.) |
coding_agent | str | None | Coding agent override |
language | str | "python" | Programming language |
main_file | str | "main.py" | Entry point file |
timeout | int | 300 | Execution timeout (seconds) |
data_dir | str | None | Path to data files |
evaluator | str | "no_score" | Evaluator type |
evaluator_params | Dict | None | Evaluator parameters |
stop_condition | str | "never" | Stop condition type |
stop_condition_params | Dict | None | Stop condition parameters |
additional_context | str | "" | Extra context for prompts |
Returns
SolutionResult with:
goal: Original goalcode_path: Path to generated codeexperiment_logs: List of experiment summariesmetadata: Cost, iterations, final evaluation
Example
deploy()
Deploy a solution as running software.Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
solution | SolutionResult | - | Solution from evolve() |
strategy | DeployStrategy | AUTO | Deployment strategy |
env_vars | Dict[str, str] | None | Environment variables |
coding_agent | str | "claude_code" | Agent for adaptation |
Returns
Software instance with:
run(inputs): Execute with inputsstop(): Stop and cleanupstart(): Restartis_healthy(): Health checklogs(): Get logs
Example
index_kg()
Index knowledge data into the KG.Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
wiki_dir | str | None | Path to wiki directory |
data_path | str | None | Path to JSON data file |
save_to | str | - | Path to save .index file |
search_type | str | None | Override search backend |
force | bool | False | Clear existing data |
Returns
Path to created.index file.