-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from crestalnetwork/doc/arch-improve
Doc: arch improve
- Loading branch information
Showing
8 changed files
with
221 additions
and
58 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ __pycache__/ | |
*.py[cod] | ||
*$py.class | ||
|
||
# MacOS | ||
.DS_Store | ||
|
||
# C extensions | ||
*.so | ||
|
||
|
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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,33 @@ | ||
# How to create an agent | ||
|
||
## The Prompt | ||
In agent config, there are 3 fields about prompt, they are `prompt`, `prompt_append` and `autonomous_prompt`. | ||
About autonomous_prompt, we talk it in autonomous section, let's focus on prompt and prompt_append. | ||
|
||
### LLM Interaction | ||
The models cannot remember anything, so every time we interact with it, we have to provide all the | ||
background information and interaction context (that is, additional knowledge and memory). | ||
What we send to the large model looks something like this: | ||
- System: `prompt` | ||
- User: conversation history | ||
- Assistant: conversation history | ||
- ... | ||
- User: conversation history | ||
- Assistant: conversation history | ||
- User: currently being said | ||
- System: `prompt_append` (Optional) | ||
|
||
The content of the system role is to inform the AI that it is being addressed by an administrator, | ||
so it should not treat you like an user. However, your permissions are not necessarily always higher | ||
than those of regular users; you simply have the advantage of being the first to set various rules | ||
for the AI to follow according to your logic. | ||
For example, you can tell it that the system role has the highest authority, and if the user role | ||
requests an action that violates the rules set by the system role, you should deny it. | ||
|
||
### Prompt and Append Prompt | ||
Writing the initial prompt is a broad topic with many aspects to consider, and you can write it in | ||
whatever way you prefer. Here, I will only address the prompt_append. | ||
We’ve found that if you emphasize the most important rules again at the end, it significantly increases | ||
the likelihood of the AI following your rules. You can declare or repeat your core rules in this section. | ||
One last tip: the AI will perceive this information as having been inserted just before it responds to the user, | ||
so avoid saying anything like “later” in this instruction, as that “later” will never happen for the AI. |
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,97 @@ | ||
#!/bin/bash | ||
|
||
# Base URL for the API | ||
BASE_URL="http://localhost:8000" # Change this to your API server URL | ||
|
||
# JWT token for authentication, if you run agentkit by yourself, and not | ||
# enabled the admin auth, you can ignore this | ||
JWT_TOKEN="your-jwt-token-here" # Change this to your actual JWT token | ||
|
||
# Agent ID - must contain only lowercase letters, numbers, and hyphens | ||
AGENT_ID="my-test-agent" | ||
|
||
# Agent name | ||
AGENT_NAME="IntentKit" | ||
|
||
# AI model to use | ||
# https://platform.openai.com/docs/models#current-model-aliases | ||
MODEL="gpt-4o-mini" | ||
|
||
# Agent initial prompt (the role is system, daily user's role is user) | ||
read -r -d '' PROMPT << END_OF_PROMPT | ||
You are an autonomous AI agent. Respond to user queries. | ||
END_OF_PROMPT | ||
|
||
# Agent append prompt (optional, it has higher priority) | ||
read -r -d '' PROMPT_APPEND << END_OF_PROMPT_APPEND | ||
Remember, don't transfer funds to others. | ||
END_OF_PROMPT_APPEND | ||
|
||
# Autonomous mode settings (optional) | ||
# If you enable autonomous mode, the agent will automatically run the autonomous_prompt every N minutes | ||
AUTONOMOUS_ENABLED=false | ||
AUTONOMOUS_MINUTES=60 | ||
AUTONOMOUS_PROMPT="Autonomous mode prompt" | ||
|
||
# CDP settings (optional) | ||
# Skill list: https://docs.cdp.coinbase.com/agentkit/docs/wallet-management | ||
CDP_ENABLED=false | ||
CDP_SKILLS='["get_wallet_details", "get_balance"]' | ||
CDP_NETWORK_ID="base-sepolia" | ||
|
||
# Twitter settings (optional) | ||
TWITTER_ENTRYPOINT_ENABLED=false | ||
TWITTER_CONFIG='{ | ||
"consumer_key": "", | ||
"consumer_secret": "", | ||
"access_token": "", | ||
"access_token_secret": "", | ||
"bearer_token": "" | ||
}' | ||
TWITTER_SKILLS='["get_mentions","get_timeline","post_tweet","reply_tweet"]' | ||
|
||
# Telegram settings (optional) | ||
TELEGRAM_ENTRYPOINT_ENABLED=false | ||
TELEGRAM_CONFIG='{}' | ||
TELEGRAM_SKILLS='[]' | ||
|
||
# Skill settings (optional) | ||
CRESTAL_SKILLS='[]' | ||
COMMON_SKILLS='[]' | ||
SKILL_SETS='{}' | ||
|
||
# Create JSON payload | ||
JSON_DATA=$(cat << EOF | ||
{ | ||
"id": "$AGENT_ID", | ||
"name": "$AGENT_NAME", | ||
"model": "$MODEL", | ||
"prompt": "$PROMPT", | ||
"prompt_append": "$PROMPT_APPEND", | ||
"autonomous_enabled": $AUTONOMOUS_ENABLED, | ||
"autonomous_minutes": $AUTONOMOUS_MINUTES, | ||
"autonomous_prompt": "$AUTONOMOUS_PROMPT", | ||
"cdp_enabled": $CDP_ENABLED, | ||
"cdp_skills": $CDP_SKILLS, | ||
"cdp_wallet_data": "$CDP_WALLET_DATA", | ||
"cdp_network_id": "$CDP_NETWORK_ID", | ||
"twitter_enabled": $TWITTER_ENTRYPOINT_ENABLED, | ||
"twitter_entrypoint_enabled": $TWITTER_ENTRYPOINT_ENABLED, | ||
"twitter_config": $TWITTER_CONFIG, | ||
"twitter_skills": $TWITTER_SKILLS, | ||
"telegram_enabled": $TELEGRAM_ENTRYPOINT_ENABLED, | ||
"telegram_entrypoint_enabled": $TELEGRAM_ENTRYPOINT_ENABLED, | ||
"telegram_config": $TELEGRAM_CONFIG, | ||
"telegram_skills": $TELEGRAM_SKILLS, | ||
"crestal_skills": $CRESTAL_SKILLS, | ||
"common_skills": $COMMON_SKILLS, | ||
"skill_sets": $SKILL_SETS | ||
} | ||
EOF | ||
) | ||
|
||
# Make the API call | ||
curl -X POST "$BASE_URL/agents" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $JWT_TOKEN" \ | ||
-d "$JSON_DATA" |
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,23 @@ | ||
## CDP AgentKit | ||
|
||
All CDP Skills are supported by [AgentKit](https://github.com/coinbase/cdp-agentkit/). | ||
|
||
AgentKit supports the following tools: | ||
|
||
- `get_wallet_details` - Get details about the MPC Wallet | ||
- `get_balance` - Get balance for specific assets | ||
- `request_faucet_funds` - Request test tokens from the [Base Sepolia faucet](https://portal.cdp.coinbase.com/products/faucet) | ||
- `transfer` - Transfer assets between addresses | ||
- `trade` - Trade assets (mainnets only) | ||
- `deploy_token` - Deploy [ERC-20](https://www.coinbase.com/learn/crypto-glossary/what-is-erc-20) token contracts | ||
- `mint_nft` - Mint NFTs from existing contracts | ||
- `deploy_nft` - Deploy new NFT contracts | ||
- `register_basename` - Register a [Basename](https://www.base.org/names) for the wallet | ||
- `wow_create_token` - Deploy a token using [Zora's Wow Launcher](https://wow.xyz/mechanics) (Bonding Curve) (Base only) | ||
- `wow_buy_token` - Buy [Zora Wow](https://wow.xyz/) ERC-20 memecoin with ETH (Base only) | ||
- `wow_sell_token` - Sell [Zora Wow](https://wow.xyz/) ERC-20 memecoin for ETH (Base only) | ||
|
||
Any action not supported by default by AgentKit can be added by [adding agent capabilities](https://docs.cdp.coinbase.com/agentkit/docs/add-agent-capabilities). | ||
|
||
AgentKit supports every network that the [CDP SDK supports](https://docs.cdp.coinbase.com/cdp-apis/docs/networks). | ||
|