Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
TaskOutput
Defined in the task module.
Rust AI Agent SDK
Task output containing the result of task execution
Fields
| Name | Type | Description |
|---|
raw | String | Raw output string |
json | Option<serde_json::Value> | Parsed JSON output (if applicable) |
task_id | String | Task ID |
agent_name | Option<String> | Agent name that executed the task |
duration_ms | Option<u64> | Execution duration in milliseconds |
tokens_used | Option<u32> | Token usage |
metadata | HashMap<String | Additional metadata |
serde_json | :Value> | Additional metadata |
Methods
new
fn new(raw: impl Into<String>, task_id: impl Into<String>) -> Self
Create a new task output
Parameters:
| Name | Type |
|---|
raw | impl Into<String> |
task_id | impl Into<String> |
with_json
fn with_json(mut self, json: serde_json::Value) -> Self
Set JSON output
Parameters:
| Name | Type |
|---|
json | serde_json::Value |
with_agent
fn with_agent(mut self, name: impl Into<String>) -> Self
Set agent name
Parameters:
| Name | Type |
|---|
name | impl Into<String> |
with_duration
fn with_duration(mut self, ms: u64) -> Self
Set duration
Parameters:
with_tokens
fn with_tokens(mut self, tokens: u32) -> Self
Set token usage
Parameters:
fn with_metadata(mut self, key: impl Into<String>, value: serde_json::Value) -> Self
Add metadata
Parameters:
| Name | Type |
|---|
key | impl Into<String> |
value | serde_json::Value |
as_str
Get raw output as string
parse_json
fn parse_json(&self) -> Result<serde_json::Value>
Try to parse raw output as JSON
Source
View on GitHub
praisonai/src/task/mod.rs at line 28