For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • BedrockAgent
      • CLI Tools
      • Configuration
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions
      • LiveWire
      • MCP Gateway
      • PomBuilder
      • Prefabs
      • Search
      • SkillBase
      • Skills
      • SWAIGFunction
        • execute
        • to_swaig
        • validate_args
      • SWMLBuilder
      • SWMLService
      • WebService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • Chat
      • Compat
      • Datasphere
      • Fabric
      • Imported Numbers
      • Logs
      • Lookup
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSub
      • Queues
      • Recordings
      • Registry
      • RestClient
      • Short Codes
      • SignalWireRestError
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Parameters
  • Returns
  • Example
AgentsSWAIGFunction

validate_args

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

SWMLBuilder

Next
Built with

Validate arguments against the parameter JSON Schema. Uses jsonschema_rs (Rust-based) if available, falls back to jsonschema (pure Python), or skips validation if neither is installed.

Parameters

args
dict[str, Any]Required

Arguments to validate.

Returns

tuple[bool, list[str]] — A tuple of (is_valid, errors). When no validation library is available, returns (True, []).

Example

1from signalwire import SWAIGFunction
2from signalwire import FunctionResult
3
4func = SWAIGFunction(
5 name="lookup_account",
6 handler=lambda args, raw_data: FunctionResult("ok"),
7 description="Look up account status",
8 parameters={
9 "type": "object",
10 "properties": {
11 "account_id": {"type": "string", "description": "Account ID"}
12 },
13 "required": ["account_id"]
14 }
15)
16
17# Valid arguments
18is_valid, errors = func.validate_args({"account_id": "12345"})
19print(f"Valid: {is_valid}, Errors: {errors}")
20# Valid: True, Errors: []
21
22# Missing required argument
23is_valid, errors = func.validate_args({})
24print(f"Valid: {is_valid}, Errors: {errors}")
25# Valid: False, Errors: ["'account_id' is a required property"]