Agent class API reference for the xpander SDK
Agent
class is the central component of the xpander SDK, representing an AI agent with capabilities for task execution, tool usage, and state management.
Parameter | Type | Required | Description |
---|---|---|---|
agent_id | string | Yes | ID of the agent |
Agent
instance
Property | Type | Description | Availability |
---|---|---|---|
id | string | Unique identifier for the agent | Always available |
name | string | Name of the agent | Always available |
instructions | object | System instructions for the agent | Always available |
metadata | object | Contains metadata like description | Always available |
execution | Execution | Current execution context | After adding a task |
messages | List[Dict] | Conversation messages array | After initialization |
graph | Graph | Workflow graph system | Always available |
tool_choice | string | Setting for tool selection behavior | Always available |
Property | Type | Description |
---|---|---|
memory_type | MemoryType | Type of memory (e.g., SHORT_TERM) |
memory_strategy | MemoryStrategy | Strategy for memory management (e.g., FULL) |
end_tool_enabled | boolean | Whether the xpfinish-agent-execution-finished tool is available to the model |
has_local_tools | boolean | Whether agent has local tools attached |
access_scope | AgentAccessScope | Access scope (e.g., ORGANIZATIONAL) |
delegation_type | AgentDelegationType | Delegation type (e.g., ROUTER) |
knowledge_bases | List | Connected knowledge bases |
organization_id | string | ID of the organization owning the agent |
Agent
object
Agent
object
xpfinish-agent-execution-finished
tool so the model cannot decide when to finish the task. When disabled, you can implement your own end logic or rely on the task ending once the model stops producing tool calls.
void
Parameter | Type | Required | Description |
---|---|---|---|
user_details | object | Yes | User information |
void
Parameter | Type | Required | Description |
---|---|---|---|
item_id | string | Yes | ID of the graph node |
GraphItem
object or undefined
if not found
xpfinish-agent-execution-finished
function. Use this when you want the LLM to decide when it has completed all required steps.
void
Parameter | Type | Required | Description |
---|---|---|---|
execution | Execution | Yes | Execution details to start |
Execution
object
Parameter | Type | Required | Description |
---|---|---|---|
llm_tokens | Tokens | Yes | Token counts to report |
ai_model | string | No | Model identifier |
source_node_type | string | No | Source node type if relevant |
void
Parameter | Type | Required | Description |
---|---|---|---|
llm_response | any | Yes | LLM response payload |
llm_inference_duration | number | No | Inference time in ms |
llm_provider | LLMProvider | No | Provider name |
source_node_type | string | No | Source node type |
void
Parameter | Type | Required | Description |
---|---|---|---|
llm_provider | LLMProvider | Yes | Provider to set for requests |
void
void
Parameter | Type | Required | Description |
---|---|---|---|
is_success | boolean | Yes | Whether the task succeeded |
result | string | No | Optional result string to send back |
void
xpfinish-agent-execution-finished
function internally. When stopping an agent due to a step limit you can call: