You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
-4Lines changed: 0 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,10 +56,6 @@ The SDK leverages several object-oriented and functional design patterns:
56
56
### 5. Background Trigger Pattern (`triggers.rs`)
57
57
-**Trigger Trait**: Defines asynchronous background tasks (such as status polling, listener intervals, etc.) that can interact with the connection session concurrently.
58
58
-**TriggerRunner**: Coordinates and spawns registered triggers in separate tasks when the agent session starts.
59
-
60
-
### 6. Direct Gemini Client (`direct.rs`)
61
-
-**GeminiDirectClient**: A transport-agnostic client that constructs REST request payloads and parses responses directly from the Gemini API. Bypasses the `localharness` and WebSocket loop entirely. It is helpful for environments where TCP/WebSocket or spawning subprocesses is not possible (e.g. lightweight WASI components).
Copy file name to clipboardExpand all lines: README.md
+1-26Lines changed: 1 addition & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,9 +178,8 @@ cargo leptos serve
178
178
179
179
### Leptos + Spin/WASI (Edge)
180
180
181
-
For edge/serverless deployments on [Fermyon Spin](https://www.fermyon.com/spin). Since Spin components cannot make outbound TCP/WebSocket connections, two modes are supported:
181
+
For edge/serverless deployments on [Fermyon Spin](https://www.fermyon.com/spin). Since Spin components cannot make outbound TCP/WebSocket connections directly, this target runs in**Sidecar Mode**, where the component communicates via HTTP with a native runner process (`agent_server`):
> See [`examples/README.md`](examples/README.md) for detailed architecture diagrams and configuration options.
202
195
203
-
### GeminiDirectClient
204
-
205
-
For environments where TCP/WebSocket is unavailable (e.g. WASI, embedded), the SDK provides a transport-agnostic Gemini API client that builds HTTP request payloads and parses responses — the caller provides the HTTP transport:
206
-
207
-
```rust
208
-
use antigravity_sdk_rust::direct::{GeminiDirectClient, ChatEntry};
209
-
use antigravity_sdk_rust::types::GeminiConfig;
210
-
211
-
let client = GeminiDirectClient::new(&GeminiConfig::default())
212
-
.with_system_instruction("You are a helpful assistant.".to_string());
213
-
214
-
// Build the request (URL, headers, body) — send via your HTTP client
215
-
let request = client.build_request("your-api-key", "Hello!", &[]).unwrap();
216
-
217
-
// Parse the response
218
-
let text = GeminiDirectClient::parse_response(&response_bytes).unwrap();
219
-
```
220
-
221
196
## Local Development
222
197
223
198
This project uses [just](https://github.com/casey/just) to manage development tasks.
Copy file name to clipboardExpand all lines: examples/README.md
+1-27Lines changed: 1 addition & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,11 +59,7 @@ Browser → Axum Server (native)
59
59
60
60
**Path:**`leptos_ssr_axum/`
61
61
62
-
A chat application that runs as a [Spin](https://www.fermyon.com/spin) WebAssembly component. Since Spin components cannot make outbound TCP/WebSocket connections (only `wasi:http`), this example supports **two modes**:
Uses the [`agent_server`](#4-agent-server-sidecar) sidecar to get full SDK features. The Spin component calls the sidecar via HTTP.
62
+
A chat application that runs as a [Spin](https://www.fermyon.com/spin) WebAssembly component. Since Spin components cannot make outbound TCP/WebSocket connections (only `wasi:http`), this example runs in **Sidecar Mode** using the [`agent_server`](#4-agent-server-sidecar) sidecar to get full SDK features (harness, tools, hooks, and policies).
67
63
68
64
```sh
69
65
# Terminal 1: Start the sidecar (runs full SDK + localharness)
#### Mode B: Direct Mode (Lightweight, No Sidecar)
91
-
92
-
Calls the Gemini API directly using the SDK's `GeminiDirectClient`. No localharness or sidecar needed. Simpler to deploy but without tools, hooks, or policies.
> **How does the mode get selected?** If the `gemini_api_key` Spin variable is set (non-empty), Direct Mode is used. Otherwise, Sidecar Mode is used (calls `agent_server_url`, which defaults to `http://127.0.0.1:8080`).
0 commit comments