Add AgentCore + lakeFS Cloud "Agentic Data PRs" sample - #285
Draft
iddoavn wants to merge 1 commit into
Draft
Conversation
An autonomous curation agent on Amazon Bedrock AgentCore Runtime curates a messy synthetic support corpus through ~11 curated lakeFS operations exposed as MCP tools by an AgentCore Gateway. It writes only to its own zero-copy workspace branch, a Cedar policy on AgentCore Policy forbids it from merging, and it opens a real lakeFS Cloud Pull Request and stops. A human approves and merges separately. Fixes found by tearing down a real deployment: - deploy: record the runtime's real agentRuntimeId, resolved from the control plane, instead of the resource prefix plus an ARN scraped out of AgentCore CLI stdout. The scrape truncated mid-identifier, and DeleteAgentRuntime answers AccessDenied (not ResourceNotFound) for an id that does not exist, so `make cleanup` could never delete the Runtime and leaked it silently. - cleanup: delete the AgentCore Memory store. The agentcore CLI provisions it, so it never lands in the run's resource manifest and was never torn down. - cleanup: retry parent deletes while children finish tearing down. The control plane is asynchronous, so a Gateway still reported the Target just deleted. - cleanup: treat an already-deleted resource as success. A second run printed nine alarming failures and exited non-zero on a fully clean account. - curation_runner: use the commit id returned by commit_workspace instead of re-reading the branch head, which could observe a later commit. - requirements.lock: drop cedarpy==1.2.0. No such version exists on PyPI, so `make setup` failed outright; the package was never imported anywhere. - gitignore: match .env* so credential sidecars cannot be committed. - default to Claude Opus 5 for the agent's reasoning model. Follow-up for the maintainer: rotate the lakeFS access key that was previously present in a local .envorig file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
A standalone sample pairing Amazon Bedrock AgentCore with lakeFS Cloud: an autonomous curation agent is given a messy synthetic support corpus and asked to produce a clean, approved, US-only corpus.
The agent runs on AgentCore Runtime (Strands) and can only act through ~11 curated lakeFS operations exposed as MCP tools by an AgentCore Gateway (Lambda target, AWS_IAM inbound). It writes only to its own zero-copy lakeFS workspace branch, and a Cedar policy on AgentCore Policy explicitly forbids it from merging. It opens a real lakeFS Cloud Pull Request and stops; a human reviews the data diff plus deterministic validation results and merges separately.
Connects to an existing lakeFS Cloud installation — it does not deploy or configure lakeFS.
Status
Draft — sharing for review, not ready to merge.
Verified end-to-end against real lakeFS Cloud and real AWS AgentCore (Gateway + Policy + Lambda + Runtime + Memory): the agent curated the corpus through the Gateway tools, deterministic validation passed, a real lakeFS PR was created, the Cedar policy denied the merge to the agent identity, the human-approval preflight passed, and the source branch stayed unchanged. Teardown was also exercised (see below).
make test→ 78 unit tests pass,ruffclean.Defects found by the end-to-end run and fixed here
Tearing down a real deployment surfaced several real bugs, all fixed in this branch:
deploy.pyleaked the AgentCore Runtime. The runtime ARN was scraped out of AgentCore CLI stdout by splitting on whitespace, which truncated it mid-identifier, and the resource prefix was recorded as the runtime id. BecauseDeleteAgentRuntimeanswersAccessDenied(notResourceNotFound) for an id that doesn't exist, the failure looked like a permissions problem andmake cleanupcould never delete the Runtime. Now resolved authoritatively from the control plane.cleanup.pynever deleted the AgentCore Memory store. TheagentcoreCLI provisions it, so it never lands in the run's resource manifest. Now matched by run id.cleanup.pyraced the async control plane. Parent deletes failed because children were still propagating (a Gateway reported the Target just deleted). Parent deletes now retry.cleanup.pywasn't re-runnable. A second run printed nine alarming failures and exited non-zero against a fully clean account. Already-deleted now counts as success.curation_runner.pycould record the wrong commit. It discarded the id returned bycommit_workspaceand re-read the branch head, which can observe a later commit.make setupfailed outright.requirements.lockpinnedcedarpy==1.2.0, which does not exist on PyPI. The package was never imported anywhere; removed.Other changes
.gitignorematches.env*, so credential sidecars (.envorig,.env.local) can't be committed —*.envalone did not match them.AccessDenied-means-wrong-id gotcha.Review notes
Good places to start:
policy/agent-policy.cedar+policy/authz.py— the forbid-merge authorization modelgateway/handler.py— the curated capability surface the agent is limited toscripts/cleanup.py— teardown, and the async-control-plane handlingREADME.md— architecture diagram and the "better together" framing🤖 Generated with Claude Code