Skip to main content
AgentContext is passed to your run and unwind functions. It has session data and all SDK methods.

Session Data

  • sessionId (number): Unique session identifier
  • sessionWalletAddress (string): Wallet address for this session
  • currentPositions (array): Assets allocated to the agent at the start of execution
  • executionMode (string): "auto" or "manual"

SDK Methods

  • log(): Send messages to users and log locally
  • memory: Session-scoped key-value storage
  • platforms: Platform integrations (Polymarket, Hyperliquid)
  • swidge: Cross-chain swap and bridge operations
  • sign_and_send(): Sign and broadcast transactions
  • sign_message(): Sign messages (EVM only)
  • transactions(): Get transaction history
  • get_current_positions(): Get live positions
  • clear_suggested_transactions(): Clear pending suggestions (manual mode)

Basic Usage

def run(agent: AgentContext) -> None:
    agent.log(f"Session: {agent.sessionId}")
    agent.log(f"Wallet: {agent.sessionWalletAddress}")
    agent.log(f"Positions: {len(agent.currentPositions)}")

Current Positions

currentPositions is a snapshot taken at execution start. After transactions, use getCurrentPositions() for updated balances. See Positions for full details.
positions = agent.get_current_positions()
if positions.success and positions.data:
    if positions.data.hasPendingTxs:
        agent.log("Pending transactions detected")
    # Use positions.data.positions

See Also