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
10 changes: 4 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Changelog
All notable changes to this project's latest version.

## [0.1.30] - 2025-11-13

### Features

- Enhance error handling in RunAgentClient and WebSocket clients
## [0.1.31] - 2025-11-13

### Miscellaneous Tasks

- Bump version to v0.1.30
- Add repository information to package.json
- Simplify create-release workflow by removing pull request trigger
- Bump version to v0.1.31

<!-- generated by git-cliff -->
4 changes: 0 additions & 4 deletions leads_20251102_115848.csv

This file was deleted.

4 changes: 0 additions & 4 deletions leads_20251102_120327.csv

This file was deleted.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "hatchling.build"

[project]
name = "runagent"
version = "0.1.31"
version = "0.1.32"
description = "A command-line tool and SDK for deploying, managing, and interacting with AI agents"
readme = "README.md"
requires-python = ">=3.9"
Expand Down Expand Up @@ -103,7 +103,7 @@ line_length = 88
skip = ["docs"]

[tool.mypy]
python_version = "0.1.31"
python_version = "0.1.32"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
Expand Down Expand Up @@ -159,7 +159,7 @@ fail_under = 80

[tool.ruff]
line-length = 88
target-version = "0.1.31"
target-version = "0.1.32"
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
Expand Down
47 changes: 46 additions & 1 deletion runagent-go/runagent/pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,53 @@ func (c *Client) GetAgentArchitecture(ctx context.Context) (*types.AgentArchitec
return nil, types.NewServerError(fmt.Sprintf("Server returned status %d", resp.StatusCode))
}

body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read architecture response: %w", err)
}

var envelope struct {
Success bool `json:"success"`
Data struct {
AgentID string `json:"agent_id"`
Entrypoints []types.EntryPoint `json:"entrypoints"`
} `json:"data"`
Message string `json:"message"`
Error interface{} `json:"error"`
}

if err := json.Unmarshal(body, &envelope); err == nil && (envelope.Success || envelope.Message != "" || envelope.Error != nil) {
if envelope.Success {
architecture := &types.AgentArchitecture{
AgentID: envelope.Data.AgentID,
Entrypoints: envelope.Data.Entrypoints,
}
return architecture, nil
}

var message string
switch errInfo := envelope.Error.(type) {
case map[string]interface{}:
if m, ok := errInfo["message"].(string); ok {
message = m
}
case string:
message = errInfo
}

if message == "" {
message = envelope.Message
}
if message == "" {
message = "failed to retrieve agent architecture"
}

return nil, types.NewServerError(message)
}

// Fallback to legacy format without envelope
var architecture types.AgentArchitecture
if err := json.NewDecoder(resp.Body).Decode(&architecture); err != nil {
if err := json.Unmarshal(body, &architecture); err != nil {
return nil, fmt.Errorf("failed to decode architecture: %w", err)
}

Expand Down
10 changes: 7 additions & 3 deletions runagent-go/runagent/pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ func NewConfigError(message string) *RunAgentError {

// EntryPoint represents an agent entrypoint
type EntryPoint struct {
File string `json:"file"`
Module string `json:"module"`
Tag string `json:"tag"`
File string `json:"file,omitempty"`
Module string `json:"module,omitempty"`
Tag string `json:"tag"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Extractor map[string]interface{} `json:"extractor,omitempty"`
}

// AgentArchitecture represents agent configuration
type AgentArchitecture struct {
AgentID string `json:"agent_id,omitempty"`
Entrypoints []EntryPoint `json:"entrypoints"`
}

Expand Down
2 changes: 1 addition & 1 deletion runagent-go/runagent/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package runagent

// Version represents the current version of the RunAgent Go SDK
const Version = "0.1.31"
const Version = "0.1.32"
2 changes: 1 addition & 1 deletion runagent-rust/runagent/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "runagent"
version = "0.1.31"
version = "0.1.32"
edition = "2021"
description = "RunAgent SDK for Rust - Client SDK for interacting with deployed AI agents"
license = "MIT"
Expand Down
33 changes: 33 additions & 0 deletions runagent-rust/runagent/src/client/rest_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,39 @@ impl RestClient {
pub async fn get_agent_architecture(&self, agent_id: &str) -> RunAgentResult<Value> {
let path = format!("agents/{}/architecture", agent_id);
self.get(&path).await
.and_then(|response| {
if let Some(success) = response.get("success").and_then(|v| v.as_bool()) {
if success {
if let Some(data) = response.get("data") {
return Ok(data.clone());
}
return Err(RunAgentError::server(
"Architecture response missing data".to_string(),
));
}

let message = response
.get("error")
.and_then(|err| {
if err.is_object() {
err.get("message").and_then(|m| m.as_str()).map(|s| s.to_string())
} else {
err.as_str().map(|s| s.to_string())
}
})
.or_else(|| {
response
.get("message")
.and_then(|m| m.as_str())
.map(|s| s.to_string())
})
.unwrap_or_else(|| "Failed to retrieve agent architecture".to_string());

return Err(RunAgentError::server(message));
}

Ok(response)
})
.map_err(|e| {
if e.category() == "validation" && e.to_string().contains("Not found") {
RunAgentError::validation(format!(
Expand Down
4 changes: 2 additions & 2 deletions runagent-ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion runagent-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "runagent",
"version": "0.1.31",
"version": "0.1.32",
"type": "module",
"files": [
"dist"
Expand Down
11 changes: 10 additions & 1 deletion runagent-ts/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,16 @@ export class RunAgentClient {
}
} catch (error) {
console.error('❌ Failed to initialize agent:', error);
throw error;
if (error instanceof RunAgentExecutionError) {
throw error;
}
const message =
error instanceof Error ? error.message : 'Unknown initialization error';
throw new RunAgentExecutionError(
'INITIALIZATION_ERROR',
this.sanitizeMessage(message) ?? 'Failed to initialize agent',
'Verify the agent configuration and connection settings.'
);
}
}

Expand Down
Loading