Back to Prompt Library
implementation

Implement Compliance Checking Tool and Agent Workflow

Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.

Linked challenge: Build a Secure Enterprise Data Analysis Agent with LlamaIndex and Modern LLMs

Format
Code-aware
Lines
3
Sections
1
Linked challenge
Build a Secure Enterprise Data Analysis Agent with LlamaIndex and Modern LLMs

Prompt source

Original prompt text with formatting preserved for inspection.

3 lines
1 sections
No variables
1 code block
Develop a new tool `check_policy_compliance(policy_text: str, log_data: str)` that uses Claude 4 Sonnet to analyze an internal policy document and Gemini 3 Flash to cross-reference simulated operational log data for compliance violations. Integrate this tool into your LlamaIndex agent. The agent should be able to receive a policy and log, call the tool, and report the compliance status, explaining any violations. Focus on the secure handling of this sensitive data. ```python
# Assume agent setup and LLM clients are ready def check_policy_compliance(policy_text: str, log_data: str) -> str: """Checks operational logs against a policy document for compliance.""" # Example: use Claude 4 Sonnet for policy understanding # Then use Gemini 3 Flash for logical comparison with log_data # This part would involve actual LLM calls and careful prompt engineering # to ensure secure processing and accurate violation detection. # Simulate LLM output: if "data access requests" in policy_text and "approved_by" in log_data and "1 manager" in log_data: return "Compliance Status: Non-compliant. Violation: Data access not approved by two managers." return "Compliance Status: Compliant." compliance_tool = FunctionTool.from_defaults(fn=check_policy_compliance) # Your task: Add this tool to your ReActAgent and demonstrate a query that uses it.
```

Adaptation plan

Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.

Keep stable

Hold the task contract and output shape stable so generated implementations remain comparable.

Tune next

Update libraries, interfaces, and environment assumptions to match the stack you actually run.

Verify after

Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.