Skip to content

Feat/bedrock config path#233

Open
salecharohit wants to merge 5 commits intovxcontrol:mainfrom
salecharohit:feat/bedrock-config-path
Open

Feat/bedrock config path#233
salecharohit wants to merge 5 commits intovxcontrol:mainfrom
salecharohit:feat/bedrock-config-path

Conversation

@salecharohit
Copy link
Copy Markdown

Description of the Change

Problem

The AWS Bedrock provider in PentAGI only supported a single built-in config.yml for 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 via zai.glm-4.7-flash) without recompiling the binary or modifying the source config.

Solution

Introduce a BEDROCK_CONFIG_PATH environment 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 embedded config.yml is used unchanged (fully backward-compatible). When set, the specified file is read at startup instead.

Key changes:

  • backend/pkg/config/config.go — added BedrockConfig string field mapped to BEDROCK_CONFIG_PATH
  • backend/pkg/providers/bedrock/bedrock.goDefaultProviderConfig() now accepts *config.Config and branches on BedrockConfig to call either configFS.ReadFile (embedded) or os.ReadFile (external path)
  • backend/pkg/providers/providers.go and backend/cmd/ctester/main.go — updated callers to pass cfg to DefaultProviderConfig
  • docker-compose.yml — propagates BEDROCK_CONFIG_PATH env var into the container and mounts PENTAGI_BEDROCK_CONFIG_PATH (defaults to ./glm_flash_bedrock.yml) at /opt/pentagi/conf/bedrock.provider.yml
  • glm_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.example and README.md — documented the new variable

Closes #

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Configuration change
  • 🧪 Test update
  • 🛡️ Security update

Areas Affected

  • Core Services (Frontend UI/Backend API)
  • AI Agents (Researcher/Developer/Executor)
  • Security Tools Integration
  • Memory System (Vector Store/Knowledge Base)
  • Monitoring Stack (Grafana/OpenTelemetry)
  • Analytics Platform (Langfuse)
  • External Integrations (LLM/Search APIs)
  • Documentation
  • Infrastructure/DevOps

Testing and Verification

Test Configuration

PentAGI Version: latest (main + this branch)
Docker Version: 27.x
Host OS: macOS / Linux
LLM Provider: AWS Bedrock (GLM 4.7 Flash via zai.glm-4.7-flash)
Enabled Features: none

Test Steps

  1. Copy .env.example to .env and set BEDROCK_CONFIG_PATH=./glm_flash_bedrock.yml along with valid Bedrock credentials (BEDROCK_REGION, BEDROCK_ACCESS_KEY_ID, BEDROCK_SECRET_ACCESS_KEY)
  2. Run docker compose up -d (or go run ./cmd/pentagi from backend/)
  3. Confirm the Bedrock provider initializes without error and that zai.glm-4.7-flash is used for agent calls
  4. Remove BEDROCK_CONFIG_PATH and restart — confirm the built-in default config is loaded as before

Test Results

Provider initializes successfully with the custom config; falls back cleanly to the embedded config when BEDROCK_CONFIG_PATH is unset.

Security Considerations

The file path is read at server startup only, using os.ReadFile with 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

  • README.md updates
  • API documentation updates
  • Configuration documentation updates
  • GraphQL schema updates
  • Other:

Deployment Notes

New environment variable (optional, backward-compatible):

Variable Default Description
BEDROCK_CONFIG_PATH (empty — uses built-in config) Absolute or relative path to a YAML file that overrides the embedded Bedrock provider model/pricing config

Docker Compose: If using a custom config file, set PENTAGI_BEDROCK_CONFIG_PATH to the host path of your YAML file. The compose file mounts it to /opt/pentagi/conf/bedrock.provider.yml and sets BEDROCK_CONFIG_PATH accordingly. 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

  • My code follows the project's coding standards
  • I have added/updated necessary documentation
  • I have added tests to cover my changes
  • All new and existing tests pass
  • I have run go fmt and go vet (for Go code)
  • I have run npm run lint (for TypeScript/JavaScript code)

Security

  • I have considered security implications
  • Changes maintain or improve the security model
  • Sensitive information has been properly handled

Compatibility

  • Changes are backward compatible
  • Breaking changes are clearly marked and documented
  • Dependencies are properly updated

Documentation

  • Documentation is clear and complete
  • Comments are added for non-obvious code
  • API changes are documented

Additional Notes

The glm_flash_bedrock.yml included 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 embedded config.yml format.

salecharohit and others added 2 commits April 4, 2026 22:42
…nfig

Mirrors the existing LLM_SERVER_CONFIG_PATH / OLLAMA_SERVER_CONFIG_PATH
pattern so operators can supply a YAML file that overrides the built-in
embedded bedrock/config.yml without modifying source code.

Changes:
- config.go: add BedrockConfig field mapped to BEDROCK_CONFIG_PATH env var
- bedrock/bedrock.go: DefaultProviderConfig now accepts *config.Config;
  reads from BedrockConfig path when set, falls back to embedded config.yml
- providers.go, cmd/ctester/main.go: pass cfg to updated DefaultProviderConfig
- docker-compose.yml: wire BEDROCK_CONFIG_PATH env var and mount
  ${PENTAGI_BEDROCK_CONFIG_PATH:-./glm_flash_bedrock.yml} into the container
- .env.example: document the new BEDROCK_CONFIG_PATH variable
- glm_flash_bedrock.yml: example config exporting the glm_flash DB provider
  (zai.glm-4.7-flash via Bedrock) as a portable YAML file

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add BEDROCK_CONFIG_PATH to the AWS Bedrock Provider Configuration table
and the full env reference section to document the custom YAML config
path feature added in the feature branch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
salecharohit and others added 3 commits April 6, 2026 12:41
Instead of passing BEDROCK_CONFIG_PATH through from the host env (which
required users to know the internal container path), set it directly to
the fixed mount point /opt/pentagi/conf/bedrock.provider.yml in compose.
Users now only need PENTAGI_BEDROCK_CONFIG_PATH pointing to their host
file — consistent with how PENTAGI_LLM_SERVER_CONFIG_PATH and
PENTAGI_OLLAMA_SERVER_CONFIG_PATH work.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Follow the same two-variable convention used for LLM_SERVER_CONFIG_PATH
and OLLAMA_SERVER_CONFIG_PATH:
- PENTAGI_BEDROCK_CONFIG_PATH: host-side path to the YAML file, mounted
  into the container at /opt/pentagi/conf/bedrock.provider.yml
- BEDROCK_CONFIG_PATH: in-container path passed to the app, set to
  /opt/pentagi/conf/bedrock.provider.yml when using the above

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add Name field to ProviderConfig; YAML name: key sets the provider
  name shown in the UI (e.g. glm_flash)
- Add SeedDefaultProviders to ProviderController: upserts the Bedrock
  provider into the DB for all existing users at startup and lazily for
  new users on their first Settings page visit
- Editing the YAML and restarting PentAGI automatically propagates new
  values with no UI interaction required
- Simplify to a single BEDROCK_CONFIG_PATH variable: compose uses it as
  the host-side volume mount path and translates it to the fixed
  container path via :+ substitution, eliminating PENTAGI_BEDROCK_CONFIG_PATH
- Fix bedrock_test.go: pass &config.Config{} to DefaultProviderConfig
  after its signature was updated to accept a config argument

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@salecharohit
Copy link
Copy Markdown
Author

salecharohit commented Apr 6, 2026

So I tested this change with a fresh install of pentagi , loading all the configuration in the yaml file and got it pre-configured

image image

It was a pain to actually go into each setting and change it on the UI, now just modify the value in yaml file, and restart the pentagi docker container. The new value is reflected.

https://github.com/salecharohit/glm-pentagi-via-bedrock created this for testing out the functionality

The documentation also states advanced configuration but not showing how to load this config.

@asdek
Copy link
Copy Markdown
Contributor

asdek commented Apr 8, 2026

@salecharohit thank you for the PR, I'll check it this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants