feat: add get_agent_context() for KAI agent integration#10
feat: add get_agent_context() for KAI agent integration#10ZdenekSrotyr wants to merge 3 commits intomainfrom
Conversation
Co-Authored-By: zdenek.srotyr@keboola.com <zdenek.srotyr@keboola.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: zdenek.srotyr@keboola.com <zdenek.srotyr@keboola.com>
Co-Authored-By: zdenek.srotyr@keboola.com <zdenek.srotyr@keboola.com>
| backoff==2.2.1; python_version >= '3.7' and python_version < '4.0' | ||
| freezegun==1.5.1; python_version >= '3.7' | ||
| keboola.component==1.6.10; python_version >= '3.7' | ||
| keboola.component @ git+https://github.com/keboola/python-component.git@devin/1770659076-agent-schema-agent-code; python_version >= '3.7' |
There was a problem hiding this comment.
🔴 Production dependency pinned to an unstable development git branch
The keboola.component dependency was changed from a stable pinned version (1.6.10) to a development git branch (devin/1770659076-agent-schema-agent-code). This branch name indicates it's a developer-specific feature branch, not a stable release.
Impact and Root Cause
The requirement keboola.component @ git+https://github.com/keboola/python-component.git@devin/1770659076-agent-schema-agent-code has several problems:
- Non-reproducible builds: Git branches are mutable references — the same branch name can point to different commits at different times. Two builds from the same source could produce different Docker images.
- Build fragility: If the
devin/1770659076-agent-schema-agent-codebranch is deleted, rebased, or force-pushed (common for development branches), all Docker builds will fail. - No version guarantee: There's no guarantee the code on this branch is stable, tested, or compatible. Development branches may contain work-in-progress code.
This dependency is used in the production Dockerfile and will be baked into the deployed Docker image. The get_agent_context method added in src/component.py:693-696 presumably depends on new functionality from this branch, but the dependency should be pinned to a stable release or at minimum a specific commit hash.
Expected: Dependency should reference a stable release version (e.g., keboola.component==X.Y.Z) or at minimum a pinned commit hash (e.g., git+https://...@<commit-sha>).
Prompt for agents
In requirements.txt line 3, the keboola.component dependency is pinned to a mutable development branch (devin/1770659076-agent-schema-agent-code). This should be changed to either: (1) a stable release version like keboola.component==X.Y.Z once the agent support is released, or (2) at minimum a pinned commit hash like keboola.component @ git+https://github.com/keboola/python-component.git@<full-commit-sha> to ensure reproducible builds. Using a branch reference means builds are non-reproducible and will break if the branch is deleted.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Adds
get_agent_context()override to the Salesforce component, enabling KAI to execute arbitrary Python code against an authenticated Salesforce client via the newagentCodesync action (defined in the base library).The method authenticates using the existing
get_salesforce_client()flow and exposes the rawsimple_salesforce.Salesforceobject assfin the agent code namespace.Depends on: keboola/python-component#90 (adds
agentSchema/agentCodesync actions toComponentBase)requirements.txtcurrently points to the feature branch of the base library — must be updated to a released version before merge.Updates since last revision
push.ymlreworked to usebranches-ignore: main— replaced the explicit branch whitelist (feature/*,bug/*) with thebranches-ignorepattern used by newer components (e.g. Acumatica). All branches now trigger CI exceptmain.Dockerfileinstallsgit— thepython:3.13-slimbase image lacksgit, which is required forpip installto clone the git+https dependency inrequirements.txt. This line can be removed oncerequirements.txtis updated to a released version ofkeboola.component.Review & Testing Checklist for Human
python-componentPR #90 is merged and released —requirements.txtpins to a git branch (devin/1770659076-agent-schema-agent-code) which will break if the branch is deleted. Update to a proper version pin before merging. Also revert thegitinstall inDockerfileat that point if no longer needed.branches-ignore: mainCI pattern is acceptable — this is more permissive than the originalfeature/*+bug/*whitelist. It matches the pattern used by newer components (Acumatica), but means any branch push (not justfeature/orbug/) will trigger CI. Verify this aligns with team conventions for this repo.get_agent_context()re-authenticates on every call — eachagentCodeinvocation creates a newSalesforceClientand logs in. Verify this is acceptable for the sub-second latency goal, or consider whether the client should be cached on the component instance._generate_agent_schema()callsget_agent_context()to populatecontext_variables, meaning anagentSchemacall will also authenticate to Salesforce. Confirm this is the desired behavior.agentSchemaandagentCodeas sync actions in Developer Portal for this component. RunagentSchemato verify the generated schema includes Salesforce client methods. Then runagentCodewith a snippet likeresult = sf.query("SELECT Id, Name FROM Account LIMIT 1")["records"]against a real config with credentials.Notes
get_agent_context()in this PR — the method is a 4-line delegation to existing tested code.Release Notes
Justification, description
Adds
get_agent_context()to the Salesforce component, enabling KAI agent integration viaagentSchemaandagentCodesync actions from the base library. CI workflow updated tobranches-ignorepattern matching newer component conventions.Plans for Customer Communication
N/A
Impact Analysis
Low — adds a new method to the component class with no effect on existing behavior. CI workflow change broadens branch triggers from whitelist to
branches-ignore: main. Dockerfile temporarily includesgitfor the branch dependency.Deployment Plan
Merge base library PR #90 first, update
requirements.txtto released version, removegitfrom Dockerfile if no longer needed, then merge.Rollback Plan
Revert commit and release previous version.
Post-Release Support Plan
N/A