Modify review-item-processor agent prompts, models, and tool configuration
review-item-processor/
āāā agent.py # Prompt generators + agent execution
āāā model_config.py # Model registry with capabilities
āāā tools/
ā āāā factory.py # Dynamic tool creation
ā āāā knowledge_base.py # Bedrock KB integration
ā āāā code_interpreter.py
ā āāā mcp_tool.py # MCP tool support
āāā index.py # Lambda handler entry point
File: agent.py
Key functions:
get_document_review_prompt() - Main entry point_get_document_review_prompt_with_citations() - With citations_get_document_review_prompt_legacy() - Without citationsJSON Schema:
{
"result": "pass" | "fail",
"confidence": <number 0-1>,
"explanation": "<detailed reasoning>",
"shortExplanation": "<max 80 chars>",
"pageNumber": <integer from 1>,
"citations": ["<quoted text>", ...]
}
File: agent.py, function get_image_review_prompt()
JSON Schema (Nova models add boundingBoxes):
{
"result": "pass" | "fail",
"confidence": <number 0-1>,
"explanation": "<detailed reasoning>",
"shortExplanation": "<max 80 chars>",
"usedImageIndexes": [<list of indexes>]
}
Environment Variables (set in CDK):
DOCUMENT_PROCESSING_MODEL_ID, IMAGE_REVIEW_MODEL_ID, BEDROCK_REGIONENABLE_CITATIONS, ENABLE_CODE_INTERPRETERChange models via CDK:
cdk deploy -c rapid.documentProcessingModelId="global.anthropic.claude-opus-4-6-v1"
Add new model to model_config.py in _get_model_configs():
"model-id": ModelConfig(
model_id="model-id",
supports_document_block=True,
supports_citation=True,
supports_caching=True,
input_per_1k=0.XXX,
output_per_1k=0.XXX,
)
cdk/lib/parameter-schema.tscdk/lib/constructs/agent.tsagent.py with os.environ.get()For detailed tool creation guide, see references/TOOL-CREATION.md.
| Modification | Location | Search For |
|---|---|---|
| Document prompt schema | agent.py | _get_document_review_prompt |
| Image prompt schema | agent.py | get_image_review_prompt |
| Confidence guidelines | agent.py | confidence_guidelines |
| Tool usage instructions | agent.py | _build_tool_usage_section |
| Model capabilities | model_config.py | _get_model_configs |
| Environment variables | CDK agent.ts | environment: |
| Issue | Check |
|---|---|
| Citations not working | ENABLE_CITATIONS env var, model supports citations in model_config.py |
| Model not found | Model ID format, available in BEDROCK_REGION, added to model_config.py |
| Tool not available | Tool configuration in event payload, registered in factory.py |
| Wrong output format | JSON schema in prompt, {language_name} placeholders |
/build-and-format if Python code changed/deploy-cdk-stack if CDK changes made