Skip to content

Commit 8bbef8d

Browse files
authored
fix(deploy): improve deploy script and readme (#91)
2 parents 524a248 + d26cb66 commit 8bbef8d

File tree

5 files changed

+106
-65
lines changed

5 files changed

+106
-65
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ wheels/
1717
*.egg-info
1818

1919
# Other folders
20+
.github
2021
docs/
2122
examples/
2223
tests/

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ GCP__MACHINE_TYPE=c3-standard-4
2222
GCP__SERVICE_ACCOUNT=confidential-sa@verifiable-ai-hackathon.iam.gserviceaccount.com
2323
GCP__TEE_IMAGE_REFERENCE=ghcr.io/flare-foundation/flare-ai-kit:main
2424
# For production, use `confidential-space-250301`
25-
GCP__IMAGE=confidential-space-debug-250301
25+
GCP__CONFIDENTIAL_IMAGE=confidential-space-debug-250301
2626
# For production, use `false`
2727
GCP__TEE_CONTAINER_LOG_REDIRECT=true
2828
GCP__CONFIDENTIAL_COMPUTE_TYPE=TDX

CONTRIBUTING.md

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ We welcome contributions from the community to help make this SDK robust, featur
66

77
## How to Contribute
88

9-
- **Pull Requests (PRs)** for bug fixes, features, and documentation updates.
10-
- **Bug Reports** for issues you encounter.
9+
1. Search existing issues/PRs to avoid duplicates.
10+
2. For opening an issue, use labels `bug`, `feature`, `docs`, or `question`.
11+
3. Fork the repo and create a feature branch:
12+
```bash
13+
git checkout -b feature/your-feature-name
14+
```
15+
4. Implement, test, then submit a PR referencing the issue.
1116

1217
## ✨ Write High-Quality Code
1318

@@ -19,12 +24,17 @@ We strive for high-quality, maintainable code. Please adhere to the following pr
1924
- Design clear, minimal, and predictable interfaces for functions and classes.
2025
- Use descriptive names for variables, functions, and classes.
2126
- Keep code focused and avoid unnecessary complexity.
27+
- Use [Google-style](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) docstrings.
2228

23-
2. **Formatting, Linting & Type-Checking:**
29+
2. **Use dependencies sparingly:**
30+
31+
- Every dependency added is a potential security risk.
32+
- If the dependency is required, it should live in under `[project.optional-dependencies]` with a key marking the high level function, e.g. `rag`, `consensus`.
33+
34+
3. **Formatting, Linting & Type-Checking:**
2435

2536
- Use [ruff](https://docs.astral.sh/ruff/) for formatting and linting, both settings are defined in `pyproject.toml`.
26-
- Use [pyright](https://github.com/microsoft/pyright) for type checking, all new code MUST include accurate type hints.
27-
- Avoid using `typing.Any` unless absolutely necessary and clearly justified in comments.
37+
- Use [pyright](https://github.com/microsoft/pyright) for type checking, all new code MUST include accurate type hints. Avoid using `typing.Any` unless absolutely necessary and clearly justified in comments.
2838
- You can also install [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance) into VSCode for an easier experience.
2939
- Ensure your code passes all checks locally without errors:
3040
```bash
@@ -33,37 +43,37 @@ We strive for high-quality, maintainable code. Please adhere to the following pr
3343
uv run pyright
3444
```
3545

36-
3. **Use dependencies sparingly:**
37-
- Every dependency added is a potential security risk.
38-
- If the dependency is required, it should live in under `[project.optional-dependencies]` with a key marking the high level function, e.g. `rag`, `consensus`.
39-
40-
## 🧪 Test Extensively
46+
4. **Test Extensively:**
4147

42-
- New features **must** include appropriate unit and/or integration tests using `pytest`.
43-
- Bug fixes **should** include tests demonstrating the fix.
44-
- **All tests must pass** locally before submitting a pull request. Run tests via:
48+
- New features **must** include appropriate unit and/or integration tests using `pytest`.
49+
- Bug fixes **should** include tests demonstrating the fix.
50+
- **All tests must pass** locally before submitting a pull request. Run tests via:
51+
```bash
52+
uv run pytest tests/unit/your-test.py -v
53+
uv run pytest tests/integration/your-test.py -v
54+
```
4555

46-
```bash
47-
# Run all tests (unit + integration, requires env vars for integration)
48-
uv run pytest
49-
```
56+
5. **Use Conventional Commits:**
5057

51-
## 🚨 CI Checks Must Pass
58+
- All commit messages **must** adhere to the **Conventional Commits** specification. This helps automate changelog generation and provides a clear commit history.
59+
- Read the spec: [https://www.conventionalcommits.org/](https://www.conventionalcommits.org/)
60+
- **Format:** `<type>[optional scope]: <description>`
61+
- **Examples:**
62+
- `feat(rag): add support for Neo4j AuraDB connection`
63+
- `fix(ecosystem): correct decimal calculation in FTSO price feed`
64+
- `docs(readme): update README with installation instructions`
65+
- `test(rag): add unit tests for GraphDbSettingsModel`
66+
- `chore(deps): update ruff version in pyproject.toml`
5267

53-
- We use Continuous Integration (CI) pipelines (e.g., GitHub Actions) to automatically run linters, type checkers, and tests.
54-
- **Pull requests will only be considered for merging if all CI checks pass.** Ensure your code meets all quality gates before submitting.
68+
## 🚨 PR Checklist
5569

56-
## ✅ Use Conventional Commits
70+
Before you mark your PR as ready-to-review:
5771

58-
- All commit messages **MUST** adhere to the **Conventional Commits** specification. This helps automate changelog generation and provides a clear commit history.
59-
- Please read the specification: [https://www.conventionalcommits.org/](https://www.conventionalcommits.org/)
60-
- **Format:** `<type>[optional scope]: <description>`
61-
- **Examples:**
62-
- `feat(rag): add support for Neo4j AuraDB connection`
63-
- `fix(ecosystem): correct decimal calculation in FTSO price feed`
64-
- `docs(readme): update README with installation instructions`
65-
- `test(rag): add unit tests for GraphDbSettingsModel`
66-
- `chore(deps): update ruff version in pyproject.toml`
72+
- [ ] Branch is up-to-date with `main`.
73+
- [ ] All linting, formatting, and type checks pass.
74+
- [ ] Tests cover new code (unit + integration).
75+
- [ ] Commit messages follow Conventional Commits.
76+
- [ ] PR description includes purpose and implementation details.
6777

6878
## 📜 License
6979

README.md

Lines changed: 61 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,64 @@ SDK for building **verifiable AI Agents** on Flare using Confidential Space.
2222
The kit is composed of modular engines for agents, social feeds, onchain data, and consensus.
2323

2424
```mermaid
25-
graph TD
26-
A(Flare AI Kit)
27-
A --> B{Agent Framework - PydanticAI}
28-
A --> C{VectorRAG Engine - PostgreSQL + pgvector}
29-
A --> D{GraphRAG Engine - Neo4j}
30-
A --> E{Secure Enclave - Confidential Space + TDX}
31-
A --> F{Ecosystem Engine}
32-
A --> G{Social Engine}
33-
A --> H{Consensus Engine}
34-
35-
B --> I(Gemini, GPT, Grok +200 models)
36-
37-
C --o DevHub/News/Governance
38-
39-
D --o MainnetTxData
40-
41-
E --> vTPM
42-
vTPM --o RA-TLS
43-
44-
F --o M(Protocols)
45-
M --o FTSO
46-
M --o FDC
47-
M --o FAssets
48-
49-
F --o L(Applications)
50-
L --o OpenOcean
51-
L --o Kinetic
52-
L --o SparkDEX
53-
L --o Cyclo
54-
L --o ...
25+
flowchart TD
26+
A["Flare AI Kit"]
27+
28+
%% Agent Framework subgraph
29+
subgraph AgentFramework["Agent Framework"]
30+
B["Google ADK"]
31+
B --o LLM["Gemini<br>GPT<br>Grok<br>+200 models"]
32+
end
33+
34+
%% VectorRAG Engine subgraph
35+
subgraph VectorRAG["VectorRAG Engine"]
36+
C["Qdrant"]
37+
C --o SOURCE[DevHub<br>Flare News<br>Flare Governance]
38+
end
39+
40+
%% Secure Enclave subgraph
41+
subgraph SecureEnclave["Secure Enclave"]
42+
E["Confidential Space"]
43+
E --> HW[Intel TDX]
44+
HW --o RA[RA-verify<br>RA-TLS]
45+
end
46+
47+
%% Ecosystem Engine subgraph
48+
subgraph EcosystemEngine["Ecosystem Engine"]
49+
F[Ecosystem Engine]
50+
F --> PR[Protocols]
51+
PR --o PROTOS["FTSO<br>FDC<br>FAssets"]
52+
F --> AP[Applications]
53+
AP --o APPS[SparkDEX<br>OpenOcean<br>Kinetic<br>Cyclo]
54+
end
55+
56+
%% Social Engine subgraph
57+
subgraph SocialEngine["Social Engine"]
58+
G["Social"]
59+
G --o SOC["X<br>Telegram<br>Farcaster<br>Slack"]
60+
end
61+
62+
%% Consensus Engine subgraph
63+
subgraph ConsensusEngine["Consensus Engine"]
64+
H["Consensus"]
65+
H --o ALGOS[Majority<br>Tournament<br>Clustering]
66+
end
67+
68+
%% Connections to Flare AI Kit central node
69+
A --> B
70+
A --> C
71+
A --> E
72+
A --> F
73+
A --> G
74+
A --> H
5575
```
5676

5777
## 📦 Getting Started
5878

59-
**Prerequisites** Python >= 3.12 and [uv](https://github.com/astral-sh/uv).
79+
**Prerequisites**
80+
81+
- [uv](https://github.com/astral-sh/uv) with Python >= 3.12
82+
- [Docker](https://www.docker.com).
6083

6184
1. **Clone the repo:**
6285

@@ -94,6 +117,13 @@ uv run pyright
94117
uv run pytest
95118
```
96119

120+
## 🚧 Build with Docker
121+
122+
```bash
123+
docker build -t flare-ai-kit .
124+
docker run -rm --env-file .env flare-ai-kit
125+
```
126+
97127
## ☁️ Deploy to Confidential Space
98128

99129
**Prerequisites:** Authenticated [gcloud CLI](https://cloud.google.com/sdk/docs/install).

gcloud-deploy.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fi
2626
: "${GCP__MACHINE_TYPE:?Please set GCP__MACHINE_TYPE}"
2727
: "${GCP__TEE_IMAGE_REFERENCE:?Please set GCP__TEE_IMAGE_REFERENCE}"
2828
: "${GCP__SERVICE_ACCOUNT:?Please set GCP__SERVICE_ACCOUNT}"
29-
: "${GCP__IMAGE:?Please set GCP__IMAGE}"
29+
: "${GCP__CONFIDENTIAL_IMAGE:?Please set GCP__CONFIDENTIAL_IMAGE}"
3030
: "${GCP__CONFIDENTIAL_COMPUTE_TYPE:?Please set GCP__CONFIDENTIAL_COMPUTE_TYPE}"
3131
: "${GCP__SCOPES:?Please set GCP__SCOPES}"
3232
: "${GCP__TAGS:?Please set GCP__TAGS}"
@@ -36,7 +36,7 @@ echo "--> Creating instance '$GCP__INSTANCE_NAME' in project '$GCP__PROJECT' wit
3636
echo " - Zone: $GCP__ZONE"
3737
echo " - Machine Type: $GCP__MACHINE_TYPE"
3838
echo " - Service Account: $GCP__SERVICE_ACCOUNT"
39-
echo " - Image: $GCP__IMAGE"
39+
echo " - Image: $GCP__CONFIDENTIAL_IMAGE"
4040
echo " - TEE Image Reference: $GCP__TEE_IMAGE_REFERENCE"
4141
echo " - Confidential Compute Type: $GCP__CONFIDENTIAL_COMPUTE_TYPE"
4242
echo " - Scopes: $GCP__SCOPES"
@@ -77,7 +77,7 @@ COMMAND=(
7777
--service-account="$GCP__SERVICE_ACCOUNT"
7878
--scopes="$GCP__SCOPES"
7979
--tags="$GCP__TAGS"
80-
--create-disk=auto-delete=yes,boot=yes,device-name="$GCP__INSTANCE_NAME",image=projects/confidential-space-images/global/images/"$GCP__IMAGE",mode=rw,size=11,type=pd-balanced
80+
--create-disk=auto-delete=yes,boot=yes,device-name="$GCP__INSTANCE_NAME",image=projects/confidential-space-images/global/images/"$GCP__CONFIDENTIAL_IMAGE",mode=rw,size=11,type=pd-balanced
8181
--shielded-secure-boot
8282
--shielded-vtpm
8383
--shielded-integrity-monitoring

0 commit comments

Comments
 (0)