harness

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Command harness is a minimal tool-calling agent, built the same way as go-wiki/examples/eino-ollama-agent/main.go (github.com/cloudwego/eino's prebuilt ReAct agent: call the model -> if it asked for a tool, run the tool and feed the result back -> repeat until the model answers without a tool call), but with walletTools() (see tools.go) in place of that example's demoTools().

walletTools() gives the agent read-only visibility into this repo's real trading wallet: its Solend/Kamino lending obligations, its raw token balances, live Jupiter USD prices, and total portfolio value -- the exact queries run by hand, script by script, over the course of a live session unwinding real positions in this wallet. It does not expose any of that session's mutating actions (repay/withdraw/sweep); see walletTools' own doc comment for why.

Usage:

go run . -prompt "What obligations are currently open, and what's the wallet worth right now?"

Index

Constants

View Source
const DefaultWallet = "Hg2p3cfmg3dratEVy94JArTVM7KzEywgNdmFnrfhroh9"

DefaultWallet is the trading child wallet every WalletTools() query targets by default -- the same real wallet (common.DeriveChildKeyFromIndex(parentKey, 1)) this session's manual scripts (checkob, manualrepay, manualwithdraw, sweeptousdc) all operated on. Override with -wallet to point this harness at a different address without needing the fee-payer keypair at all -- every tool here is read-only, so only the public key is ever needed. Exported so other packages building on this one share the same default without duplicating the literal.

Variables

This section is empty.

Functions

func NewStateClient added in v0.5.0

func NewStateClient(ctx context.Context, stateURL string) (state.Client, error)

NewStateClient dials the same internal state.Client/gRPC graph endpoint every other read in this codebase uses, given a raw -state-url flag value. Exported so other standalone entrypoints building on this package can dial the same way without duplicating this parsing.

func WalletTools added in v0.5.0

func WalletTools(stateClient state.Client, owner sgo.PublicKey) ([]tool.BaseTool, error)

WalletTools builds the read-only wallet-inspection toolkit this harness exposes to the agent, distilled directly from the ad hoc Go scripts run by hand during this session's live unwind of a real Solana trading wallet (checkob/main.go, the balance checks around the sweep-to-USDC step, and the portfolio-value computation) -- see demoTools() in go-wiki/examples/eino-ollama-agent/main.go for the shape this mirrors (utils.InferTool + a plain Go function per tool).

Every tool here is READ-ONLY: it queries live on-chain/off-chain state and never signs or sends anything. The real manual-repair actions from that session (hand-built Kamino/Solend repay/withdraw instructions, sweeping dust tokens to USDC via Jupiter) are deliberately NOT exposed as callable tools here -- those move real money, and in the session they were only ever run after an explicit, per-action human go-ahead in conversation ("go ahead and build it", "go ahead and send it"). Wiring them into a freely-callable agent tool would remove that human gate entirely; this harness intentionally stops at "let the model see what a human would see," not "let the model act."

Types

This section is empty.

Source Files

  • harness.go
  • tools.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL