mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-19 12:11:02 -04:00
[PR #233] Feat/bedrock config path #255
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/233
Author: @salecharohit
Created: 4/4/2026
Status: 🔄 Open
Base:
main← Head:feat/bedrock-config-path📝 Commits (5)
36b7981feat(bedrock): add BEDROCK_CONFIG_PATH support for custom provider config4be1a26docs: document BEDROCK_CONFIG_PATH in READMEaeeb98dfix(docker): hardcode BEDROCK_CONFIG_PATH in-container path in composeb1b606dfix(docker): align BEDROCK_CONFIG_PATH pattern with existing providers2641168feat(bedrock): auto-seed provider from BEDROCK_CONFIG_PATH on startup📊 Changes
11 files changed (+276 additions, -11 deletions)
View changed files
📝
.env.example(+1 -0)📝
README.md(+2 -0)📝
backend/cmd/ctester/main.go(+1 -1)📝
backend/pkg/config/config.go(+1 -0)📝
backend/pkg/graph/schema.resolvers.go(+4 -0)📝
backend/pkg/providers/bedrock/bedrock.go(+11 -2)📝
backend/pkg/providers/bedrock/bedrock_test.go(+5 -5)📝
backend/pkg/providers/pconfig/config.go(+1 -0)📝
backend/pkg/providers/providers.go(+68 -3)📝
docker-compose.yml(+2 -0)➕
glm_flash_bedrock.yml(+180 -0)📄 Description
Description of the Change
Problem
The AWS Bedrock provider in PentAGI only supported a single built-in
config.ymlfor model and pricing definitions, which is embedded at compile time. This made it impossible to use non-standard Bedrock-accessible models (e.g., GLM Flash viazai.glm-4.7-flash) without recompiling the binary or modifying the source config.Solution
Introduce a
BEDROCK_CONFIG_PATHenvironment variable that lets users point to an external YAML file to override the built-in Bedrock provider config. When the variable is unset, the existing embeddedconfig.ymlis used unchanged (fully backward-compatible). When set, the specified file is read at startup instead.Key changes:
backend/pkg/config/config.go— addedBedrockConfig stringfield mapped toBEDROCK_CONFIG_PATHbackend/pkg/providers/bedrock/bedrock.go—DefaultProviderConfig()now accepts*config.Configand branches onBedrockConfigto call eitherconfigFS.ReadFile(embedded) oros.ReadFile(external path)backend/pkg/providers/providers.goandbackend/cmd/ctester/main.go— updated callers to passcfgtoDefaultProviderConfigdocker-compose.yml— propagatesBEDROCK_CONFIG_PATHenv var into the container and mountsPENTAGI_BEDROCK_CONFIG_PATH(defaults to./glm_flash_bedrock.yml) at/opt/pentagi/conf/bedrock.provider.ymlglm_flash_bedrock.yml— new example config for the GLM 4.7 Flash model (zai.glm-4.7-flash) accessible via Bedrock, with per-agent tuned parameters and pricing.env.exampleandREADME.md— documented the new variableCloses #
Type of Change
Areas Affected
Testing and Verification
Test Configuration
Test Steps
.env.exampleto.envand setBEDROCK_CONFIG_PATH=./glm_flash_bedrock.ymlalong with valid Bedrock credentials (BEDROCK_REGION,BEDROCK_ACCESS_KEY_ID,BEDROCK_SECRET_ACCESS_KEY)docker compose up -d(orgo run ./cmd/pentagifrombackend/)zai.glm-4.7-flashis used for agent callsBEDROCK_CONFIG_PATHand restart — confirm the built-in default config is loaded as beforeTest Results
Provider initializes successfully with the custom config; falls back cleanly to the embedded config when
BEDROCK_CONFIG_PATHis unset.Security Considerations
The file path is read at server startup only, using
os.ReadFilewith the path supplied by the operator via environment variable. No user-controlled input influences the path at runtime. No new network endpoints or permissions introduced.Performance Impact
Negligible — config file is read once at startup. No change to request-path code.
Documentation Updates
Deployment Notes
New environment variable (optional, backward-compatible):
BEDROCK_CONFIG_PATHDocker Compose: If using a custom config file, set
PENTAGI_BEDROCK_CONFIG_PATHto the host path of your YAML file. The compose file mounts it to/opt/pentagi/conf/bedrock.provider.ymland setsBEDROCK_CONFIG_PATHaccordingly. A ready-made example for GLM Flash (glm_flash_bedrock.yml) is included in the repo root.No database migrations or breaking changes required.
Checklist
Code Quality
go fmtandgo vet(for Go code)npm run lint(for TypeScript/JavaScript code)Security
Compatibility
Documentation
Additional Notes
The
glm_flash_bedrock.ymlincluded in the repo root serves as both a working config for the GLM 4.7 Flash model and a reference template for users who want to use any other Bedrock-accessible model not covered by the built-in defaults. The YAML structure mirrors the existing embeddedconfig.ymlformat.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.