crca 1.4.0__py3-none-any.whl → 1.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- CRCA.py +172 -7
- MODEL_CARD.md +53 -0
- PKG-INFO +8 -2
- RELEASE_NOTES.md +17 -0
- STABILITY.md +19 -0
- architecture/hybrid/consistency_engine.py +362 -0
- architecture/hybrid/conversation_manager.py +421 -0
- architecture/hybrid/explanation_generator.py +452 -0
- architecture/hybrid/few_shot_learner.py +533 -0
- architecture/hybrid/graph_compressor.py +286 -0
- architecture/hybrid/hybrid_agent.py +4398 -0
- architecture/hybrid/language_compiler.py +623 -0
- architecture/hybrid/main,py +0 -0
- architecture/hybrid/reasoning_tracker.py +322 -0
- architecture/hybrid/self_verifier.py +524 -0
- architecture/hybrid/task_decomposer.py +567 -0
- architecture/hybrid/text_corrector.py +341 -0
- benchmark_results/crca_core_benchmarks.json +178 -0
- branches/crca_sd/crca_sd_realtime.py +6 -2
- branches/general_agent/__init__.py +102 -0
- branches/general_agent/general_agent.py +1400 -0
- branches/general_agent/personality.py +169 -0
- branches/general_agent/utils/__init__.py +19 -0
- branches/general_agent/utils/prompt_builder.py +170 -0
- {crca-1.4.0.dist-info → crca-1.5.0.dist-info}/METADATA +8 -2
- {crca-1.4.0.dist-info → crca-1.5.0.dist-info}/RECORD +303 -20
- crca_core/__init__.py +35 -0
- crca_core/benchmarks/__init__.py +14 -0
- crca_core/benchmarks/synthetic_scm.py +103 -0
- crca_core/core/__init__.py +23 -0
- crca_core/core/api.py +120 -0
- crca_core/core/estimate.py +208 -0
- crca_core/core/godclass.py +72 -0
- crca_core/core/intervention_design.py +174 -0
- crca_core/core/lifecycle.py +48 -0
- crca_core/discovery/__init__.py +9 -0
- crca_core/discovery/tabular.py +193 -0
- crca_core/identify/__init__.py +171 -0
- crca_core/identify/backdoor.py +39 -0
- crca_core/identify/frontdoor.py +48 -0
- crca_core/identify/graph.py +106 -0
- crca_core/identify/id_algorithm.py +43 -0
- crca_core/identify/iv.py +48 -0
- crca_core/models/__init__.py +67 -0
- crca_core/models/provenance.py +56 -0
- crca_core/models/refusal.py +39 -0
- crca_core/models/result.py +83 -0
- crca_core/models/spec.py +151 -0
- crca_core/models/validation.py +68 -0
- crca_core/scm/__init__.py +9 -0
- crca_core/scm/linear_gaussian.py +198 -0
- crca_core/timeseries/__init__.py +6 -0
- crca_core/timeseries/pcmci.py +181 -0
- crca_llm/__init__.py +12 -0
- crca_llm/client.py +85 -0
- crca_llm/coauthor.py +118 -0
- crca_llm/orchestrator.py +289 -0
- crca_llm/types.py +21 -0
- crca_reasoning/__init__.py +16 -0
- crca_reasoning/critique.py +54 -0
- crca_reasoning/godclass.py +206 -0
- crca_reasoning/memory.py +24 -0
- crca_reasoning/rationale.py +10 -0
- crca_reasoning/react_controller.py +81 -0
- crca_reasoning/tool_router.py +97 -0
- crca_reasoning/types.py +40 -0
- crca_sd/__init__.py +15 -0
- crca_sd/crca_sd_core.py +2 -0
- crca_sd/crca_sd_governance.py +2 -0
- crca_sd/crca_sd_mpc.py +2 -0
- crca_sd/crca_sd_realtime.py +2 -0
- crca_sd/crca_sd_tui.py +2 -0
- cuda-keyring_1.1-1_all.deb +0 -0
- cuda-keyring_1.1-1_all.deb.1 +0 -0
- docs/IMAGE_ANNOTATION_USAGE.md +539 -0
- docs/INSTALL_DEEPSPEED.md +125 -0
- docs/api/branches/crca-cg.md +19 -0
- docs/api/branches/crca-q.md +27 -0
- docs/api/branches/crca-sd.md +37 -0
- docs/api/branches/general-agent.md +24 -0
- docs/api/branches/overview.md +19 -0
- docs/api/crca/agent-methods.md +62 -0
- docs/api/crca/operations.md +79 -0
- docs/api/crca/overview.md +32 -0
- docs/api/image-annotation/engine.md +52 -0
- docs/api/image-annotation/overview.md +17 -0
- docs/api/schemas/annotation.md +34 -0
- docs/api/schemas/core-schemas.md +82 -0
- docs/api/schemas/overview.md +32 -0
- docs/api/schemas/policy.md +30 -0
- docs/api/utils/conversation.md +22 -0
- docs/api/utils/graph-reasoner.md +32 -0
- docs/api/utils/overview.md +21 -0
- docs/api/utils/router.md +19 -0
- docs/api/utils/utilities.md +97 -0
- docs/architecture/causal-graphs.md +41 -0
- docs/architecture/data-flow.md +29 -0
- docs/architecture/design-principles.md +33 -0
- docs/architecture/hybrid-agent/components.md +38 -0
- docs/architecture/hybrid-agent/consistency.md +26 -0
- docs/architecture/hybrid-agent/overview.md +44 -0
- docs/architecture/hybrid-agent/reasoning.md +22 -0
- docs/architecture/llm-integration.md +26 -0
- docs/architecture/modular-structure.md +37 -0
- docs/architecture/overview.md +69 -0
- docs/architecture/policy-engine-arch.md +29 -0
- docs/branches/crca-cg/corposwarm.md +39 -0
- docs/branches/crca-cg/esg-scoring.md +30 -0
- docs/branches/crca-cg/multi-agent.md +35 -0
- docs/branches/crca-cg/overview.md +40 -0
- docs/branches/crca-q/alternative-data.md +55 -0
- docs/branches/crca-q/architecture.md +71 -0
- docs/branches/crca-q/backtesting.md +45 -0
- docs/branches/crca-q/causal-engine.md +33 -0
- docs/branches/crca-q/execution.md +39 -0
- docs/branches/crca-q/market-data.md +60 -0
- docs/branches/crca-q/overview.md +58 -0
- docs/branches/crca-q/philosophy.md +60 -0
- docs/branches/crca-q/portfolio-optimization.md +66 -0
- docs/branches/crca-q/risk-management.md +102 -0
- docs/branches/crca-q/setup.md +65 -0
- docs/branches/crca-q/signal-generation.md +61 -0
- docs/branches/crca-q/signal-validation.md +43 -0
- docs/branches/crca-sd/core.md +84 -0
- docs/branches/crca-sd/governance.md +53 -0
- docs/branches/crca-sd/mpc-solver.md +65 -0
- docs/branches/crca-sd/overview.md +59 -0
- docs/branches/crca-sd/realtime.md +28 -0
- docs/branches/crca-sd/tui.md +20 -0
- docs/branches/general-agent/overview.md +37 -0
- docs/branches/general-agent/personality.md +36 -0
- docs/branches/general-agent/prompt-builder.md +30 -0
- docs/changelog/index.md +79 -0
- docs/contributing/code-style.md +69 -0
- docs/contributing/documentation.md +43 -0
- docs/contributing/overview.md +29 -0
- docs/contributing/testing.md +29 -0
- docs/core/crcagent/async-operations.md +65 -0
- docs/core/crcagent/automatic-extraction.md +107 -0
- docs/core/crcagent/batch-prediction.md +80 -0
- docs/core/crcagent/bayesian-inference.md +60 -0
- docs/core/crcagent/causal-graph.md +92 -0
- docs/core/crcagent/counterfactuals.md +96 -0
- docs/core/crcagent/deterministic-simulation.md +78 -0
- docs/core/crcagent/dual-mode-operation.md +82 -0
- docs/core/crcagent/initialization.md +88 -0
- docs/core/crcagent/optimization.md +65 -0
- docs/core/crcagent/overview.md +63 -0
- docs/core/crcagent/time-series.md +57 -0
- docs/core/schemas/annotation.md +30 -0
- docs/core/schemas/core-schemas.md +82 -0
- docs/core/schemas/overview.md +30 -0
- docs/core/schemas/policy.md +41 -0
- docs/core/templates/base-agent.md +31 -0
- docs/core/templates/feature-mixins.md +31 -0
- docs/core/templates/overview.md +29 -0
- docs/core/templates/templates-guide.md +75 -0
- docs/core/tools/mcp-client.md +34 -0
- docs/core/tools/overview.md +24 -0
- docs/core/utils/conversation.md +27 -0
- docs/core/utils/graph-reasoner.md +29 -0
- docs/core/utils/overview.md +27 -0
- docs/core/utils/router.md +27 -0
- docs/core/utils/utilities.md +97 -0
- docs/css/custom.css +84 -0
- docs/examples/basic-usage.md +57 -0
- docs/examples/general-agent/general-agent-examples.md +50 -0
- docs/examples/hybrid-agent/hybrid-agent-examples.md +56 -0
- docs/examples/image-annotation/image-annotation-examples.md +54 -0
- docs/examples/integration/integration-examples.md +58 -0
- docs/examples/overview.md +37 -0
- docs/examples/trading/trading-examples.md +46 -0
- docs/features/causal-reasoning/advanced-topics.md +101 -0
- docs/features/causal-reasoning/counterfactuals.md +43 -0
- docs/features/causal-reasoning/do-calculus.md +50 -0
- docs/features/causal-reasoning/overview.md +47 -0
- docs/features/causal-reasoning/structural-models.md +52 -0
- docs/features/hybrid-agent/advanced-components.md +55 -0
- docs/features/hybrid-agent/core-components.md +64 -0
- docs/features/hybrid-agent/overview.md +34 -0
- docs/features/image-annotation/engine.md +82 -0
- docs/features/image-annotation/features.md +113 -0
- docs/features/image-annotation/integration.md +75 -0
- docs/features/image-annotation/overview.md +53 -0
- docs/features/image-annotation/quickstart.md +73 -0
- docs/features/policy-engine/doctrine-ledger.md +105 -0
- docs/features/policy-engine/monitoring.md +44 -0
- docs/features/policy-engine/mpc-control.md +89 -0
- docs/features/policy-engine/overview.md +46 -0
- docs/getting-started/configuration.md +225 -0
- docs/getting-started/first-agent.md +164 -0
- docs/getting-started/installation.md +144 -0
- docs/getting-started/quickstart.md +137 -0
- docs/index.md +118 -0
- docs/js/mathjax.js +13 -0
- docs/lrm/discovery_proof_notes.md +25 -0
- docs/lrm/finetune_full.md +83 -0
- docs/lrm/math_appendix.md +120 -0
- docs/lrm/overview.md +32 -0
- docs/mkdocs.yml +238 -0
- docs/stylesheets/extra.css +21 -0
- docs_generated/crca_core/CounterfactualResult.md +12 -0
- docs_generated/crca_core/DiscoveryHypothesisResult.md +13 -0
- docs_generated/crca_core/DraftSpec.md +13 -0
- docs_generated/crca_core/EstimateResult.md +13 -0
- docs_generated/crca_core/IdentificationResult.md +17 -0
- docs_generated/crca_core/InterventionDesignResult.md +12 -0
- docs_generated/crca_core/LockedSpec.md +15 -0
- docs_generated/crca_core/RefusalResult.md +12 -0
- docs_generated/crca_core/ValidationReport.md +9 -0
- docs_generated/crca_core/index.md +13 -0
- examples/general_agent_example.py +277 -0
- examples/general_agent_quickstart.py +202 -0
- examples/general_agent_simple.py +92 -0
- examples/hybrid_agent_auto_extraction.py +84 -0
- examples/hybrid_agent_dictionary_demo.py +104 -0
- examples/hybrid_agent_enhanced.py +179 -0
- examples/hybrid_agent_general_knowledge.py +107 -0
- examples/image_annotation_quickstart.py +328 -0
- examples/test_hybrid_fixes.py +77 -0
- image_annotation/__init__.py +27 -0
- image_annotation/annotation_engine.py +2593 -0
- install_cuda_wsl2.sh +59 -0
- install_deepspeed.sh +56 -0
- install_deepspeed_simple.sh +87 -0
- mkdocs.yml +252 -0
- ollama/Modelfile +8 -0
- prompts/__init__.py +2 -1
- prompts/default_crca.py +9 -1
- prompts/general_agent.py +227 -0
- prompts/image_annotation.py +56 -0
- pyproject.toml +17 -2
- requirements-docs.txt +10 -0
- requirements.txt +21 -2
- schemas/__init__.py +26 -1
- schemas/annotation.py +222 -0
- schemas/conversation.py +193 -0
- schemas/hybrid.py +211 -0
- schemas/reasoning.py +276 -0
- schemas_export/crca_core/CounterfactualResult.schema.json +108 -0
- schemas_export/crca_core/DiscoveryHypothesisResult.schema.json +113 -0
- schemas_export/crca_core/DraftSpec.schema.json +635 -0
- schemas_export/crca_core/EstimateResult.schema.json +113 -0
- schemas_export/crca_core/IdentificationResult.schema.json +145 -0
- schemas_export/crca_core/InterventionDesignResult.schema.json +111 -0
- schemas_export/crca_core/LockedSpec.schema.json +646 -0
- schemas_export/crca_core/RefusalResult.schema.json +90 -0
- schemas_export/crca_core/ValidationReport.schema.json +62 -0
- scripts/build_lrm_dataset.py +80 -0
- scripts/export_crca_core_schemas.py +54 -0
- scripts/export_hf_lrm.py +37 -0
- scripts/export_ollama_gguf.py +45 -0
- scripts/generate_changelog.py +157 -0
- scripts/generate_crca_core_docs_from_schemas.py +86 -0
- scripts/run_crca_core_benchmarks.py +163 -0
- scripts/run_full_finetune.py +198 -0
- scripts/run_lrm_eval.py +31 -0
- templates/graph_management.py +29 -0
- tests/conftest.py +9 -0
- tests/test_core.py +2 -3
- tests/test_crca_core_discovery_tabular.py +15 -0
- tests/test_crca_core_estimate_dowhy.py +36 -0
- tests/test_crca_core_identify.py +18 -0
- tests/test_crca_core_intervention_design.py +36 -0
- tests/test_crca_core_linear_gaussian_scm.py +69 -0
- tests/test_crca_core_spec.py +25 -0
- tests/test_crca_core_timeseries_pcmci.py +15 -0
- tests/test_crca_llm_coauthor.py +12 -0
- tests/test_crca_llm_orchestrator.py +80 -0
- tests/test_hybrid_agent_llm_enhanced.py +556 -0
- tests/test_image_annotation_demo.py +376 -0
- tests/test_image_annotation_operational.py +408 -0
- tests/test_image_annotation_unit.py +551 -0
- tests/test_training_moe.py +13 -0
- training/__init__.py +42 -0
- training/datasets.py +140 -0
- training/deepspeed_zero2_0_5b.json +22 -0
- training/deepspeed_zero2_1_5b.json +22 -0
- training/deepspeed_zero3_0_5b.json +28 -0
- training/deepspeed_zero3_14b.json +28 -0
- training/deepspeed_zero3_h100_3gpu.json +20 -0
- training/deepspeed_zero3_offload.json +28 -0
- training/eval.py +92 -0
- training/finetune.py +516 -0
- training/public_datasets.py +89 -0
- training_data/react_train.jsonl +7473 -0
- utils/agent_discovery.py +311 -0
- utils/batch_processor.py +317 -0
- utils/conversation.py +78 -0
- utils/edit_distance.py +118 -0
- utils/formatter.py +33 -0
- utils/graph_reasoner.py +530 -0
- utils/rate_limiter.py +283 -0
- utils/router.py +2 -2
- utils/tool_discovery.py +307 -0
- webui/__init__.py +10 -0
- webui/app.py +229 -0
- webui/config.py +104 -0
- webui/static/css/style.css +332 -0
- webui/static/js/main.js +284 -0
- webui/templates/index.html +42 -0
- tests/test_crca_excel.py +0 -166
- tests/test_data_broker.py +0 -424
- tests/test_palantir.py +0 -349
- {crca-1.4.0.dist-info → crca-1.5.0.dist-info}/WHEEL +0 -0
- {crca-1.4.0.dist-info → crca-1.5.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Integration with Agents
|
|
2
|
+
|
|
3
|
+
Image annotation integrates seamlessly with CRCAAgent and GeneralAgent.
|
|
4
|
+
|
|
5
|
+
## CRCAAgent Integration
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from CRCA import CRCAAgent
|
|
9
|
+
|
|
10
|
+
agent = CRCAAgent(
|
|
11
|
+
model_name="gpt-4o-mini",
|
|
12
|
+
use_image_annotation=True
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
# Agent automatically has annotate_image and query_image tools
|
|
16
|
+
response = agent.run("Analyze the image at path/to/image.png")
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Available Tools
|
|
20
|
+
|
|
21
|
+
When `use_image_annotation=True`, the agent gets:
|
|
22
|
+
|
|
23
|
+
1. **`annotate_image`**: Annotate an image and get structured results
|
|
24
|
+
2. **`query_image`**: Query an annotated image with natural language
|
|
25
|
+
|
|
26
|
+
## Manual Tool Usage
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
annotate_tool = agent.tools_list_dictionary.get("annotate_image")
|
|
30
|
+
query_tool = agent.tools_list_dictionary.get("query_image")
|
|
31
|
+
|
|
32
|
+
# Use annotate_image
|
|
33
|
+
result = annotate_tool(
|
|
34
|
+
image_path="path/to/image.png",
|
|
35
|
+
output_format="all"
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
# Use query_image
|
|
39
|
+
answer = query_tool(
|
|
40
|
+
image_path="path/to/image.png",
|
|
41
|
+
query="What is the largest object?"
|
|
42
|
+
)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## GeneralAgent Integration
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from branches.general_agent.general_agent import GeneralAgent
|
|
49
|
+
|
|
50
|
+
agent = GeneralAgent(
|
|
51
|
+
model_name="gpt-4o-mini",
|
|
52
|
+
enable_multimodal=True # Enables image annotation
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Combined Analysis
|
|
57
|
+
|
|
58
|
+
Combine image analysis with causal reasoning:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
task = """
|
|
62
|
+
Analyze the tactical map at path/to/map.png:
|
|
63
|
+
1. Identify all military installations
|
|
64
|
+
2. Measure distances between key targets
|
|
65
|
+
3. Extract causal variables from the map
|
|
66
|
+
4. Perform causal analysis
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
response = agent.run(task)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Next Steps
|
|
73
|
+
|
|
74
|
+
- [Overview](overview.md) - Return to overview
|
|
75
|
+
- [Policy Engine](../policy-engine/overview.md) - Policy engine features
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Image Annotation Overview
|
|
2
|
+
|
|
3
|
+
The image annotation system in CR-CA provides automated image analysis with geometric primitive extraction, semantic labeling, and query capabilities.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **Geometric Primitive Extraction**: Automatically detect circles, lines, contours, and other geometric shapes
|
|
8
|
+
- **Semantic Labeling**: Identify and label objects in images using LLM-based analysis
|
|
9
|
+
- **Natural Language Queries**: Query images with natural language questions
|
|
10
|
+
- **Temporal Tracking**: Track entities across video frames using Kalman filters
|
|
11
|
+
- **Batch Processing**: Process multiple images in parallel
|
|
12
|
+
- **Integration**: Seamless integration with CRCAAgent and GeneralAgent
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
from image_annotation import ImageAnnotationEngine
|
|
18
|
+
|
|
19
|
+
engine = ImageAnnotationEngine()
|
|
20
|
+
result = engine.annotate("path/to/image.png", output="all")
|
|
21
|
+
|
|
22
|
+
print(f"Found {len(result.annotation_graph.entities)} entities")
|
|
23
|
+
print(result.formal_report)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Mathematical Foundation
|
|
27
|
+
|
|
28
|
+
Image annotation uses computer vision algorithms combined with LLM-based semantic understanding. Geometric primitives are detected using:
|
|
29
|
+
|
|
30
|
+
- **Circle Detection**: Hough circle transform with parameters $(x_c, y_c, r)$
|
|
31
|
+
- **Line Detection**: Hough line transform detecting lines with parameters $(\rho, \theta)$
|
|
32
|
+
- **Contour Detection**: Edge detection followed by contour extraction
|
|
33
|
+
|
|
34
|
+
Semantic labeling uses LLM-based classification to assign labels $L_i$ to entities $E_i$:
|
|
35
|
+
|
|
36
|
+
$$P(L_i | E_i, I) = LLM(E_i, I)$$
|
|
37
|
+
|
|
38
|
+
Where $I$ is the image context.
|
|
39
|
+
|
|
40
|
+
## Integration
|
|
41
|
+
|
|
42
|
+
- **[Quickstart](quickstart.md)**: Get started quickly
|
|
43
|
+
- **[Engine](engine.md)**: AnnotationEngine class details
|
|
44
|
+
- **[Geometric Primitives](geometric-primitives.md)**: Primitive extraction
|
|
45
|
+
- **[Semantic Labeling](semantic-labeling.md)**: Semantic labeling system
|
|
46
|
+
- **[Query Capabilities](query-capabilities.md)**: Natural language queries
|
|
47
|
+
- **[Temporal Tracking](temporal-tracking.md)**: Video frame tracking
|
|
48
|
+
- **[Integration](integration.md)**: Integration with agents
|
|
49
|
+
|
|
50
|
+
## Next Steps
|
|
51
|
+
|
|
52
|
+
- [Quickstart](quickstart.md) - Get started in minutes
|
|
53
|
+
- [Engine](engine.md) - Learn about the engine
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Image Annotation Quickstart
|
|
2
|
+
|
|
3
|
+
Get started with image annotation in minutes.
|
|
4
|
+
|
|
5
|
+
## Basic Annotation
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from image_annotation import ImageAnnotationEngine
|
|
9
|
+
|
|
10
|
+
engine = ImageAnnotationEngine()
|
|
11
|
+
result = engine.annotate("path/to/image.png", output="all")
|
|
12
|
+
|
|
13
|
+
print(f"Found {len(result.annotation_graph.entities)} entities")
|
|
14
|
+
print(result.formal_report)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## With CRCAAgent
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from CRCA import CRCAAgent
|
|
21
|
+
|
|
22
|
+
agent = CRCAAgent(
|
|
23
|
+
model_name="gpt-4o-mini",
|
|
24
|
+
use_image_annotation=True
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
response = agent.run("Analyze the image at path/to/image.png and identify all objects")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Supported Input Types
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
# File path
|
|
34
|
+
result = engine.annotate("image.png")
|
|
35
|
+
|
|
36
|
+
# URL
|
|
37
|
+
result = engine.annotate("https://example.com/image.png")
|
|
38
|
+
|
|
39
|
+
# NumPy array
|
|
40
|
+
import cv2
|
|
41
|
+
img = cv2.imread("image.png")
|
|
42
|
+
result = engine.annotate(img)
|
|
43
|
+
|
|
44
|
+
# PIL Image
|
|
45
|
+
from PIL import Image
|
|
46
|
+
img = Image.open("image.png")
|
|
47
|
+
result = engine.annotate(img)
|
|
48
|
+
|
|
49
|
+
# Batch processing
|
|
50
|
+
results = engine.annotate(["img1.png", "img2.png", "img3.png"])
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Output Formats
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
# Annotated overlay image
|
|
57
|
+
overlay = engine.annotate("image.png", output="overlay")
|
|
58
|
+
cv2.imwrite("annotated.png", overlay)
|
|
59
|
+
|
|
60
|
+
# JSON data
|
|
61
|
+
json_data = engine.annotate("image.png", output="json")
|
|
62
|
+
|
|
63
|
+
# Formal report
|
|
64
|
+
report = engine.annotate("image.png", output="report")
|
|
65
|
+
|
|
66
|
+
# Complete result object
|
|
67
|
+
result = engine.annotate("image.png", output="all")
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Next Steps
|
|
71
|
+
|
|
72
|
+
- [Engine](engine.md) - Learn about AnnotationEngine
|
|
73
|
+
- [Geometric Primitives](geometric-primitives.md) - Understand primitive extraction
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Doctrine & Ledger System
|
|
2
|
+
|
|
3
|
+
Doctrine system defines policy objectives and constraints. Ledger tracks state and events.
|
|
4
|
+
|
|
5
|
+
## Doctrine System
|
|
6
|
+
|
|
7
|
+
DoctrineV1 provides a structured way to define what an agent should optimize for and what constraints it must respect.
|
|
8
|
+
|
|
9
|
+
### Mathematical Foundation
|
|
10
|
+
|
|
11
|
+
Doctrine defines an optimization problem:
|
|
12
|
+
|
|
13
|
+
$$\min_{\mathbf{u}} \sum_{i=1}^n w_i J_i(\mathbf{u})$$
|
|
14
|
+
|
|
15
|
+
Subject to:
|
|
16
|
+
|
|
17
|
+
$$g_j(\mathbf{u}) \leq 0, \quad j = 1, \ldots, m$$
|
|
18
|
+
$$h_k(\mathbf{u}) = 0, \quad k = 1, \ldots, p$$
|
|
19
|
+
|
|
20
|
+
### Usage
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from schemas.policy import DoctrineV1
|
|
24
|
+
|
|
25
|
+
doctrine = DoctrineV1(
|
|
26
|
+
version="1.0.0",
|
|
27
|
+
objectives=["maximize_efficiency", "minimize_cost"],
|
|
28
|
+
constraints=["budget_limit", "resource_availability"]
|
|
29
|
+
)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Ledger System
|
|
33
|
+
|
|
34
|
+
Ledger provides persistent storage for policy state, enabling rollback and audit trails.
|
|
35
|
+
|
|
36
|
+
### Mathematical Foundation
|
|
37
|
+
|
|
38
|
+
Ledger maintains state history:
|
|
39
|
+
|
|
40
|
+
$$L_t = \{(\tau_i, s_i, a_i, r_i)\}_{i=1}^t$$
|
|
41
|
+
|
|
42
|
+
Where:
|
|
43
|
+
- $\tau_i$: Timestamp
|
|
44
|
+
- $s_i$: State at time $i$
|
|
45
|
+
- $a_i$: Action taken
|
|
46
|
+
- $r_i$: Result/outcome
|
|
47
|
+
|
|
48
|
+
### Usage
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from utils.ledger import Ledger
|
|
52
|
+
|
|
53
|
+
ledger = Ledger(doctrine=doctrine)
|
|
54
|
+
ledger.record(state=current_state, action=taken_action)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Rollback Mechanisms
|
|
58
|
+
|
|
59
|
+
Rollback enables reverting to previous states.
|
|
60
|
+
|
|
61
|
+
### Mathematical Foundation
|
|
62
|
+
|
|
63
|
+
Rollback maintains state history:
|
|
64
|
+
|
|
65
|
+
$$H_t = \{(\tau_i, s_i)\}_{i=1}^t$$
|
|
66
|
+
|
|
67
|
+
Rollback to time $t'$ restores:
|
|
68
|
+
|
|
69
|
+
$$s_{current} \leftarrow s_{t'}$$
|
|
70
|
+
|
|
71
|
+
### Usage
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from utils.rollback import RollbackManager
|
|
75
|
+
|
|
76
|
+
rollback = RollbackManager()
|
|
77
|
+
rollback.save_state(current_state)
|
|
78
|
+
rollback.rollback_to(timestamp)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Doctrine Versioning
|
|
82
|
+
|
|
83
|
+
Doctrine versioning manages compatibility and migration between doctrine versions.
|
|
84
|
+
|
|
85
|
+
### Mathematical Foundation
|
|
86
|
+
|
|
87
|
+
Version compatibility:
|
|
88
|
+
|
|
89
|
+
$$Compatible(v_1, v_2) = \begin{cases}
|
|
90
|
+
1 & \text{if } v_1 = v_2 \text{ or } v_2 \in CompatibleVersions(v_1) \\
|
|
91
|
+
0 & \text{otherwise}
|
|
92
|
+
\end{cases}$$
|
|
93
|
+
|
|
94
|
+
### Usage
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from utils.doctrine_versioning import DoctrineRegistry
|
|
98
|
+
|
|
99
|
+
registry = DoctrineRegistry()
|
|
100
|
+
registry.register(doctrine, compatibility=["1.0.0", "1.1.0"])
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Next Steps
|
|
104
|
+
|
|
105
|
+
- [MPC & Control](mpc-control.md) - MPC and control systems
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Monitoring & Drift Detection
|
|
2
|
+
|
|
3
|
+
Monitoring systems and drift detection for policy engines.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Monitoring systems track policy performance and detect when system behavior deviates from expected patterns.
|
|
8
|
+
|
|
9
|
+
## Drift Detection
|
|
10
|
+
|
|
11
|
+
Drift detection identifies when system behavior deviates from expected patterns.
|
|
12
|
+
|
|
13
|
+
### Mathematical Foundation
|
|
14
|
+
|
|
15
|
+
Drift is detected when:
|
|
16
|
+
|
|
17
|
+
$$D(\mathbf{x}_t, \mathbf{x}_{expected}) > \theta$$
|
|
18
|
+
|
|
19
|
+
Where:
|
|
20
|
+
- $D$: Distance metric
|
|
21
|
+
- $\mathbf{x}_t$: Current state
|
|
22
|
+
- $\mathbf{x}_{expected}$: Expected state
|
|
23
|
+
- $\theta$: Drift threshold
|
|
24
|
+
|
|
25
|
+
### Distance Metrics
|
|
26
|
+
|
|
27
|
+
**Euclidean Distance**:
|
|
28
|
+
$$D_{Euclidean} = \|\mathbf{x}_t - \mathbf{x}_{expected}\|_2$$
|
|
29
|
+
|
|
30
|
+
**Mahalanobis Distance**:
|
|
31
|
+
$$D_{Mahalanobis} = \sqrt{(\mathbf{x}_t - \mathbf{x}_{expected})' \Sigma^{-1} (\mathbf{x}_t - \mathbf{x}_{expected})}$$
|
|
32
|
+
|
|
33
|
+
### Usage
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from templates.drift_detection import DriftDetector
|
|
37
|
+
|
|
38
|
+
detector = DriftDetector(threshold=0.1)
|
|
39
|
+
drift_detected = detector.check(current_state, expected_state)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Next Steps
|
|
43
|
+
|
|
44
|
+
- [Overview](overview.md) - Return to overview
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# MPC & Control Systems
|
|
2
|
+
|
|
3
|
+
Model Predictive Control and policy execution systems.
|
|
4
|
+
|
|
5
|
+
## Model Predictive Control (MPC)
|
|
6
|
+
|
|
7
|
+
MPC solves optimization problems over a prediction horizon to determine optimal control actions.
|
|
8
|
+
|
|
9
|
+
### Mathematical Foundation
|
|
10
|
+
|
|
11
|
+
MPC solves:
|
|
12
|
+
|
|
13
|
+
$$\min_{\mathbf{u}_{t:t+H-1}} \sum_{k=0}^{H-1} \ell(\mathbf{x}_{t+k}, \mathbf{u}_{t+k}) + V(\mathbf{x}_{t+H})$$
|
|
14
|
+
|
|
15
|
+
Subject to:
|
|
16
|
+
|
|
17
|
+
$$\mathbf{x}_{t+k+1} = f(\mathbf{x}_{t+k}, \mathbf{u}_{t+k})$$
|
|
18
|
+
$$\mathbf{g}(\mathbf{x}_{t+k}, \mathbf{u}_{t+k}) \leq 0$$
|
|
19
|
+
|
|
20
|
+
### Stage Cost
|
|
21
|
+
|
|
22
|
+
$$\ell(\mathbf{x}, \mathbf{u}) = \|\mathbf{x} - \mathbf{x}_{ref}\|_Q^2 + \|\mathbf{u} - \mathbf{u}_{ref}\|_R^2$$
|
|
23
|
+
|
|
24
|
+
### Usage
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from templates.mpc_planner import MPCPlanner
|
|
28
|
+
|
|
29
|
+
planner = MPCPlanner(horizon=10)
|
|
30
|
+
optimal_controls = planner.solve(current_state, reference_state)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Policy Loop
|
|
34
|
+
|
|
35
|
+
Policy loop executes policy decisions in a temporal loop.
|
|
36
|
+
|
|
37
|
+
### Mathematical Foundation
|
|
38
|
+
|
|
39
|
+
Policy loop implements:
|
|
40
|
+
|
|
41
|
+
$$\pi_t = \arg\max_{\pi} E\left[\sum_{k=0}^H \gamma^k r_{t+k} | s_t, \pi\right]$$
|
|
42
|
+
|
|
43
|
+
Where:
|
|
44
|
+
- $\pi_t$: Policy at time $t$
|
|
45
|
+
- $r_{t+k}$: Reward at time $t+k$
|
|
46
|
+
- $\gamma$: Discount factor
|
|
47
|
+
- $H$: Horizon
|
|
48
|
+
|
|
49
|
+
### Usage
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from templates.policy_loop import PolicyLoopMixin
|
|
53
|
+
|
|
54
|
+
class PolicyAgent(BaseAgent, PolicyLoopMixin):
|
|
55
|
+
def __init__(self):
|
|
56
|
+
super().__init__()
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Sensors & Actuators
|
|
60
|
+
|
|
61
|
+
Sensors observe system state, actuators execute actions.
|
|
62
|
+
|
|
63
|
+
### Mathematical Foundation
|
|
64
|
+
|
|
65
|
+
**Sensors** observe state:
|
|
66
|
+
|
|
67
|
+
$$o_t = h(s_t, \nu_t)$$
|
|
68
|
+
|
|
69
|
+
Where:
|
|
70
|
+
- $o_t$: Observation
|
|
71
|
+
- $s_t$: True state
|
|
72
|
+
- $\nu_t$: Observation noise
|
|
73
|
+
|
|
74
|
+
**Actuators** execute actions:
|
|
75
|
+
|
|
76
|
+
$$a_t = \pi(o_t)$$
|
|
77
|
+
|
|
78
|
+
Where $\pi$ is the policy.
|
|
79
|
+
|
|
80
|
+
### Usage
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
observation = sensor.observe()
|
|
84
|
+
actuator.execute(action)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Next Steps
|
|
88
|
+
|
|
89
|
+
- [Monitoring](monitoring.md) - Monitoring and drift detection
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Policy Engine Overview
|
|
2
|
+
|
|
3
|
+
The policy engine system provides autonomous system control using Model Predictive Control (MPC) with policy doctrines, ledgers, and rollback mechanisms.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Policy engine enables agents to operate with defined policies, track state through ledgers, and rollback changes when needed.
|
|
8
|
+
|
|
9
|
+
## Key Features
|
|
10
|
+
|
|
11
|
+
- **Doctrine System**: Define policy objectives and constraints
|
|
12
|
+
- **Ledger**: Track state and events
|
|
13
|
+
- **Rollback**: Rollback mechanisms for state recovery
|
|
14
|
+
- **MPC**: Model Predictive Control optimization
|
|
15
|
+
- **Drift Detection**: Detect policy drift
|
|
16
|
+
- **Sensors & Actuators**: Interface with external systems
|
|
17
|
+
|
|
18
|
+
## Mathematical Foundation
|
|
19
|
+
|
|
20
|
+
Policy engine implements MPC:
|
|
21
|
+
|
|
22
|
+
$$\min_{\mathbf{u}_{t:t+H-1}} \sum_{k=0}^{H-1} \ell(\mathbf{x}_{t+k}, \mathbf{u}_{t+k}) + V(\mathbf{x}_{t+H})$$
|
|
23
|
+
|
|
24
|
+
Subject to:
|
|
25
|
+
|
|
26
|
+
$$\mathbf{x}_{t+k+1} = f(\mathbf{x}_{t+k}, \mathbf{u}_{t+k})$$
|
|
27
|
+
$$\mathbf{g}(\mathbf{x}_{t+k}, \mathbf{u}_{t+k}) \leq 0$$
|
|
28
|
+
|
|
29
|
+
Where:
|
|
30
|
+
- $H$: Prediction horizon
|
|
31
|
+
- $\ell$: Stage cost
|
|
32
|
+
- $V$: Terminal cost
|
|
33
|
+
- $f$: System dynamics
|
|
34
|
+
- $\mathbf{g}$: Constraints
|
|
35
|
+
|
|
36
|
+
## Documentation
|
|
37
|
+
|
|
38
|
+
- **[Doctrine](doctrine.md)**: Doctrine system (DoctrineV1)
|
|
39
|
+
- **[Ledger](ledger.md)**: Ledger for state tracking
|
|
40
|
+
- **[MPC](mpc.md)**: Model Predictive Control
|
|
41
|
+
- **[Drift Detection](drift-detection.md)**: Drift detection
|
|
42
|
+
|
|
43
|
+
## Next Steps
|
|
44
|
+
|
|
45
|
+
- [Doctrine](doctrine.md) - Doctrine system
|
|
46
|
+
- [Ledger](ledger.md) - State tracking
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
Configure CR-CA for your specific use case. This guide covers environment setup, agent configuration, and advanced settings.
|
|
4
|
+
|
|
5
|
+
## Environment Configuration
|
|
6
|
+
|
|
7
|
+
### Required Environment Variables
|
|
8
|
+
|
|
9
|
+
Create a `.env` file in your project root:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# LLM Configuration
|
|
13
|
+
OPENAI_API_KEY=your_openai_api_key_here
|
|
14
|
+
|
|
15
|
+
# Model selection (optional, defaults to gpt-4o-mini)
|
|
16
|
+
OPENAI_MODEL=gpt-4o-mini
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Optional Environment Variables
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# CRCA-Q Trading
|
|
23
|
+
KRAKEN_API_KEY=your_kraken_key
|
|
24
|
+
KRAKEN_API_SECRET=your_kraken_secret
|
|
25
|
+
|
|
26
|
+
# Alternative Data Sources
|
|
27
|
+
TWITTER_BEARER_TOKEN=your_twitter_token
|
|
28
|
+
NEWSAPI_KEY=your_newsapi_key
|
|
29
|
+
ETHERSCAN_API_KEY=your_etherscan_key
|
|
30
|
+
THEGRAPH_API_KEY=your_thegraph_key
|
|
31
|
+
|
|
32
|
+
# MCP Servers
|
|
33
|
+
MCP_SERVER_URL=http://localhost:8000
|
|
34
|
+
MCP_API_KEY=your_mcp_api_key
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Agent Configuration
|
|
38
|
+
|
|
39
|
+
### Basic Configuration
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from CRCA import CRCAAgent
|
|
43
|
+
|
|
44
|
+
agent = CRCAAgent(
|
|
45
|
+
model_name="gpt-4o-mini",
|
|
46
|
+
agent_name="my-agent",
|
|
47
|
+
max_loops=5,
|
|
48
|
+
temperature=0.7
|
|
49
|
+
)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Advanced Configuration
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
agent = CRCAAgent(
|
|
56
|
+
model_name="gpt-4o-mini",
|
|
57
|
+
agent_name="advanced-agent",
|
|
58
|
+
|
|
59
|
+
# LLM Settings
|
|
60
|
+
max_loops=10,
|
|
61
|
+
temperature=0.7,
|
|
62
|
+
max_tokens=2000,
|
|
63
|
+
|
|
64
|
+
# Causal Reasoning Settings
|
|
65
|
+
enable_automatic_extraction=True,
|
|
66
|
+
causal_graph_threshold=0.3,
|
|
67
|
+
|
|
68
|
+
# Simulation Settings
|
|
69
|
+
simulation_steps=100,
|
|
70
|
+
simulation_dt=0.01,
|
|
71
|
+
|
|
72
|
+
# Optimization Settings
|
|
73
|
+
optimization_method="gradient",
|
|
74
|
+
optimization_max_iter=1000,
|
|
75
|
+
|
|
76
|
+
# Tools
|
|
77
|
+
use_crca_tools=True,
|
|
78
|
+
use_image_annotation=False
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Configuration Parameters
|
|
83
|
+
|
|
84
|
+
### LLM Parameters
|
|
85
|
+
|
|
86
|
+
- `model_name`: LLM model to use (e.g., "gpt-4o-mini", "gpt-4")
|
|
87
|
+
- `max_loops`: Maximum number of reasoning loops
|
|
88
|
+
- `temperature`: Sampling temperature (0.0-2.0)
|
|
89
|
+
- `max_tokens`: Maximum tokens per response
|
|
90
|
+
|
|
91
|
+
### Causal Reasoning Parameters
|
|
92
|
+
|
|
93
|
+
- `enable_automatic_extraction`: Enable automatic variable extraction
|
|
94
|
+
- `causal_graph_threshold`: Minimum strength for causal relationships
|
|
95
|
+
- `enable_counterfactuals`: Enable counterfactual generation
|
|
96
|
+
- `counterfactual_samples`: Number of counterfactual scenarios
|
|
97
|
+
|
|
98
|
+
### Simulation Parameters
|
|
99
|
+
|
|
100
|
+
- `simulation_steps`: Number of simulation steps
|
|
101
|
+
- `simulation_dt`: Time step size
|
|
102
|
+
- `simulation_method`: Simulation method ("euler", "rk4")
|
|
103
|
+
|
|
104
|
+
### Optimization Parameters
|
|
105
|
+
|
|
106
|
+
- `optimization_method`: Optimization method ("gradient", "bellman")
|
|
107
|
+
- `optimization_max_iter`: Maximum optimization iterations
|
|
108
|
+
- `optimization_tolerance`: Convergence tolerance
|
|
109
|
+
|
|
110
|
+
## Mode Configuration
|
|
111
|
+
|
|
112
|
+
### LLM Mode (Default)
|
|
113
|
+
|
|
114
|
+
Uses LLM for causal reasoning and analysis:
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
agent = CRCAAgent(
|
|
118
|
+
model_name="gpt-4o-mini",
|
|
119
|
+
mode="llm" # Default
|
|
120
|
+
)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Deterministic Mode
|
|
124
|
+
|
|
125
|
+
Uses mathematical simulation without LLM:
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
agent = CRCAAgent(
|
|
129
|
+
model_name="gpt-4o-mini",
|
|
130
|
+
mode="deterministic"
|
|
131
|
+
)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Policy Engine Configuration
|
|
135
|
+
|
|
136
|
+
If using the policy engine:
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from schemas.policy import DoctrineV1
|
|
140
|
+
from utils.ledger import Ledger
|
|
141
|
+
|
|
142
|
+
# Create doctrine
|
|
143
|
+
doctrine = DoctrineV1(
|
|
144
|
+
version="1.0.0",
|
|
145
|
+
objectives=["maximize_efficiency", "minimize_cost"],
|
|
146
|
+
constraints=["budget_limit", "resource_availability"]
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
# Initialize ledger
|
|
150
|
+
ledger = Ledger(doctrine=doctrine)
|
|
151
|
+
|
|
152
|
+
# Use with agent
|
|
153
|
+
agent = CRCAAgent(
|
|
154
|
+
model_name="gpt-4o-mini",
|
|
155
|
+
policy_ledger=ledger
|
|
156
|
+
)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Image Annotation Configuration
|
|
160
|
+
|
|
161
|
+
Enable image annotation:
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
agent = CRCAAgent(
|
|
165
|
+
model_name="gpt-4o-mini",
|
|
166
|
+
use_image_annotation=True,
|
|
167
|
+
image_annotation_config={
|
|
168
|
+
"gpt_model": "gpt-4o-mini",
|
|
169
|
+
"enable_temporal_tracking": False,
|
|
170
|
+
"cache_enabled": True
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Logging Configuration
|
|
176
|
+
|
|
177
|
+
Configure logging:
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
from loguru import logger
|
|
181
|
+
|
|
182
|
+
# Configure loguru
|
|
183
|
+
logger.add(
|
|
184
|
+
"crca.log",
|
|
185
|
+
rotation="10 MB",
|
|
186
|
+
retention="7 days",
|
|
187
|
+
level="INFO"
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
agent = CRCAAgent(
|
|
191
|
+
model_name="gpt-4o-mini",
|
|
192
|
+
verbose=True # Enable verbose logging
|
|
193
|
+
)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Performance Configuration
|
|
197
|
+
|
|
198
|
+
### Caching
|
|
199
|
+
|
|
200
|
+
Enable caching for faster repeated queries:
|
|
201
|
+
|
|
202
|
+
```python
|
|
203
|
+
agent = CRCAAgent(
|
|
204
|
+
model_name="gpt-4o-mini",
|
|
205
|
+
cache_enabled=True,
|
|
206
|
+
cache_ttl=3600 # Cache TTL in seconds
|
|
207
|
+
)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Parallel Processing
|
|
211
|
+
|
|
212
|
+
Enable parallel processing for batch operations:
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
agent = CRCAAgent(
|
|
216
|
+
model_name="gpt-4o-mini",
|
|
217
|
+
parallel_workers=4 # Number of parallel workers
|
|
218
|
+
)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Next Steps
|
|
222
|
+
|
|
223
|
+
- [First Agent](first-agent.md) - Create your first configured agent
|
|
224
|
+
- [Core Modules](../core/crcagent/overview.md) - Learn about core functionality
|
|
225
|
+
- [Advanced Features](../features/causal-reasoning/overview.md) - Explore advanced features
|