Update Python Server SDK tech docs - #667
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…tool response Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ingual, swaig_secret Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Devon-White
left a comment
There was a problem hiding this comment.
Review: verified against signalwire-python @ f7fec89 (v3.4.1)
I pulled the SDK fresh. It has moved two releases past this PR's sync point: v3.4.0 (2026-08-24) and v3.4.1 (2026-09-06). Per the 3.4.0 changelog, "3.3.0 was never tagged or documented, so its contents are folded in here" — so the 3.3.0 surface this PR documents is real, but there is post-3.3.0 drift.
What I verified as correct
Method-by-method against source, plus an automated signature/default sweep:
HandoffRouter— all 5 methods, ctor defaultsnonce_ttl=3600/max_messages_per_call=200/capture_timeout=8.0(ai_chat/handoff.py:92-94), route status codes,NonceEntryexported fromsignalwire.ai_chat.AgentBase.mount(core/mixins/web_mixin.py:229),add_per_call_config(:1500),on_call_end(core/agent_base.py:557),set_multilingual(core/mixins/ai_config_mixin.py:228).FunctionResult—hold()incl. theisinstance(prompt, int)back-compat branch and the bare-integer-unless-routing emission (core/function_result.py:518-594),set_tool_response,rpc_ai_messageValueError,rpc_ai_global_data.core.capabilitiesandcore.post_prompt— including the voice/chat divergence table, which matches the module docstring verbatim.ContextBuilder.validate()— the newinitial_step, reserved-name, and dangling-set_functionschecks, incl.RESERVED_NATIVE_TOOL_NAMES = {next_step, change_context, gather_submit}(core/contexts.py:1243).- Env vars — all 9 new names exist in source;
SIGNALWIRE_TOKENhas 0 hits,SIGNALWIRE_API_TOKENhas 18, so thebuiltin-skills.mdxfix is right. - REST —
RequestOptionsfields/defaults, the POST/PATCH retry asymmetry (rest/_request_options.py:138-160),PaginatedIterator's empty-page and cycle-guard behavior,Messages/Projects,client.compatgenuinely gone,SignalWireClient→RestClient(rest/__init__.py),area_code→areacode(confirmed againstspecs/signalwire-rest/relay-rest/phone-numbers/main.tsp:111), andclient.callingreally is 37 methods.
Automated param-name/default comparison found zero mismatches across 54 relay Call pages, 76 AgentBase pages, and 51 FunctionResult pages. Every newly added /docs/… link and #anchor fragment resolves. yarn fern-md-check passes (2790 files); yarn fern-check fails only the unauthenticated FDR redirects check, as noted in the PR body. No changelog entry — correct, this is documentation work. Nav needs no edit (folder-based). The branch touches no specs/, so there's no build:specs obligation.
Findings
9 inline comments below. Three are post-3.3.0 SDK drift, one is a substantive accuracy bug, the rest are consistency/wording.
Two items I couldn't anchor inline
Both files are outside this PR's diff:
reference/python/agents/cli/sw-search.mdx needs the same two fixes as search/helpers.mdx:
- Lines 105 and 194 say
"spacy"is "Better quality, slower." The SDK deleted that claim in 3.4.1 — see the inline comment onsearch/helpers.mdx. --min-chunk-sizeis missing entirely (cli/build_search.py:256), and--chunk-sizegained markdown-specific semantics the page doesn't mention. The SDK's own hand-maintained help text now reads: "Chunk size in words (default: 50). For the markdown strategy this is the split threshold, applied as chunk_size * 6 characters." The implementation ismin_chars = max(0, self.min_chunk_size * 6)atsearch/document_processor.py:476.
reference/python/agents/swaig-function/{execute,to-swaig}.mdx have the same normalization gap as the two gather pages: execute(raw_data) and to_swaig(token, call_id) are X | None = None in source but carry no default in the docs.
One process note
The branch is behind origin/main, so this PR's diff currently shows ~200 files it doesn't own (specs/**/tsp-output, fern/apis/*/openapi.yaml, changelog entries, scripts/). The branch's actual authored surface is 296 files, all under fern/products/server-sdks/pages/reference/python/** plus 3 guides, fern/docs.yml, and sdk-source-sync.json. Merging main again would make this much easier to review.
Address the PR #667 review. Post-3.3.0 drift: add min_chunk_size to IndexBuilder, DocumentProcessor, and sw-search; note chunk_size as the markdown split threshold; replace the retracted "better quality" spacy claim with the SDK's measure-it wording. Accuracy: keyword_weight is accepted and ignored; escalate() returning True doesn't confirm a captured record; paginate lists the eight list()-only resources. Normalize optional params on the gather, execute, and to_swaig pages. Point sdk-source-sync.json at v3.4.1 (the previous commit was a squash-merged branch head that no longer exists upstream). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Devon-White
left a comment
There was a problem hiding this comment.
Review of the Python Server SDK resync. Links, the two new compat redirects, nav globs, and all 15 new EndpointSchemaSnippet/EndpointResponseSnippet references all check out. Findings are inline.
Wrong or contradictory for the reader
phone_numbers.search(quantity=...)in three places; the parameter ismax_resultsperopenapi.yamland the Python search reference page.- The
wait_for_ringing/wait_for_answeredexamples wait on a callclient.dial()already returned answered, so neither shows the method doing anything and the ringing page printsanswered. builtin-skills.mdxnow saysSIGNALWIRE_API_TOKENfor the datasphere fallback while the TypeScript datasphere reference still saysSIGNALWIRE_TOKEN.agent-base/handle-request.mdxdocumentsdict[str, Any]whereswml-service/handle-request.mdxsaysdict[str, str]for the same inherited method.
Mechanical
- Five code-fence highlight ranges are off, including one out of range (
{9-15}on a 14-line block). projects.get/projects.deleteare missing## **Parameters**;deleteis also missing## **Returns**.- Four new cards inserted out of slug-alphabetical order.
Unrelated to this PR: the broken link /docs/apis/rest/ai-chat/chat-methods in ai-chat-client/index.mdx:9 is pre-existing and untouched — noting it only so it isn't attributed here.
|
|
||
| # Search for available numbers in area code 512 | ||
| available = client.phone_numbers.search(area_code="512", quantity=3) | ||
| available = client.phone_numbers.search(areacode="512", quantity=3) |
There was a problem hiding this comment.
quantity isn't a parameter on phone number search. openapi.yaml line 9599 and reference/python/rest/phone-numbers/search.mdx:27 both use max_results, so this example fails as written.
| available = client.phone_numbers.search(areacode="512", quantity=3) | |
| available = client.phone_numbers.search(areacode="512", max_results=3) |
Same issue twice in guides/manage-resources/overview.mdx.
| available = client.phone_numbers.search( | ||
| area_code="512", | ||
| areacode="512", | ||
| quantity=5, |
There was a problem hiding this comment.
quantity → max_results, same as reference/python/rest/overview.mdx:46.
| quantity=5, | |
| max_results=5, |
|
|
||
| # Search for a local number | ||
| available = client.phone_numbers.search(area_code="512", quantity=1) | ||
| available = client.phone_numbers.search(areacode="512", quantity=1) |
There was a problem hiding this comment.
Third occurrence of quantity on phone number search.
| available = client.phone_numbers.search(areacode="512", quantity=1) | |
| available = client.phone_numbers.search(areacode="512", max_results=1) |
| dialed = await client.dial( | ||
| devices=[[{"type": "phone", "params": {"to_number": "+15551234567", "from_number": "+15559876543"}}]] | ||
| ) | ||
| await dialed.wait_for_ringing(timeout=10) |
There was a problem hiding this comment.
This example can't demonstrate what the page documents. client.dial() resolves only once the call is answered, so wait_for_ringing() on the returned call returns immediately and the print("Ringing:", dialed.state) below prints answered, not ringing.
Showing wait_for_ringing needs a call object that hasn't reached ringing yet — a non-blocking dial/connect — or the page should say the state is already past ringing.
| dialed = await client.dial( | ||
| devices=[[{"type": "phone", "params": {"to_number": "+15551234567", "from_number": "+15559876543"}}]] | ||
| ) | ||
| await dialed.wait_for_answered(timeout=30) |
There was a problem hiding this comment.
Same construction as wait-for-ringing.mdx: client.dial() already returns an answered call, so this wait_for_answered(timeout=30) is a no-op and doesn't show the method doing anything. Worth reworking alongside the ringing page.
| <Card title="get_app" href="/docs/server-sdks/reference/python/agents/agent-base/get-app"> | ||
| Get the FastAPI application instance for use with deployment adapters. | ||
| </Card> | ||
| <Card title="handle_request" href="/docs/server-sdks/reference/python/agents/agent-base/handle-request"> |
There was a problem hiding this comment.
Nit: handle_request is out of slug-alphabetical order relative to the rest of the list.
| <Card title="get_basic_auth_credentials" href="/docs/server-sdks/reference/python/agents/swml-service/get-basic-auth-credentials"> | ||
| Retrieve the HTTP Basic Auth credentials for the service. | ||
| </Card> | ||
| <Card title="handle_request" href="/docs/server-sdks/reference/python/agents/swml-service/handle-request"> |
There was a problem hiding this comment.
Nit: new card inserted out of the list's slug-alphabetical order.
| <Card title="set_functions" href="/docs/server-sdks/reference/python/agents/context-builder/step/set-functions"> | ||
| Set which SWAIG functions are available during this step. | ||
| </Card> | ||
| <Card title="set_history" href="/docs/server-sdks/reference/python/agents/context-builder/step/set-history"> |
There was a problem hiding this comment.
Nit: new card inserted out of the list's slug-alphabetical order.
|
|
||
| <EndpointSchemaSnippet endpoint="GET /api/projects/{id}" /> | ||
|
|
||
| ## **Response Example** |
There was a problem hiding this comment.
projects.get takes a required id, but there's no ## **Parameters** section documenting it. projects.delete has the same gap.
| Delete a subproject. | ||
|
|
||
| <EndpointSchemaSnippet endpoint="DELETE /Accounts/{AccountSid}/Calls/{Sid}" /> | ||
| <EndpointSchemaSnippet endpoint="DELETE /api/projects/{id}" /> |
There was a problem hiding this comment.
Missing two sections relative to the reference page convention: no ## **Parameters** for the required id, and no ## **Returns**. This file was renamed from compat/calls/delete.mdx, so it may have inherited the old page's shape.
Description
Sync the Python Server SDK reference to signalwire-python 3.3.0.
MessagesandProjectsREST resources,RequestOptions,paginate(), andSignalWireRestTransportErrorclient.compat) and redirect its URLs to the REST overviewCallconvenience methods (play_*,detect_*,prompt_*,wait_for_*)HandoffRouter, client capabilities helpers, and post-prompt normalizationAgentBase.mount,add_per_call_config,handle_request,set_multilingual,on_call_end,swaig_secretset_history, gatherisolated, and newvalidate()checksFunctionResultresponse as a prompt to the model; addset_tool_responseand hold routingX | Nonetypes,default="None"on optional params,## **Parameters**headingsFollow-up
stepandtimeout_stepon theholdaction, which the SDK emits: SWML spec: hold action is missingstepandtimeout_step#666Type of Change
Related Issues
Testing
yarn fern-md-checkpassesyarn fern-checkpasses apart from the unauthenticated redirects checkChecklist
Additional Notes