Skip to content

chore: migrate canonical SDK to Fern-generated 5.0.0 (seed)#59

Merged
abhishekmishragithub merged 17 commits into
mainfrom
chore/seed-fern-sdk-5.0.0
Jun 19, 2026
Merged

chore: migrate canonical SDK to Fern-generated 5.0.0 (seed)#59
abhishekmishragithub merged 17 commits into
mainfrom
chore/seed-fern-sdk-5.0.0

Conversation

@abhishekmishragithub

Copy link
Copy Markdown
Collaborator

What

Seeds this canonical repo with the Fern-generated SDK (5.0.0) — regenerated from smallest-ai-documentation main (post-#246) plus our hand-written fixes — replacing the stale 4.3.0 openapi-generator tree. This makes smallest-python-sdk the single source for the Atoms/Waves Python SDK.

Diff is large by design: removes the legacy flat smallestai/ package, adds the Fern src/smallestai/ layout.

What's in it

Generated (from spec / #246): verb-noun names (create_agent, get_agent, list_agents, update_agent, start_outbound_call, list_agent_templates), calls.get/list/search, conversations.* (cancel/retry/recording), update_workflow_configuration deprecated, requests dependency.

Hand-written (.fernignore-preserved):

Plus MIGRATION.md + CHANGELOG (5.0.0) and the Velocity verification harness under tests/velocity/.

Velocity verification (assembled SDK, against the dev stack)

user ✓ · agents.create_agent + get_agent (firstMessage round-trips) ✓ · list_agents ✓ · calls.get/list present ✓ · CallAnalytics + OpenAIClient.electron

⚠️ Draft — blockers before "ready"

  1. Auth param tokenapi_key: the regen from main produces SmallestAI(token=...) (plain bearer scheme); shipped 4.4.7 used api_key. Escalated to docs to restore api_key (env SMALLEST_API_KEY already works). Will re-regen + update once that lands so the only breaking changes are the intentional renames.
  2. .github/workflows (Fern CI/release) excluded — push token lacks workflow scope. Add with proper scope, or let Fern's push add them at the repo-target migration (Workstream A).
  3. Final review.

Do not merge yet. After (1) lands I'll re-regen, refresh this branch, and mark ready.

…tten fixes)

Replaces the stale 4.3.0 openapi-generator tree with the Fern-generated SDK
(regenerated from smallest-ai-documentation main, post-#246) plus the
hand-written fixes, making this repo the single source for the SDK.

Generated (from spec): verb-noun method names (create_agent, get_agent,
list_agents, ...), calls.get/list/search, conversations.* cancel/retry/recording,
update_workflow_configuration deprecated, requests declared dependency.

Hand-written (.fernignore-preserved):
- OpenAIClient raises on missing key + .electron() factory (#1/#12)
- Call -> CallAnalytics with deprecating alias (#15)
- requests runtime dep so helpers import cleanly (#17)
- CLI: init --agent-id + TTY guard, chat --url, env-aware auth login

Includes MIGRATION.md + CHANGELOG (5.0.0). Verified against the Velocity dev stack.
NOTE: .github/workflows excluded (push token lacks `workflow` scope) — release CI
to be added separately or via Fern's push at the repo-target migration.
… workflows

Re-regenerated from smallest-ai-documentation main after #253 named the
bearer credential `api_key` (was `token`). SmallestAI(api_key=...) restored,
defaulting from SMALLEST_API_KEY env — matches the 4.4.7 surface, so the only
breaking changes are the intentional #246 method renames.

Also adds .github/workflows (ci.yml, release.yml) now that the push token has
`workflow` scope.

Verified against the Velocity dev stack with api_key: user, agents.create_agent
+ get_agent (firstMessage round-trips), list_agents, calls.get/list, helpers
import, electron factory.
@abhishekmishragithub abhishekmishragithub marked this pull request as ready for review June 19, 2026 06:21
…s, current-spec wire tests, dedup agent_templates id

Root cause: the seed was assembled from a local regen run with a *stripped*
generator config (missing additional_init_exports, enable_wire_tests). That
produced a top-level __init__ without AtomsClient/WavesClient and left stale
4.4.7 wire tests against current-spec code. Re-derived the faithful output via
'fern generate --group python-sdk-local' (full real config) and reconciled:

- src/smallestai/__init__.py: export {Async,}{Atoms,Waves}Client (additional_init_exports)
- tests/wire/, conftest.py, wiremock/: swap stale 4.4.7 tests for current-spec ones
  (logs removed; conversations + promptScoring added)
- webhooks/prompt_scoring/waves __init__: re-export wire-test types that generator
  5.12.12 strips under exclude_types_from_init_exports (regression vs 4.4.7) [ESCALATE]
- agent_templates list item: drop duplicate 'id' (kept canonical _id-aliased) [SPEC FIX ESCALATE]
- helpers/campaign.py, tests/velocity/smoke.py: mypy fixes; smoke.py to current method names

Verified: mypy==1.13.0 (CI pin) green on 699 files; all imports resolve.
Wire-test runtime is Docker-gated (CI/WireMock).
…Config) in waves/__init__

The current-spec waves/__init__ I reconciled in had the right module set
(adds tts + speech_to_speech vs 4.4.7) but dropped the .fernignore-protected
backward-compat shim re-exports. tests/custom/test_waves_shim_import.py guards
exactly this regression (3 failures). Re-added WavesStreamingTTS + TTSConfig
(source: stream_tts.py) and PronunciationItem to the lazy-import map, preserving
the current module set. Verified: 3 shim test bodies pass, mypy==1.13.0 green.
…E from regen

Audit gap: tests/custom was protected but the live velocity harness, examples,
and migration/release docs were not — a future regen could clobber them. No effect
on shipped code; closes a regen-safety hole found during the pre-merge audit.
…re distinct, not dup

Pre-merge deep review against live data: the listAgentTemplates item returns a Mongo
ObjectId on _id AND a human-readable slug on id. My earlier dedup dropped the slug and
made .id return the ObjectId — silent data loss + behavior change. Now expose both:
.id = slug (matches the field description + prior runtime), .object_id = ObjectId.
Verified live: both populate. mypy==1.13.0 green. Escalation [2] corrected accordingly.
…ssion tests

Pre-merge deep review (2 independent audits) found as_page silently returned a
1-item wrapped envelope instead of rows for:
  - conversations.list_retry_attempts (container key 'retries' unhandled)
  - phone_numbers.list_all_phone_numbers_platform_sip (two arrays telephony_products
    + custom_products, no single key)
Fix: add 'retries' key; concatenate telephony+custom; also read total_campaign_count
for campaigns pagination metadata. Added tests/custom/test_as_page_envelope.py (7 tests).
Verified synthetic + live (empty rig now returns 0 items, not a bogus envelope).
mypy==1.13.0 green (700 files). Method-name cleanup for 6 more namespaces logged for 5.1.0.
Prod run surfaced two example defects: it printed '...activated' even when the
new version's server-side security check hadn't activated it yet, and it left an
orphaned knowledge base. Now the final message is conditional on actual activation,
and cleanup deletes the demo KB it created.
…ts array)

Found via a live outbound call + SSE subscribe: the runtime sends 'metrics' events
with metrics as a LIST of {processor,model,value}, but the model typed it as a dict,
so the SDK dropped every metrics event (122 in one 40s call) with a ValidationError.
Typed as Union[List[Dict],Dict] so events stream through. Spec fix escalated.
Verified: list + dict both parse; mypy==1.13.0 green. (Transcription/STT events were
unaffected — post-call transcript via calls.get().transcript confirmed user speech captured.)
…stematically

Walks live response models for fields the API returns but the SDK doesn't type
(pydantic model_extra). Catches the bug class wire tests miss (they use spec example
fixtures): agent_templates _id/id, live metrics-as-list, and the agent model's ~30
untyped config fields. Intended as a pre-release gate. See SDK_ESCALATIONS.log [6].
@abhishekmishragithub abhishekmishragithub merged commit fb94f65 into main Jun 19, 2026
3 checks passed
@fern-api fern-api Bot mentioned this pull request Jun 21, 2026
fern-api Bot added a commit that referenced this pull request Jun 21, 2026
Patches applied (1):
  - patch-0c9e9b4e: refactor: rename agent-swarm -> agent-crew across SDK + CLI (4.4.2)

Patches with unresolved conflicts (1):
  - patch-fb94f65f: chore: migrate canonical SDK to Fern-generated 5.0.0 (seed) (#59)
    Run `fern-replay resolve` to apply these customizations.
fern-api Bot added a commit that referenced this pull request Jun 21, 2026
Patches applied (1):
  - patch-0c9e9b4e: refactor: rename agent-swarm -> agent-crew across SDK + CLI (4.4.2)

Patches with unresolved conflicts (1):
  - patch-fb94f65f: chore: migrate canonical SDK to Fern-generated 5.0.0 (seed) (#59)
    Run `fern-replay resolve` to apply these customizations.
abhishekmishragithub added a commit that referenced this pull request Jun 22, 2026
* [fern-generated] Update SDK

Generated by Fern
CLI Version: unknown
Generators:
  - fernapi/fern-python-sdk: 5.12.12

* [fern-replay] Applied customizations

Patches applied (1):
  - patch-0c9e9b4e: refactor: rename agent-swarm -> agent-crew across SDK + CLI (4.4.2)

Patches with unresolved conflicts (1):
  - patch-fb94f65f: chore: migrate canonical SDK to Fern-generated 5.0.0 (seed) (#59)
    Run `fern-replay resolve` to apply these customizations.

* chore(5.1.0): finalize regen — version, changelog, __init__ exports, caller renames

On top of the Fern 5.1.0 regen (generator 5.12.12, #262/#263/#260 spec):
- bump version 5.0.0 -> 5.1.0 + changelog entry (new endpoints, renames, agent fields)
- re-export webhooks/prompt_scoring types from package root (.fernignore'd — 5.12.12
  strips sub-package type exports; wire tests import from root)
- update example + velocity callers to 5.1.0 method names (kb/phone list/create/delete,
  drafts create_draft/publish_draft)
- protect .env in .gitignore + make .gitignore .fernignore-preserved (regen was resetting it)

Verified: mypy==1.13.0 green (833 files), make verify PASSED (96/96 wire tests,
field-drop 24->2), all type exports + #260 endpoints + renamed methods resolve.

* fix(5.1.0): export WidgetConfig from atoms root + harness wire-import gate

CI caught: tests/wire/test_atoms_agents.py imports WidgetConfig (new #260 widget-config
type) from smallestai.atoms, but exclude_types_from_init_exports stripped it from
atoms/__init__. mypy missed it — the lazy __getattr__ is typed -> Any, so a missing lazy
export type-checks fine and only fails at import/collection.

- re-export WidgetConfig from atoms/__init__ (.fernignore-preserved)
- verify.py: new 'wire-test imports' gate that imports every 'from smallestai import X' in
  the wire suite — catches this whole class locally (mypy can't). make verify now green.
- escalate: the permanent fix is exclude_types_from_init_exports=false (4th instance).

---------

Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
Co-authored-by: Abhishek Mishra <geekabhi@outlook.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.

2 participants