Skip to content

Add AgentCore + lakeFS Cloud "Agentic Data PRs" sample - #285

Draft
iddoavn wants to merge 1 commit into
mainfrom
agentcore-data-pr-cleanup
Draft

Add AgentCore + lakeFS Cloud "Agentic Data PRs" sample#285
iddoavn wants to merge 1 commit into
mainfrom
agentcore-data-pr-cleanup

Conversation

@iddoavn

@iddoavn iddoavn commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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.

AgentCore governs what the agent is allowed to do. lakeFS governs what happens to the data it changes.

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 test78 unit tests pass, ruff clean.

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.py leaked 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. Because DeleteAgentRuntime answers AccessDenied (not ResourceNotFound) for an id that doesn't exist, the failure looked like a permissions problem and make cleanup could never delete the Runtime. Now resolved authoritatively from the control plane.
  • cleanup.py never deleted the AgentCore Memory store. The agentcore CLI provisions it, so it never lands in the run's resource manifest. Now matched by run id.
  • cleanup.py raced the async control plane. Parent deletes failed because children were still propagating (a Gateway reported the Target just deleted). Parent deletes now retry.
  • cleanup.py wasn'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.py could record the wrong commit. It discarded the id returned by commit_workspace and re-read the branch head, which can observe a later commit.
  • make setup failed outright. requirements.lock pinned cedarpy==1.2.0, which does not exist on PyPI. The package was never imported anywhere; removed.

Other changes

  • .gitignore matches .env*, so credential sidecars (.envorig, .env.local) can't be committed — *.env alone did not match them.
  • Default reasoning model is Claude Opus 5.
  • README documents teardown scope, re-runnability, and the AccessDenied-means-wrong-id gotcha.
  • 18 lint fixes; 13 new unit tests pinning the teardown regressions.

Review notes

Good places to start:

  • policy/agent-policy.cedar + policy/authz.py — the forbid-merge authorization model
  • gateway/handler.py — the curated capability surface the agent is limited to
  • scripts/cleanup.py — teardown, and the async-control-plane handling
  • README.md — architecture diagram and the "better together" framing

🤖 Generated with Claude Code

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