# Pull Request Description
## Related Issue
Fixes # (issue number)
## Changes Made
This PR adds the following changes:
<!-- List the key changes made in this PR -->
- Query Voltr vault and strategies balances
- Withdraw from Voltr strategies
- Deposit into Voltr strategies
## Implementation Details
<!-- Provide technical details about the implementation -->
- utilises Voltr's SDK `@voltr/sdk` to instantiate a `VoltrClient`
- find and fetch relevant accounts to create instructions using
`VoltrClient`
## Transaction executed by agent
<!-- If applicable, provide example usage, transactions, or screenshots
-->
Example transaction:
https://solana.fm/tx/GnUd38TMhtBYNv29nNAyESEWLwjHhUW6hraNrPE3RTF6LtdqNtnoBBqEKptT5JaWqv6TiFp6MeooUa9Rt7vMAu9?cluster=mainnet-alpha
Demo: https://x.com/voltrxyz/status/1875204418465059189
## Prompt Used
<!-- If relevant, include the prompt or configuration used -->
Tested on autonomous mode.
```
async function runAutonomousMode(agent: any, config: any, interval = 10) {
console.log("Starting autonomous mode...");
let iterations = 0;
while (true) {
try {
const evenThought =
"1. Get the total amount and amount for each strategy of a Voltr vault: 3ab3KVY9GbDbUUbRnYNSBDQqABTDup7HmdgADHGpB8Bq. " +
"2. Take note of the strategies id with the their respective amount. " +
"3. Calculate the sum of all strategy amounts. " +
"4. Subtract that sum from the vault total to get the excess amount. " +
"5. Indicate the excess amount and the strategy id with the lowest amount.";
const oddThought =
"Using the latest excess amount, if it is 0 then do nothing. " +
"Else if it is more than 0, deposit the excess amount into the lowest strategy and vault: 3ab3KVY9GbDbUUbRnYNSBDQqABTDup7HmdgADHGpB8Bq.";
const thought = iterations % 2 === 0 ? evenThought : oddThought;
const stream = await agent.stream(
{ messages: [new HumanMessage(thought)] },
config,
);
for await (const chunk of stream) {
if ("agent" in chunk) {
for (const message of chunk.agent.messages) {
console.log(message.content);
}
} else if ("tools" in chunk) {
for (const message of chunk.tools.messages) {
console.log(message.content);
}
}
console.log("-------------------");
}
iterations++;
await new Promise((resolve) => setTimeout(resolve, interval * 1000));
} catch (error) {
if (error instanceof Error) {
console.error("Error:", error.message);
}
process.exit(1);
}
}
}
```
## Additional Notes
<!-- Any additional information that reviewers should know -->
## Checklist
- [x] I have tested these changes locally
- [x] I have updated the documentation
- [x] I have added a transaction link
- [x] I have added the prompt used to test it
# Pull Request Description
## Related Issue
Fixes#61
## Changes Made
This PR adds the following changes:
- Added a new example demonstrating LangGraph integration with Solana
Agent Kit
- Implemented a multi-agent system with specialized agents for different
tasks
- Added state management and routing logic using LangGraph's StateGraph
- Integrated Tavily search capabilities for enhanced general-purpose
queries
- Added support for token swaps using Jupiter DEX
- Implemented TypeScript-based project structure with full type safety
- Added comprehensive documentation and architecture diagram
## Implementation Details
- Created a directed workflow using StateGraph with the following
components:
- Manager Agent: Handles query classification and routing
- General Agent: Processes basic queries with Tavily search integration
- Transfer/Swap Agent: Handles token transfers and DEX operations
- Read Agent: Manages blockchain data queries
- Implemented state management using LangGraph annotations for query
classification
- Added environment-based configuration for API keys and RPC endpoints
- Integrated with external dependencies:
- @langchain/community v0.3.20
- @langchain/core v0.3.26
- @langchain/langgraph v0.2.36
- solana-agent-kit v1.3.0
- Set up TypeScript configuration with ESM support
## Architecture
<img width="801" alt="Screenshot 2024-12-27 at 5 59 26 PM"
src="https://github.com/user-attachments/assets/a90597ac-3bfc-47e1-b1de-5a17a3de106b"
/>
## Transaction executed by agent
Example transaction:
## Additional Notes
- The implementation follows a modular architecture as shown in the
architecture diagram
- Supports both read and write operations on the Solana blockchain
- Includes comprehensive error handling and type safety
- Provides flexible configuration through environment variables
- Project structure follows best practices with clear separation of
concerns
- Includes example queries for testing different agent pathways
## Checklist
- [x] I have tested these changes locally
- [x] I have updated the documentation
- [x] I have added a transaction link
- [x] I have added the prompt used to test it