How egbejoe06/agentic_sdk works
Purpose and entry points
Agentic Wallet SDK is a TypeScript library for AI-controlled, policy-governed Solana devnet wallets. Its public export surface is src/index.ts; consumers create/configure wallets and submit typed intents. Runnable integration entry points are the demos, notably demo/agentDemo.ts, demo/multiAgentDemo.ts, and demo/whirlpoolSwapDemo.ts.
Execution pipeline
The central control flow is agent/application → wallet.execute(intent) → policy validation → transaction simulation → signing/submission → Solana. src/core/AgenticWallet.ts orchestrates this pipeline and represents the wallet-facing API. Shared request, policy, and result contracts define the boundary between intent producers and core execution in src/core/types.ts.
Policy enforcement
src/core/PolicyEngine.ts is the pre-execution authorization boundary. Every intent must pass configured transaction constraints before it can reach transaction construction or private-key operations. This isolates AI agents and application code from direct signing authority while allowing explicit, typed operation classes.
Simulation and signing isolation
src/core/Sandbox.ts validates proposed transactions against Solana before broadcast, providing a failure/safety boundary ahead of signing. src/core/SecureSigner.ts owns private-key-backed signing; keys are sourced from environment-backed setup rather than exposed to agents. src/core/WalletFactory.ts constructs wallet instances and wires the core components.
Intent-to-transaction layer
Intent modules turn constrained, high-level requests into Solana instructions/transactions. Core transfer and arbitrary program paths are src/intents/transferSol.ts, src/intents/transferSpl.ts, and src/intents/interactProgram.ts. Stateful staking flows are represented by src/intents/stakeSol.ts, src/intents/unstakeSol.ts, and src/intents/withdrawStakeSol.ts. This layer is the main protocol-specific boundary below policy and above simulation/signing.
DeFi protocol operations
Orca Whirlpool operations—swap, liquidity provisioning, and reward harvesting—are encapsulated in src/intents/whirlpoolSwap.ts, src/intents/whirlpoolAddLiquidity.ts, and src/intents/whirlpoolHarvest.ts. These intents let agents request specialized DeFi actions without bypassing the same policy, sandbox, and signer pipeline. Instruction compatibility utilities live in src/utils/kitInstructionToWeb3.ts.
Agent integration and multi-agent use
src/agent/walletTools.ts exposes wallet execution as LangChain-compatible tools; src/agent/LangChainAgent.ts binds an LLM agent to those tools. Agents do not receive signing keys: they emit intent/tool calls that return through AgenticWallet. Multi-wallet coordination is demonstrated by demo/multiAgentDemo.ts and demo/twoAgentSwap.ts, where wallets interact over normal on-chain transfers rather than a trusted off-chain custody layer.
Runtime and external boundaries
The project runs on Node.js 18+ and compiles TypeScript into dist/. It uses Solana devnet RPC and programs, including stake operations and Orca Whirlpool; demos require a funded devnet wallet. LLM-backed demos additionally depend on a provider API key such as GOOGLE_GENAI_API_KEY. Environment key material is configured via .env.example; agent command/schema guidance is supplied in SKILLS.md.
Main entry points: Sandbox.ts Transaction sandbox · PolicyEngine.ts Policy engine · WalletFactory.ts Wallet factory · AgenticWallet.ts Agentic wallet
Components 17
Public API
- SDK exports · Consumer-facing wallet and intent API.
src/index.ts - Intent contracts · Typed requests, policies, and execution results.
src/core/types.ts - Agent demos · Single-agent, multi-agent, and Whirlpool runnable flows.
Agent Integration
- Wallet tools · Exposes typed wallet execution to agent tool calls.
src/agent/walletTools.ts - LangChain agent · Binds an LLM agent to wallet tools.
src/agent/LangChainAgent.ts
Wallet Control Plane
- Wallet factory · Builds wallets and wires execution dependencies.
src/core/WalletFactory.ts - Agentic wallet · Executes intents through policy, simulation, signing, and submission.
src/core/AgenticWallet.ts - Policy engine · Rejects intents outside configured transaction constraints.
src/core/PolicyEngine.ts - Transaction sandbox · Simulates proposed transactions before signing.
src/core/Sandbox.ts - Secure signer · Signs approved transactions with environment-sourced keys.
src/core/SecureSigner.ts
Intent Builders
- Transfer intents · SOL and SPL transfer instruction paths.
- Program interaction · Builds constrained arbitrary-program transactions.
src/intents/interactProgram.ts - Staking intents · Stake, unstake, and withdraw-stake flows.
- Whirlpool intents · Swap, liquidity, and reward-harvest operations.
- Instruction compatibility · Bridges kit instructions to web3-compatible instructions.
src/utils/kitInstructionToWeb3.ts
Runtime Boundaries
- Solana devnet · Simulation, transaction submission, stake, and Whirlpool execution.
- LLM provider · Supplies models for LLM-backed demos.
Connections 25
- SDK exports → Wallet factory: creates wallets
- SDK exports → Intent contracts: exports types
- Wallet factory → Agentic wallet: constructs
- Wallet factory → Policy engine: wires
- Wallet factory → Transaction sandbox: wires
- Wallet factory → Secure signer: wires
- LangChain agent → Wallet tools: uses
- Wallet tools → Agentic wallet: submits intents
- LLM provider → LangChain agent: powers
- Agent demos → LangChain agent: runs agent flows
- Agent demos → Agentic wallet: uses wallets
- Intent contracts → Agentic wallet: typed intents
- Agentic wallet → Policy engine: validates intent
- Policy engine → Transfer intents: approved transfers
- Policy engine → Program interaction: approved program calls
- Policy engine → Staking intents: approved staking
- Policy engine → Whirlpool intents: approved DeFi actions
- Transfer intents → Transaction sandbox: builds transaction
- Program interaction → Transaction sandbox: builds transaction
- Staking intents → Transaction sandbox: builds transaction
- Whirlpool intents → Instruction compatibility: converts instructions
- Instruction compatibility → Transaction sandbox: web3 transaction
- Transaction sandbox → Solana devnet: simulates against
- Transaction sandbox → Secure signer: approved transaction
- Secure signer → Solana devnet: signs and submits