Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions runagent-rust/PUBLISH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Publishing the Rust SDK (`runagent-rust/runagent`)

Follow this checklist whenever you cut a new release of the Rust SDK.

## 1. Prerequisites

- Cargo credentials with publish rights to `runagent`.
- `cargo login <token>` already configured on the machine/CI runner.
- Clean git tree (all changes committed).

## 2. Version Bump

1. Update `version` in `runagent-rust/runagent/Cargo.toml`.
2. Update `runagent-rust/Cargo.toml` (workspace) if needed.
3. Update the version badge/examples in `runagent-rust/runagent/README.md`.

## 3. Build & Test

```bash
cd runagent-rust/runagent
cargo fmt
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
```

Optional: exercise key examples (local + remote) before publishing.

## 4. Package Audit

```bash
cargo package
```

Inspect `target/package/runagent-*.crate` (or run `cargo package --list`) to ensure only the expected files are included.

## 5. Publish

```bash
cargo publish
```

If 2FA is enabled, be ready to provide the OTP.

## 6. Post-Publish

- Tag the release: `git tag runagent-rust-vX.Y.Z && git push origin runagent-rust-vX.Y.Z`.
- Update release notes / changelog as needed.
- Ensure docs (README, SDK checklist) reflect any new behavior.

27 changes: 27 additions & 0 deletions runagent-rust/examples/async_example.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//! Async example using RunAgentClient
//!
//! This is the recommended approach for most use cases.

use runagent::{RunAgentClient, RunAgentClientConfig};
use serde_json::json;

#[tokio::main]
async fn main() -> runagent::RunAgentResult<()> {
// dotenvy::from_filename("local.env").ok(); // optional

let agent_id = "a6977384-6c88-40dc-a629-e6bf077786ae";
let entrypoint_tag = "minimal";

let client = RunAgentClient::new(
RunAgentClientConfig::new(agent_id, entrypoint_tag)
.with_local(true)
.with_address("127.0.0.1", 8452)
.with_enable_registry(false) // Skip DB lookup since we have explicit address
).await?;

let response = client.run(&[("message", json!("Hello!"))]).await?;

println!("Response: {}", response);
Ok(())
}

28 changes: 28 additions & 0 deletions runagent-rust/examples/direct_construction.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//! Example showing direct struct construction (TypeScript-like interface)
//!
//! This matches the TypeScript SDK pattern where you pass a config object directly.

use runagent::RunAgentClient;
use serde_json::json;

#[tokio::main]
async fn main() -> runagent::RunAgentResult<()> {
// Direct struct construction - matches TypeScript interface
let client = RunAgentClient::new(runagent::RunAgentClientConfig {
agent_id: "a6977384-6c88-40dc-a629-e6bf077786ae".to_string(),
entrypoint_tag: "minimal".to_string(),
api_key: Some("rau_b4dcebdef6386726b08971a1cc968d8a2b77c5834d30f3f5a43bddf065cd95cb".to_string()),
base_url: Some("http://localhost:8333/".to_string()),
local: None,
host: None,
port: None,
extra_params: None,
enable_registry: None,
}).await?;
Comment on lines +11 to +21
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Avoid committing what looks like a real API key in the example

The api_key field is populated with a long literal starting with rau_, which looks like a real credential. Even if it’s non-functional, committing secret-like strings is a bad practice and can trigger secret scanners.

Replace it with a placeholder or load from an environment variable. For example:

-        api_key: Some("rau_b4dcebdef6386726b08971a1cc968d8a2b77c5834d30f3f5a43bddf065cd95cb".to_string()),
+        api_key: Some("YOUR_RUNAGENT_API_KEY".to_string()),

(or use std::env::var("RUNAGENT_API_KEY") if you want to show a more realistic pattern).

🤖 Prompt for AI Agents
In runagent-rust/examples/direct_construction.rs around lines 11 to 21, the
example hardcodes a long api_key literal that resembles a real credential;
remove the literal and replace it with a non-secret placeholder or load it from
an environment variable. Update the api_key field to use either None or a call
to std::env::var("RUNAGENT_API_KEY") (handling the Result) or set
Some("YOUR_API_KEY_HERE".to_string()) so no real-looking secret is committed,
and document in a comment that users should supply their API key via env var or
config.


let response = client.run(&[("message", json!("Hello!"))]).await?;

println!("Response: {}", response);
Ok(())
}

27 changes: 27 additions & 0 deletions runagent-rust/examples/sync_example.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//! Sync example using blocking RunAgentClient
//!
//! This is useful for simple scripts or when you can't use async/await.
//! Note: For better performance, prefer the async version.

use runagent::blocking::{RunAgentClient, RunAgentClientConfig};
use serde_json::json;

fn main() -> runagent::RunAgentResult<()> {
// dotenvy::from_filename("local.env").ok(); // optional

let agent_id = "a6977384-6c88-40dc-a629-e6bf077786ae";
let entrypoint_tag = "minimal";

let client = RunAgentClient::new(
RunAgentClientConfig::new(agent_id, entrypoint_tag)
.with_local(true)
.with_address("127.0.0.1", 8452)
.with_enable_registry(false) // Skip DB lookup since we have explicit address
)?;

let response = client.run(&[("message", json!("Hello!"))])?;

println!("Response: {}", response);
Ok(())
}

Loading