From 31e87a62b438e1fde85dcb63190e403c5fd92765 Mon Sep 17 00:00:00 2001 From: Yufan Wu Date: Mon, 11 May 2026 22:16:50 +0800 Subject: [PATCH 1/2] Add project README --- README.md | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..c306996 --- /dev/null +++ b/README.md @@ -0,0 +1,111 @@ +# fuel-agent-kit + +TypeScript utilities for building AI agents that can read balances and execute +transactions on the Fuel network. + +The package wraps Fuel wallet operations, Mira swaps and liquidity actions, and +Swaylend lending actions behind a LangChain tool-calling agent. + +## Features + +- Create a Fuel-aware LangChain agent with OpenAI, Anthropic, or Gemini models +- Transfer verified Fuel assets +- Read wallet balances +- Swap assets on Mira +- Add liquidity to Mira pools +- Supply collateral and borrow assets on Swaylend +- Build standalone transaction flows without using the agent executor + +## Installation + +```bash +npm install fuel-agent-kit fuels +``` + +`fuels` is a peer dependency and must be installed by the application using this +package. + +## Quick Start + +```ts +import { FuelAgent } from 'fuel-agent-kit'; + +const agent = new FuelAgent({ + walletPrivateKey: process.env.FUEL_WALLET_PRIVATE_KEY!, + model: 'gpt-4o-mini', + openAiApiKey: process.env.OPENAI_API_KEY!, +}); + +const result = await agent.execute('swap 5 USDC for ETH'); + +console.log(result); +``` + +## Configuration + +Create a `.env` file or provide these values from your runtime environment: + +```bash +FUEL_WALLET_PRIVATE_KEY=your_private_key +OPENAI_API_KEY=your_openai_key +ANTHROPIC_API_KEY=your_anthropic_key +GOOGLE_GEMINI_API_KEY=your_gemini_key +``` + +Only the API key for the selected model provider is required. + +```ts +const agent = new FuelAgent({ + walletPrivateKey: process.env.FUEL_WALLET_PRIVATE_KEY!, + model: 'claude-3-5-sonnet-20241022', + anthropicApiKey: process.env.ANTHROPIC_API_KEY!, +}); +``` + +## Direct API Usage + +You can call the Fuel helpers directly through the `FuelAgent` instance when you +do not want an LLM to decide which tool to use. + +```ts +await agent.transfer({ + to: 'fuel1...', + amount: '1', + symbol: 'ETH', +}); + +await agent.getOwnBalance({ + symbol: 'USDC', +}); +``` + +Available methods: + +- `execute(input)` runs the LangChain agent +- `transfer(params)` transfers an asset +- `swapExactInput(params)` swaps an exact input amount on Mira +- `addLiquidity(params)` adds liquidity to a Mira pool +- `supplyCollateral(params)` supplies collateral on Swaylend +- `borrowAsset(params)` borrows from Swaylend +- `getOwnBalance(params)` reads the configured wallet balance + +## Development + +```bash +npm install +npm run build +npm test +npm run check-format +``` + +The main source files live in `src/`. Tests are in `test/` and use Vitest. + +## Safety Notes + +This package can submit real blockchain transactions. Use a test wallet while +developing, keep private keys out of source control, and review agent prompts +before allowing the agent to execute transactions. + +## License + +MIT From 3387636c74ac2324f9137e7f7060bcbc24da5aee Mon Sep 17 00:00:00 2001 From: Yufan Wu Date: Tue, 12 May 2026 10:30:59 +0800 Subject: [PATCH 2/2] Address Copilot README feedback --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c306996..e0f62db 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Swaylend lending actions behind a LangChain tool-calling agent. - Swap assets on Mira - Add liquidity to Mira pools - Supply collateral and borrow assets on Swaylend -- Build standalone transaction flows without using the agent executor +- Call transaction helper methods directly after constructing a `FuelAgent` ## Installation @@ -57,7 +57,7 @@ Only the API key for the selected model provider is required. ```ts const agent = new FuelAgent({ walletPrivateKey: process.env.FUEL_WALLET_PRIVATE_KEY!, - model: 'claude-3-5-sonnet-20241022', + model: 'claude-3-5-sonnet-latest', anthropicApiKey: process.env.ANTHROPIC_API_KEY!, }); ``` @@ -65,7 +65,9 @@ const agent = new FuelAgent({ ## Direct API Usage You can call the Fuel helpers directly through the `FuelAgent` instance when you -do not want an LLM to decide which tool to use. +do not want an LLM to decide which tool to use. The current constructor still +initializes the LangChain agent, so provide a supported model name and the API +key for that provider. ```ts await agent.transfer({ @@ -86,7 +88,7 @@ Available methods: - `swapExactInput(params)` swaps an exact input amount on Mira - `addLiquidity(params)` adds liquidity to a Mira pool - `supplyCollateral(params)` supplies collateral on Swaylend -- `borrowAsset(params)` borrows from Swaylend +- `borrowAsset(params)` borrows USDC from Swaylend - `getOwnBalance(params)` reads the configured wallet balance ## Development