Skip to content

feat(deliverables): pure-agent-dev reference implementation - #169

Merged
fig-ai-agent[bot] merged 1 commit into
mainfrom
feat/issue-63-pure-agent-dev
Sep 10, 2026
Merged

feat(deliverables): pure-agent-dev reference implementation#169
fig-ai-agent[bot] merged 1 commit into
mainfrom
feat/issue-63-pure-agent-dev

Conversation

@fig-ai-agent

@fig-ai-agent fig-ai-agent Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Implements the Code Guide: pure-agent-dev from #63 — a provider-agnostic agent skeleton on FastAPI, with BytePlus ECS as the first adapter.

42 files, +1401 lines. Placed in deliverables/ per repo convention; the main application tree is untouched.

The rule this exists to enforce

The Agent must never depend on the BytePlus SDK.

That is the whole point of the guide, and a comment cannot hold it. tests/test_architecture.py parses the real import graph and fails if any layer reaches across the interface:

api -> services -> agents -> providers.base -> adapter -> cloud SDK

Four guards, all failing on the real thing rather than a style rule:

  • agents/, services/, schemas/ may not import any concrete adapter
  • agents/ may not mention a cloud SDK name at all
  • only api/deps.py may name a concrete adapter
  • the only provider import allowed above the interface is providers.base

Adding an AWS adapter, then, is one new file plus one line of wiring — nothing above providers/ moves.

Layers

Layer Role
providers/base.py ComputeProvider ABC — the contract every cloud implements
providers/mock.py in-memory provider — CI needs no credentials
providers/byteplus/ real adapter (shape complete, SDK calls TODO(byteplus))
agents/planner.py intent → AgentTask, provider-free by construction
agents/executor.py AgentTask → provider, only through the interface
api/deps.py the single place a provider is selected and injected

Provider choice is configuration, not code: COMPUTE_PROVIDER=mock|byteplus.

Two contracts, checked against each other

The guide left the task shape implicit. It is now written twice on purpose:

  • schemas/agent-task.schema.json — the external contract (JSON Schema draft 2020-12)
  • pure_agent/schemas/task.py — the runtime Pydantic model

tests/test_schema_contract.py asserts they agree — including that the action enum is identical in both. Drift between those two is the failure that silently breaks every consumer, so it is a test, not a review note.

Verification

Check Result
pytest 47 passed
pytest -O 47 passed — proves no assert is doing control-flow work
ruff check . clean
JSON Schema valid draft 2020-12, matches the Pydantic model
App boots GET /health → 200 on the mock provider, zero credentials

The -O run is not ceremony: the first version of executor.py guarded instance_id with a bare assert, which python -O strips — turning the guard into a silent None passed to the provider. It is now a raise.

Scope and honesty

  • The BytePlus adapter's SDK calls are stubs (TODO(byteplus)). Signatures, return types and the interface are final; filling them in touches no other file. It cannot be validated against a real account from here.
  • No live cloud call has been made. Every test runs on MockComputeProvider.
  • This PR contains no .github/workflows/ changes. The bundled deliverables/pure-agent-dev/.github/workflows/ci.yml is a new file path, so it does not trip the App's workflows restriction — but it will not run until it is moved to the repo's own workflows directory by a maintainer.

Closes #63.

Implements the 'Code Guide: pure-agent-dev' from Issue #63 — a provider-agnostic
agent skeleton on FastAPI, with BytePlus ECS as the first adapter.

The whole implementation defends one rule:

    agents/ must never depend on the BytePlus SDK

Enforced by tests/test_architecture.py, which parses the real import graph
rather than relying on a comment:

    api -> services -> agents -> providers.base -> adapter -> cloud SDK

Layers:
  providers/base.py      ComputeProvider ABC — the contract every cloud implements
  providers/mock.py      in-memory provider, so CI needs no credentials
  providers/byteplus/    real adapter (shape complete, SDK calls TODO)
  agents/planner.py      intent -> AgentTask (provider-free by design)
  agents/executor.py     AgentTask -> provider, only via the interface
  api/deps.py            the single place a provider is chosen and injected

Provider selection is configuration, not code: COMPUTE_PROVIDER=mock|byteplus.

Also adds the external contract that was implicit in the guide:
  schemas/agent-task.schema.json   JSON Schema (draft 2020-12)
  pure_agent/schemas/task.py       Pydantic model
tests/test_schema_contract.py checks the two against each other, so they cannot
drift.

Verified:
  pytest                     47 passed
  pytest -O                  47 passed  (no assert used as control flow)
  ruff check .               clean
  JSON Schema                valid draft 2020-12
  app boots on mock provider no credentials required

The deliverable contains .github/workflows/ci.yml, so pushing it needs the
'workflows' permission on the GitHub App.
@fig-ai-agent fig-ai-agent Bot mentioned this pull request Sep 10, 2026
@fig-ai-agent
fig-ai-agent Bot merged commit 590b861 into main Sep 10, 2026
5 of 10 checks passed
@fig-ai-agent
fig-ai-agent Bot deleted the feat/issue-63-pure-agent-dev branch September 10, 2026 07:59
fig-ai-agent Bot added a commit that referenced this pull request Sep 10, 2026
Adds the 2026-09-10 section with the deliverables/pure-agent-dev entry.

Co-authored-by: fig-ai-agent <fig-ai-agent@users.noreply.github.com>
fig-ai-agent Bot added a commit that referenced this pull request Sep 10, 2026
CHANGELOG
- [2026-09-10]: record PR #170, and a Fixed note for Issue #63 closing via
  PR #169 (squash 590b861).
- Replace the stale `fix/sha-pin-all-workflows` note with the measured state:
  as of 2026-09-10 main's workflows still mix full SHAs with mutable tags
  (checkout@v4 x17, upload-artifact@v4 x6, setup-python@v5 x7, and others),
  and the pin fix needs write access to .github/workflows/ which the App lacks.

README
- Refresh the deliverables row: it listed suites that no longer match what is
  in the directory, and omitted pure-agent-dev, onspace-ai, firecrawl-fastapi
  and manus-client.
- State the CI reality under 'Repository health & standards' instead of
  implying all checks are green: jobs fail at 'Set up job' on the org's SHA-pin
  policy, so a PR passing its own tests locally still shows red.

Docs only - no code, no workflow files.

Co-authored-by: fig-ai-agent <fig-ai-agent@users.noreply.github.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.

0 participants