-
Notifications
You must be signed in to change notification settings - Fork 73
feat: enhanced runagent-rust sdk with proper standard #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(()) | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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?; | ||
|
|
||
| let response = client.run(&[("message", json!("Hello!"))]).await?; | ||
|
|
||
| println!("Response: {}", response); | ||
| Ok(()) | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(()) | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid committing what looks like a real API key in the example
The
api_keyfield is populated with a long literal starting withrau_, 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:
(or use
std::env::var("RUNAGENT_API_KEY")if you want to show a more realistic pattern).🤖 Prompt for AI Agents