Skip to content

{agent, gateway, runtime}: restore versioned agent factories and budget controls - #161

Merged
XnLemon merged 11 commits into
mainfrom
codex/156-157-agent-factory-budget-coverage
Sep 7, 2026
Merged

XnLemon merged 11 commits into
mainfrom
codex/156-157-agent-factory-budget-coverage

Conversation

@XnLemon

@XnLemon XnLemon commented Sep 7, 2026

Copy link
Copy Markdown
Owner

What changed

  • Restore the versioned AgentFactoryRegistry and schema-v1 chain Agent kind while retaining the existing llm path.
  • Persist and validate ordered Chain steps through Agent revision snapshots and PostgreSQL/MySQL codec and migration surfaces.
  • Add tenant budget reservation, settlement, release, idempotency, and concurrency-safe PostgreSQL/InMemory ledgers.
  • Connect model usage callbacks to Gateway budget settlement and audit cost/provider/model fields.
  • Expose model pricing options and map budget failures to safe HTTP/audit errors.
  • Cover budget arithmetic, lifecycle, in-memory contention, and PostgreSQL storage paths.

Context

This reintroduces the functionality from reverted PR #158 on top of current main, with direct-main alignment fixes and expanded budget coverage.

Compatibility

  • Existing llm revisions remain compatible; unknown Agent kinds or schema versions fail explicitly.
  • chain runs 2-32 tenant-authored steps sequentially and inherits the parent model, tools, generation settings, and runtime policy.
  • PostgreSQL budget storage is selected by the normal PostgreSQL bootstrap; single-process/no-database composition uses the in-memory store.
  • Root migration history adds feature-owned Agent-kind and budget-ledger changes; MySQL Agent schema support is included, while a MySQL budget ledger remains follow-up work.

Testing

  • go test ./...

Fixes #156
Fixes #157

@XnLemon
XnLemon deployed to telegram-e2e September 7, 2026 01:36 — with GitHub Actions Active
@XnLemon
XnLemon deployed to telegram-e2e September 7, 2026 01:38 — with GitHub Actions Active
@XnLemon
XnLemon deployed to telegram-e2e September 7, 2026 01:40 — with GitHub Actions Active
@XnLemon
XnLemon deployed to telegram-e2e September 7, 2026 01:46 — with GitHub Actions Active
@XnLemon
XnLemon deployed to telegram-e2e September 7, 2026 02:39 — with GitHub Actions Active
@XnLemon
XnLemon deployed to telegram-e2e September 7, 2026 03:00 — with GitHub Actions Active
@XnLemon
XnLemon deployed to telegram-e2e September 7, 2026 03:32 — with GitHub Actions Active
@XnLemon
XnLemon merged commit 6a91dc3 into main Sep 7, 2026
12 checks passed

This branch was successfully deployed

1 active deployment
telegram-e2e — ffa22aaa Deployed Sep 7, 2026 by XnLemon via Telegram live long-polling E2E #754
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.

P1: 预算与成本控制闭环 P1: Agent Factory 支持首个非 LLM Agent 类型

2 participants