From d17aec887042828ac320d85f8c84b5a7fc58930e Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 19:23:57 +0000 Subject: [PATCH] Showcase tabbed CodeBlocks across all SDK languages in quickstart --- .../guides/getting-started/quickstart.mdx | 269 +++++++----------- 1 file changed, 96 insertions(+), 173 deletions(-) diff --git a/fern/products/server-sdks/pages/guides/getting-started/quickstart.mdx b/fern/products/server-sdks/pages/guides/getting-started/quickstart.mdx index f977bba828..c2aa9bbe56 100644 --- a/fern/products/server-sdks/pages/guides/getting-started/quickstart.mdx +++ b/fern/products/server-sdks/pages/guides/getting-started/quickstart.mdx @@ -12,13 +12,11 @@ max-toc-depth: 3 ### The Minimal Agent +Save the following as a single file. Every SDK produces the same SWML document, shown in the last tab. + - - -`my_first_agent.py` - -```python +```python title="Python" #!/usr/bin/env python3 ## my_first_agent.py - A simple voice AI agent """ @@ -62,10 +60,8 @@ if __name__ == "__main__": print("Press Ctrl+C to stop") agent.run() ``` - - -```typescript +```typescript title="TypeScript" #!/usr/bin/env npx tsx // my_first_agent.ts - A simple voice AI agent import { AgentBase } from '@signalwire/sdk'; @@ -94,16 +90,8 @@ console.log('Starting My First Agent...'); console.log('Server running at: http://localhost:3000'); agent.run(); ``` - - -{/* - - - -`my_first_agent.go` - -```go +```go title="Go" package main import ( @@ -134,13 +122,7 @@ func main() { } ``` - - - - -`my_first_agent.rb` - -```ruby +```ruby title="Ruby" #!/usr/bin/env ruby # my_first_agent.rb - A simple voice AI agent require 'signalwire' @@ -168,13 +150,7 @@ puts 'Server running at: http://localhost:3000' agent.run ``` - - - - -`MyFirstAgent.java` - -```java +```java title="Java" // MyFirstAgent.java - A simple voice AI agent import com.signalwire.agents.agent.AgentBase; import java.util.List; @@ -204,13 +180,7 @@ public class MyFirstAgent { } ``` - - - - -`my_first_agent.pl` - -```perl +```perl title="Perl" #!/usr/bin/env perl # my_first_agent.pl - A simple voice AI agent use strict; @@ -238,13 +208,7 @@ print "Server running at: http://localhost:3000\n"; $agent->run; ``` - - - - -`my_first_agent.cpp` - -```cpp +```cpp title="C++" // my_first_agent.cpp - A simple voice AI agent #include #include @@ -273,13 +237,7 @@ int main() { } ``` - - - - -`my_first_agent.php` - -```php +```php title="PHP" run(); ``` - - - - -`my_first_agent.cs` - -```csharp +```csharp title="C#" // my_first_agent.cs - A simple voice AI agent using SignalWire.Agent; @@ -340,26 +292,70 @@ Console.WriteLine("Server running at: http://localhost:3000"); agent.Run(); ``` - +```json title="SWML" +{ + "version": "1.0.0", + "sections": { + "main": [ + {"answer": {}}, + { + "ai": { + "prompt": { + "text": "# Role\nYou are a friendly and helpful assistant...\n\n# Guidelines\nFollow these rules:\n- Be friendly and professional\n- ..." + }, + "languages": [ + {"name": "English", "code": "en-US", "voice": "rime.spore"} + ] + } + } + ] + } +} +``` -*/} + ### Run the Agent -| Language | Command | -|----------|---------| -| Python | `python my_first_agent.py` | -| TypeScript | `npx tsx my_first_agent.ts` | -{/* -| Go | `go run my_first_agent.go` | -| Ruby | `ruby my_first_agent.rb` | -| Java | `javac MyFirstAgent.java && java MyFirstAgent` | -| Perl | `perl my_first_agent.pl` | -| C++ | `g++ -std=c++17 my_first_agent.cpp -lsignalwire -o my_first_agent && ./my_first_agent` | -| PHP | `php my_first_agent.php` | -| C# | `dotnet run` | - -*/} + + +```bash title="Python" +python my_first_agent.py +``` + +```bash title="TypeScript" +npx tsx my_first_agent.ts +``` + +```bash title="Go" +go run my_first_agent.go +``` + +```bash title="Ruby" +ruby my_first_agent.rb +``` + +```bash title="Java" +javac MyFirstAgent.java && java MyFirstAgent +``` + +```bash title="Perl" +perl my_first_agent.pl +``` + +```bash title="C++" +g++ -std=c++17 my_first_agent.cpp -lsignalwire -o my_first_agent && ./my_first_agent +``` + +```bash title="PHP" +php my_first_agent.php +``` + +```bash title="C#" +dotnet run +``` + + You'll see output like: @@ -464,9 +460,9 @@ Let's add a function the AI can call: - - -```python + + +```python title="Python" #!/usr/bin/env python3 ## my_first_agent_with_function.py - Agent with custom function """ @@ -515,10 +511,7 @@ if __name__ == "__main__": agent.run() ``` - - - -```typescript +```typescript title="TypeScript" #!/usr/bin/env npx tsx // my_first_agent_with_function.ts - Agent with custom function import { AgentBase, FunctionResult } from '@signalwire/sdk'; @@ -549,14 +542,7 @@ console.log('Starting My First Agent (with jokes!)...'); agent.run(); ``` - - -{/* - - - - -```go +```go title="Go" package main import ( @@ -592,11 +578,7 @@ func main() { } ``` - - - - -```ruby +```ruby title="Ruby" #!/usr/bin/env ruby # my_first_agent_with_function.rb - Agent with custom function require 'signalwire' @@ -625,11 +607,7 @@ puts 'Starting My First Agent (with jokes!)...' agent.run ``` - - - - -```java +```java title="Java" // MyFirstAgentWithFunction.java - Agent with custom function import com.signalwire.agents.agent.AgentBase; import com.signalwire.agents.swaig.FunctionResult; @@ -660,11 +638,7 @@ public class MyFirstAgentWithFunction { } ``` - - - - -```perl +```perl title="Perl" #!/usr/bin/env perl # my_first_agent_with_function.pl - Agent with custom function use strict; @@ -700,11 +674,7 @@ print "Starting My First Agent (with jokes!)...\n"; $agent->run; ``` - - - - -```cpp +```cpp title="C++" // my_first_agent_with_function.cpp - Agent with custom function #include #include @@ -736,11 +706,7 @@ int main() { } ``` - - - - -```php +```php title="PHP" run(); ``` - - - - -`my_first_agent_with_function.cs` - -```csharp +```csharp title="C#" // my_first_agent_with_function.cs - Agent with custom function using SignalWire.Agent; using SignalWire.SWAIG; @@ -804,9 +764,7 @@ Console.WriteLine("Starting My First Agent (with jokes!)..."); agent.Run(); ``` - - -*/} + Now when a caller asks for a joke, the AI will call your `tell_joke` function! @@ -848,9 +806,9 @@ Here's a more complete example showing common patterns -- voice, hints, prompts, - - -```python + + +```python title="Python" #!/usr/bin/env python3 ## complete_first_agent.py - Complete agent example with multiple features """ @@ -943,9 +901,8 @@ if __name__ == "__main__": print("Complete First Agent running at http://localhost:3000") agent.run() ``` - - -```typescript + +```typescript title="TypeScript" #!/usr/bin/env npx tsx // complete_first_agent.ts - Complete agent example with multiple features import { AgentBase, FunctionResult } from '@signalwire/sdk'; @@ -991,14 +948,8 @@ agent.defineTool({ console.log('Complete First Agent running at http://localhost:3000'); agent.run(); ``` - - -{/* - - - -```go +```go title="Go" package main import ( @@ -1050,11 +1001,7 @@ func main() { } ``` - - - - -```ruby +```ruby title="Ruby" #!/usr/bin/env ruby # complete_first_agent.rb - Complete agent example with multiple features require 'signalwire' @@ -1088,11 +1035,7 @@ puts 'Complete First Agent running at http://localhost:3000' agent.run ``` - - - - -```java +```java title="Java" // CompleteFirstAgent.java - Complete agent example with multiple features import com.signalwire.agents.agent.AgentBase; import com.signalwire.agents.swaig.FunctionResult; @@ -1133,11 +1076,7 @@ public class CompleteFirstAgent { } ``` - - - - -```perl +```perl title="Perl" #!/usr/bin/env perl # complete_first_agent.pl - Complete agent example with multiple features use strict; @@ -1184,11 +1123,7 @@ print "Complete First Agent running at http://localhost:3000\n"; $agent->run; ``` - - - - -```cpp +```cpp title="C++" // complete_first_agent.cpp - Complete agent example with multiple features #include #include @@ -1233,11 +1168,7 @@ int main() { } ``` - - - - -```php +```php title="PHP" run(); ``` - - - - -`complete_first_agent.cs` - -```csharp +```csharp title="C#" // complete_first_agent.cs - Complete agent example with multiple features using SignalWire.Agent; using SignalWire.SWAIG; @@ -1336,9 +1261,7 @@ Console.WriteLine("Complete First Agent running at http://localhost:3000"); agent.Run(); ``` - - -*/} + ### Next Steps