Agent Context
The AgentContext object provides session data and SDK methods to your agent functions.
Last updated
The AgentContext object provides session data and SDK methods to your agent functions.
Last updated
async function run(agent: AgentContext): Promise<void> {
await agent.log(`Session: ${agent.sessionId}`);
await agent.log(`Wallet: ${agent.sessionWalletAddress}`);
await agent.log(`Positions: ${agent.currentPositions.length}`);
}def run(agent: AgentContext) -> None:
agent.log(f"Session: {agent.sessionId}")
agent.log(f"Wallet: {agent.sessionWalletAddress}")
agent.log(f"Positions: {len(agent.currentPositions)}")const positions = await agent.getCurrentPositions();
if (positions.success && positions.data) {
if (positions.data.hasPendingTxs) {
await agent.log("Pending transactions detected");
}
// Use positions.data.positions
}positions = agent.get_current_positions()
if positions.success and positions.data:
if positions.data.hasPendingTxs:
agent.log("Pending transactions detected")
# Use positions.data.positions