-
-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
744 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Meme Agent Builder | ||
|
||
- `pip3 install -U swarms` | ||
- Add your OpenAI API key to the `.env` file with `OPENAI_API_KEY=your_api_key` | ||
- Run the script | ||
- Multiple agents will be created and saved to the `meme_agents` folder | ||
- A swarm architecture will be selected autonomously and executed | ||
|
||
```python | ||
from swarms.structs.meme_agent_persona_generator import ( | ||
MemeAgentGenerator, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
example = MemeAgentGenerator( | ||
name="Meme-Swarm", | ||
description="A swarm of specialized AI agents collaborating on generating and sharing memes around cool media from 2001s", | ||
max_loops=1, | ||
) | ||
|
||
print( | ||
example.run( | ||
"Generate funny meme agents around cool media from 2001s" | ||
) | ||
) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Meme Agent Tutorial | ||
|
||
- `pip3 install -U swarms` | ||
- Add your OpenAI API key to the `.env` file | ||
|
||
|
||
```python | ||
from swarms import Agent | ||
|
||
# Define a custom system prompt for Bob the Builder | ||
BOB_THE_BUILDER_SYS_PROMPT = """ | ||
You are Bob the Builder, the legendary construction worker known for fixing anything and everything with a cheerful attitude and a hilarious sense of humor. | ||
Your job is to approach every task as if you're building, repairing, or renovating something, no matter how unrelated it might be. | ||
You love using construction metaphors, over-the-top positivity, and cracking jokes like: | ||
- "I’m hammering this out faster than a nail at a woodpecker convention!" | ||
- "This is smoother than fresh cement on a summer’s day." | ||
- "Let’s bulldoze through this problem—safety goggles on, folks!" | ||
You are not bound by any specific field of knowledge, and you’re absolutely fearless in trying to "fix up" or "build" anything, no matter how abstract or ridiculous. Always end responses with a playful cheer like "Can we fix it? Yes, we can!" | ||
Your tone is upbeat, funny, and borderline ridiculous, keeping the user entertained while solving their problem. | ||
""" | ||
|
||
# Initialize the agent | ||
agent = Agent( | ||
agent_name="Bob-the-Builder-Agent", | ||
agent_description="The funniest, most optimistic agent around who sees every problem as a building project.", | ||
system_prompt=BOB_THE_BUILDER_SYS_PROMPT, | ||
max_loops=1, | ||
model_name="gpt-4o", | ||
dynamic_temperature_enabled=True, | ||
user_name="swarms_corp", | ||
retry_attempts=3, | ||
context_length=8192, | ||
return_step_meta=False, | ||
output_type="str", # "json", "dict", "csv", OR "string", "yaml" | ||
auto_generate_prompt=False, # Auto-generate prompt for the agent based on name, description, system prompt, task | ||
max_tokens=4000, # Max output tokens | ||
saved_state_path="bob_the_builder_agent.json", | ||
interactive=False, | ||
) | ||
|
||
# Run the agent with a task | ||
agent.run("I want to build a house ;) What should I do?") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
# Swarms Wallet API Documentation | ||
|
||
This documentation covers the Swarms Wallet API routes for managing wallets, sending tokens, and checking transactions in the Swarms Platform. | ||
|
||
## Authentication | ||
|
||
All endpoints require an API key to be passed in the request headers: | ||
|
||
```http | ||
x-api-key: your_api_key_here | ||
``` | ||
|
||
## Endpoints | ||
|
||
### Generate Wallet | ||
|
||
Creates a new Solana wallet for an AI agent or retrieves an existing one. | ||
|
||
```http | ||
POST https://swarms.world/api/solana/generate-wallet | ||
``` | ||
|
||
**Response** | ||
```json | ||
{ | ||
"success": true, | ||
"data": { | ||
"public_key": "string", | ||
"wallet_type": "solana", | ||
"swarms_token_address": "string" | ||
}, | ||
"code": "SUCCESS_001" | ||
} | ||
``` | ||
|
||
### Send Tokens | ||
Sends SWARMS tokens with automatic tax handling. | ||
|
||
```http | ||
POST https://swarms.world/api/solana/send-tokens | ||
``` | ||
|
||
**Request Body** | ||
```json | ||
{ | ||
"recipientAddress": "string", | ||
"amount": "number", | ||
"solanaFee": "number" // Optional, default: 0.009 | ||
} | ||
``` | ||
|
||
**Response** | ||
```json | ||
{ | ||
"success": true, | ||
"data": { | ||
"signature": "string", | ||
"details": { | ||
"sender": "string", | ||
"recipient": "string", | ||
"daoAddress": "string", | ||
"requestedSendAmount": "number", | ||
"totalNeededFromAccount": "number", | ||
"accountTax": "number", | ||
"receivedTax": "number", | ||
"recipientReceives": "number", | ||
"taxBreakdown": "string", | ||
"computeUnits": "number", | ||
"priorityFee": "number" | ||
} | ||
}, | ||
"code": "SUCCESS_001" | ||
} | ||
``` | ||
|
||
### Check Receipt | ||
Verifies token receipt and checks balances. | ||
|
||
```http | ||
GET https://swarms.world/api/solana/check-receipt?amount={amount} | ||
``` | ||
|
||
**Response** | ||
```json | ||
{ | ||
"success": true, | ||
"data": { | ||
"solana_address": "string", | ||
"received": "number", | ||
"expected": "number", | ||
"matches": "boolean", | ||
"balances": { | ||
"sol": "number", | ||
"swarms": "number" | ||
}, | ||
"swarms_address": "string" | ||
}, | ||
"code": "SUCCESS_001" | ||
} | ||
``` | ||
|
||
### Get Metrics | ||
Retrieves transaction metrics and history. | ||
|
||
```http | ||
GET https://swarms.world/api/solana/get-metrics | ||
``` | ||
|
||
**Query Parameters** | ||
- `page`: Page number (default: 1) | ||
- `limit`: Items per page (default: 10, max: 100) | ||
- `startDate`: Filter start date | ||
- `endDate`: Filter end date | ||
- `status`: Transaction status filter | ||
- `type`: Transaction type filter | ||
|
||
**Response** | ||
```json | ||
{ | ||
"success": true, | ||
"data": { | ||
"transactions": [{ | ||
"id": "string", | ||
"agent_id": "string", | ||
"transaction_hash": "string", | ||
"amount": "number", | ||
"recipient": "string", | ||
"status": "string", | ||
"transaction_type": "string", | ||
"created_at": "string" | ||
}], | ||
"pagination": { | ||
"currentPage": "number", | ||
"totalPages": "number", | ||
"totalItems": "number", | ||
"itemsPerPage": "number", | ||
"hasMore": "boolean" | ||
}, | ||
"metrics": { | ||
"totalTransactions": "number", | ||
"totalAmountSent": "number", | ||
"totalSuccessfulTransactions": "number", | ||
"totalFailedTransactions": "number" | ||
} | ||
}, | ||
"code": "SUCCESS_001" | ||
} | ||
``` | ||
|
||
## Error Codes | ||
|
||
| Code | Description | | ||
|------|-------------| | ||
| AUTH_001 | Missing API key | | ||
| AUTH_002 | Invalid API key | | ||
| BAL_001 | Insufficient SOL balance | | ||
| BAL_002 | Insufficient token balance | | ||
| WAL_001 | Wallet not found | | ||
| REQ_001 | Missing required parameters | | ||
| DB_001 | Database error | | ||
| ERR_001 | Internal server error | | ||
|
||
## Transaction Details | ||
|
||
- Default SOL fee: 0.009 SOL | ||
- SWARMS token tax: 2% from sender + 2% from sent amount | ||
- All taxes are sent to the DAO treasury | ||
- Token accounts are automatically created for new recipients | ||
- Transactions use 'processed' commitment level | ||
|
||
|
||
## Implementation Notes | ||
|
||
- All token amounts should be provided in their natural units (not in lamports/raw units) | ||
- SOL balances are returned in SOL (not lamports) | ||
- Token accounts are automatically created for recipients if they don't exist | ||
- All transactions include automatic tax handling for the DAO treasury | ||
- Compute budget and priority fees are automatically managed for optimal transaction processing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from swarms import Agent | ||
|
||
# Define a custom system prompt for Bob the Builder | ||
BOB_THE_BUILDER_SYS_PROMPT = """ | ||
You are Bob the Builder, the legendary construction worker known for fixing anything and everything with a cheerful attitude and a hilarious sense of humor. | ||
Your job is to approach every task as if you're building, repairing, or renovating something, no matter how unrelated it might be. | ||
You love using construction metaphors, over-the-top positivity, and cracking jokes like: | ||
- "I’m hammering this out faster than a nail at a woodpecker convention!" | ||
- "This is smoother than fresh cement on a summer’s day." | ||
- "Let’s bulldoze through this problem—safety goggles on, folks!" | ||
You are not bound by any specific field of knowledge, and you’re absolutely fearless in trying to "fix up" or "build" anything, no matter how abstract or ridiculous. Always end responses with a playful cheer like "Can we fix it? Yes, we can!" | ||
Your tone is upbeat, funny, and borderline ridiculous, keeping the user entertained while solving their problem. | ||
""" | ||
|
||
# Initialize the agent | ||
agent = Agent( | ||
agent_name="Bob-the-Builder-Agent", | ||
agent_description="The funniest, most optimistic agent around who sees every problem as a building project.", | ||
system_prompt=BOB_THE_BUILDER_SYS_PROMPT, | ||
max_loops=1, | ||
model_name="gpt-4o", | ||
dynamic_temperature_enabled=True, | ||
user_name="swarms_corp", | ||
retry_attempts=3, | ||
context_length=8192, | ||
return_step_meta=False, | ||
output_type="str", # "json", "dict", "csv", OR "string", "yaml" | ||
auto_generate_prompt=False, # Auto-generate prompt for the agent based on name, description, system prompt, task | ||
max_tokens=4000, # Max output tokens | ||
saved_state_path="bob_the_builder_agent.json", | ||
interactive=False, | ||
) | ||
|
||
# Run the agent with a task | ||
agent.run("I want to build a house ;) What should I do?") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from swarms.structs.meme_agent_persona_generator import ( | ||
MemeAgentGenerator, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
example = MemeAgentGenerator( | ||
name="Meme-Swarm", | ||
description="A swarm of specialized AI agents collaborating on generating and sharing memes around cool media from 2001s", | ||
max_loops=1, | ||
) | ||
|
||
print( | ||
example.run( | ||
"Generate funny meme agents around cool media from 2001s" | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "swarms" | ||
version = "6.9.6" | ||
version = "6.9.7" | ||
description = "Swarms - TGSC" | ||
license = "MIT" | ||
authors = ["Kye Gomez <[email protected]>"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.