Skip to content

Commit 1ddaeae

Browse files
committed
Initial commit: Agentforce Data-Aware Agent project with documentation and Salesforce metadata
0 parents  commit 1ddaeae

47 files changed

Lines changed: 492 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

6 KB
Binary file not shown.

.github/workflows/pr-validate.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: PR Validate (Scratch Org)
2+
on:
3+
pull_request: { branches: [ main, master ] }
4+
workflow_dispatch:
5+
permissions: { contents: read }
6+
jobs:
7+
validate:
8+
runs-on: ubuntu-latest
9+
timeout-minutes: 60
10+
env:
11+
SCRATCH_ALIAS: ci-${{ github.run_id }}
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with: { node-version: '20' }
16+
- run: npm install --global @salesforce/cli
17+
- run: sf --version
18+
- name: Write JWT key
19+
run: echo "$SF_JWT_KEY" > server.key && chmod 600 server.key
20+
env: { SF_JWT_KEY: ${{ secrets.SF_JWT_KEY }} }
21+
- name: Authenticate Dev Hub (JWT)
22+
env:
23+
SF_CONSUMER_KEY: ${{ secrets.SF_CONSUMER_KEY }}
24+
SF_USERNAME: ${{ secrets.SF_USERNAME }}
25+
run: |
26+
sf org login jwt --client-id "$SF_CONSUMER_KEY" --jwt-key-file server.key --username "$SF_USERNAME" --instance-url "https://login.salesforce.com" --alias devhub --set-default-dev-hub true
27+
- name: Create Scratch Org
28+
run: sf org create scratch --definition-file config/project-scratch-def.json --alias "$SCRATCH_ALIAS" --set-default --duration-days 1 --wait 10
29+
- name: Push Source
30+
run: sf project deploy start --target-org "$SCRATCH_ALIAS" --ignore-conflicts --wait 30
31+
- name: Assign Permission Set
32+
run: sf org assign permset --name GenAIAgentPermission --target-org "$SCRATCH_ALIAS" || echo "Permset skipped"
33+
- name: Run Apex Tests (JUnit)
34+
run: mkdir -p test-results && sf apex run test --target-org "$SCRATCH_ALIAS" --result-format junit --code-coverage --output-dir test-results --wait 30
35+
- uses: actions/upload-artifact@v4
36+
if: always()
37+
with: { name: apex-junit, path: test-results }
38+
- if: always()
39+
run: sf org delete scratch --target-org "$SCRATCH_ALIAS" --no-prompt

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Agentforce Data‑Aware Agent (SFDX)
2+
3+
**What**: A Salesforce DX template for Agentforce AI agents that auto‑discover org schema and act safely (FLS/sharing aware).
4+
5+
## Quick Start
6+
```bash
7+
sf org login web --alias devhub --set-default-dev-hub
8+
sf org create scratch --definition-file config/project-scratch-def.json --alias agent-data-aware --set-default --duration-days 7 --wait 10
9+
sf project deploy start --ignore-conflicts --wait 30
10+
sf org assign permset --name GenAIAgentPermission
11+
sf apex run --file scripts/apex/run_bootstrap.apex
12+
sf org open
13+
```
14+
15+
## CI Badge
16+
[![PR Validate (Scratch Org)](https://github.com/dentity007/Agentforce-Data-Aware-Agent/actions/workflows/pr-validate.yml/badge.svg)](https://github.com/dentity007/Agentforce-Data-Aware-Agent/actions/workflows/pr-validate.yml)
17+
18+
## Documentation
19+
- [Team Playbook](docs/Team_Playbook.md)
20+
- [Quick Start 2‑Pager](docs/Quick_Start_2Pager.md)
21+
- [Solution Architecture](docs/Solution_Architecture.md)
22+
- Diagrams: `docs/diagrams/`

config/project-scratch-def.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"orgName": "Agentforce Data Aware",
3+
"edition": "Developer"
4+
}
737 KB
Binary file not shown.

docs/Quick_Start_2Pager.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Agentforce Data‑Aware Agent — Quick Start (Exec & PM 2‑Pager)
2+
3+
**Why**: Faster ops, no manual field mapping, governed (FLS, deny‑list), auditable.
4+
**Pilot metric ideas**: +30% triage speed, +15% timely follow‑ups, <1% permission violations.
5+
6+
## Scope (4–6 weeks)
7+
- Use case: Lead qualification & follow‑up
8+
- Surfaces: Lightning / Slack (optional)
9+
- Data: Lead (+ related minimal fields), PII deny‑listed
10+
11+
## RACI (pilot)
12+
Sponsor (A), PM (A), Admin (R), Dev (R), Security (C), Sales Ops (C).
13+
14+
## Environments
15+
Dev Hub + Scratch (CI on PRs) → UAT Sandbox → Production
16+
17+
## Checklist
18+
Week 0: GitHub secrets; deny‑list review.
19+
Week 1: Scratch, deploy, bootstrap, smoke test.
20+
Week 2–3: Tune prompts/actions; iterate.
21+
Week 4: UAT metrics; approve; Prod.
22+
23+
## How it works (plain English)
24+
Planner finds objects/fields/paths from a cached schema graph, then calls safe queries/Flows/Apex under user permissions. Only a small schema slice is sent with prompts; sensitive fields are blocked.
25+
26+
## Governance & risk
27+
FLS enforcement; RestrictedField__mdt; audit stubs; rollback via PRs/tags.

docs/Solution_Architecture.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Agentforce Data‑Aware Agent — Solution Architecture
2+
3+
## Context & Data Flow
4+
User → Agent (Bot) → Planner → (FindObjects/FindFields/FindRelationshipPath) → ExecuteSOQL/RunFlow/Domain Actions → Salesforce Data → Response (+ audit)
5+
6+
## Logical View
7+
- Agent Layer: Bot/BotVersion, Planner, Prompt
8+
- Intelligence: MetadataNavigatorTopic, SchemaGraph__c
9+
- Execution: GenAiFunctions (ExecuteSOQL/RunFlow/QueryDataCloud + domain actions), Apex services, Flows
10+
- Governance: RestrictedField__mdt, GenAiAudit, NightlyJob
11+
12+
## Deployment
13+
Dev Hub + Scratch (PR validation) → UAT → Prod. Steps: deploy, assign permset, bootstrap graph, schedule nightly job.
14+
15+
## Security
16+
Runs as the signed‑in user; FLS.enforce; deny‑list; prompt slicing; audit stubs.
17+
18+
## NFRs
19+
Query P50<2s/P95<5s, ≤200 rows, ≤12 fields, ≤2 joins; prompt slice ≤3KB typical.
20+
21+
## RACI (Build/Operate/Govern)
22+
Dev (R), Admin (R/A), PM (A), Security (A/R for policy), Sales Ops (C).
23+
24+
## Sequences
25+
Happy path (status+task) and FLS‑denial path (sensitive field removed).

docs/Team_Playbook.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Agentforce Data‑Aware Agent — Team Playbook
2+
3+
This playbook explains how to set up, deploy, operate, and extend the Agentforce data‑aware agent template.
4+
5+
## What you get
6+
- Auto‑discovery of org schema (objects/fields/relationships) with FLS/sharing awareness
7+
- SchemaGraph__c cache for fast lookups
8+
- Planner + Plugin + Functions so agents can find/use data without manual mapping
9+
- Guardrails: FLS enforcement, RestrictedField__mdt deny‑list, audit stubs
10+
- Lead Qualification demo (Flow + Apex invocable)
11+
- Unit tests and a GitHub Actions PR validation pipeline
12+
13+
## Prereqs
14+
- Dev Hub with Scratch Orgs enabled, Salesforce CLI, GitHub repo, Connected App for JWT
15+
16+
## Create scratch & push
17+
```bash
18+
sf org login web --alias devhub --set-default-dev-hub
19+
sf org create scratch --definition-file config/project-scratch-def.json --alias agent-data-aware --set-default --duration-days 7 --wait 10
20+
sf project deploy start --ignore-conflicts --wait 30
21+
sf org assign permset --name GenAIAgentPermission
22+
sf apex run --file scripts/apex/run_bootstrap.apex
23+
sf org open
24+
```
25+
26+
## Lead Qualification demo
27+
Ask the bot: “Qualify this lead and follow up: 00Qxxxxxxxxxxxx; set status to Working”. Planner → FindFields → ExecuteSOQL → Flow (status) → Apex (task).
28+
29+
## CI (PRs)
30+
JWT login → create scratch → deploy → run tests (JUnit) → upload results → delete org. Secrets: SF_CONSUMER_KEY, SF_USERNAME, SF_JWT_KEY.
31+
32+
## Operating
33+
- Nightly schema refresh: OrgSchemaNightlyJob.scheduleNightly()
34+
- On‑demand rebuild: OrgSchemaBootstrap.buildSchemaGraph()
35+
- Add sensitive fields to RestrictedField__mdt; re‑run bootstrap
36+
37+
## Extending
38+
- Add new GenAiFunction (Apex/Flow), list in Planner `<actions>`, add tests, open PR.
42 KB
Loading

docs/diagrams/api_contracts.png

73.4 KB
Loading

0 commit comments

Comments
 (0)