Skip to content

feat: add get_agent_context() for KAI agent integration#10

Draft
ZdenekSrotyr wants to merge 3 commits intomainfrom
devin/1770659394-agent-context-salesforce
Draft

feat: add get_agent_context() for KAI agent integration#10
ZdenekSrotyr wants to merge 3 commits intomainfrom
devin/1770659394-agent-context-salesforce

Conversation

@ZdenekSrotyr
Copy link
Copy Markdown
Collaborator

@ZdenekSrotyr ZdenekSrotyr commented Feb 9, 2026

Summary

Adds get_agent_context() override to the Salesforce component, enabling KAI to execute arbitrary Python code against an authenticated Salesforce client via the new agentCode sync action (defined in the base library).

The method authenticates using the existing get_salesforce_client() flow and exposes the raw simple_salesforce.Salesforce object as sf in the agent code namespace.

Depends on: keboola/python-component#90 (adds agentSchema/agentCode sync actions to ComponentBase)

requirements.txt currently points to the feature branch of the base library — must be updated to a released version before merge.

Updates since last revision

  • push.yml reworked to use branches-ignore: main — replaced the explicit branch whitelist (feature/*, bug/*) with the branches-ignore pattern used by newer components (e.g. Acumatica). All branches now trigger CI except main.
  • Dockerfile installs git — the python:3.13-slim base image lacks git, which is required for pip install to clone the git+https dependency in requirements.txt. This line can be removed once requirements.txt is updated to a released version of keboola.component.

Review & Testing Checklist for Human

  • Do not merge until python-component PR #90 is merged and releasedrequirements.txt pins 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 the git install in Dockerfile at that point if no longer needed.
  • Confirm branches-ignore: main CI pattern is acceptable — this is more permissive than the original feature/* + bug/* whitelist. It matches the pattern used by newer components (Acumatica), but means any branch push (not just feature/ or bug/) will trigger CI. Verify this aligns with team conventions for this repo.
  • get_agent_context() re-authenticates on every call — each agentCode invocation creates a new SalesforceClient and logs in. Verify this is acceptable for the sub-second latency goal, or consider whether the client should be cached on the component instance.
  • Schema generation triggers authentication — the base class _generate_agent_schema() calls get_agent_context() to populate context_variables, meaning an agentSchema call will also authenticate to Salesforce. Confirm this is the desired behavior.
  • End-to-end test plan: Register agentSchema and agentCode as sync actions in Developer Portal for this component. Run agentSchema to verify the generated schema includes Salesforce client methods. Then run agentCode with a snippet like result = sf.query("SELECT Id, Name FROM Account LIMIT 1")["records"] against a real config with credentials.

Notes

Release Notes

Justification, description

Adds get_agent_context() to the Salesforce component, enabling KAI agent integration via agentSchema and agentCode sync actions from the base library. CI workflow updated to branches-ignore pattern 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 includes git for the branch dependency.

Deployment Plan

Merge base library PR #90 first, update requirements.txt to released version, remove git from Dockerfile if no longer needed, then merge.

Rollback Plan

Revert commit and release previous version.

Post-Release Support Plan

N/A


Open with Devin

Co-Authored-By: zdenek.srotyr@keboola.com <zdenek.srotyr@keboola.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration bot and others added 2 commits February 9, 2026 18:08
Co-Authored-By: zdenek.srotyr@keboola.com <zdenek.srotyr@keboola.com>
Co-Authored-By: zdenek.srotyr@keboola.com <zdenek.srotyr@keboola.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment thread requirements.txt
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'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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:

  1. 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.
  2. Build fragility: If the devin/1770659076-agent-schema-agent-code branch is deleted, rebased, or force-pushed (common for development branches), all Docker builds will fail.
  3. 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.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

1 participant