Skip to content

Commit 0dd9d8d

Browse files
authored
Merge branch 'develop' into dad-joke
2 parents f84e526 + e1b7c80 commit 0dd9d8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+4849
-6078
lines changed

.env.example

+13
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ TOGETHER_API_KEY= # Together API Key
257257
#### Crypto Plugin Configurations ####
258258
######################################
259259

260+
# CoinMarketCap / CMC
261+
COINMARKETCAP_API_KEY=
262+
263+
# CoinGecko
264+
COINGECKO_API_KEY=
265+
COINGECKO_PRO_API_KEY=
266+
260267
# EVM
261268
EVM_PRIVATE_KEY=
262269
EVM_PROVIDER_URL=
@@ -434,6 +441,8 @@ GIPHY_API_KEY=
434441
# OpenWeather
435442
OPEN_WEATHER_API_KEY= # OpenWeather API key
436443

444+
445+
437446
# EchoChambers Configuration
438447
ECHOCHAMBERS_API_URL=http://127.0.0.1:3333
439448
ECHOCHAMBERS_API_KEY=testingkey0011
@@ -467,3 +476,7 @@ TAVILY_API_KEY=
467476
# Verifiable Inference Configuration
468477
VERIFIABLE_INFERENCE_ENABLED=false # Set to false to disable verifiable inference
469478
VERIFIABLE_INFERENCE_PROVIDER=opacity # Options: opacity
479+
480+
# Autonome Configuration
481+
AUTONOME_JWT_TOKEN=
482+
AUTONOME_RPC=https://wizard-bff-rpc.alt.technology/v1/bff/aaa/apps

.github/workflows/pnpm-lockfile-check.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Pnpm Lockfile Check
22

33
on:
44
pull_request:
5-
branches: ["*"]
5+
branches: [main]
66

77
jobs:
88
check-lockfile:
@@ -38,4 +38,4 @@ jobs:
3838
owner: context.repo.owner,
3939
repo: context.repo.repo,
4040
body: '❌ The pnpm-lockfile is out of date. Please run `pnpm install --no-frozen-lockfile` and commit the updated pnpm-lock.yaml file.'
41-
})
41+
})

agent/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@
3434
"@elizaos/plugin-0g": "workspace:*",
3535
"@elizaos/plugin-abstract": "workspace:*",
3636
"@elizaos/plugin-aptos": "workspace:*",
37+
"@elizaos/plugin-coingecko": "workspace:*",
3738
"@elizaos/plugin-coinmarketcap": "workspace:*",
39+
"@elizaos/plugin-coingecko": "workspace:*",
3840
"@elizaos/plugin-binance": "workspace:*",
3941
"@elizaos/plugin-avail": "workspace:*",
4042
"@elizaos/plugin-bootstrap": "workspace:*",
4143
"@elizaos/plugin-cosmos": "workspace:*",
4244
"@elizaos/plugin-intiface": "workspace:*",
4345
"@elizaos/plugin-coinbase": "workspace:*",
44-
"@elizaos/plugin-coinprice": "workspace:*",
4546
"@elizaos/plugin-conflux": "workspace:*",
4647
"@elizaos/plugin-evm": "workspace:*",
4748
"@elizaos/plugin-echochambers": "workspace:*",
@@ -56,6 +57,7 @@
5657
"@elizaos/plugin-node": "workspace:*",
5758
"@elizaos/plugin-solana": "workspace:*",
5859
"@elizaos/plugin-solana-agentkit": "workspace:*",
60+
"@elizaos/plugin-autonome": "workspace:*",
5961
"@elizaos/plugin-starknet": "workspace:*",
6062
"@elizaos/plugin-stargaze": "workspace:*",
6163
"@elizaos/plugin-giphy": "workspace:*",
@@ -73,6 +75,7 @@
7375
"@elizaos/plugin-3d-generation": "workspace:*",
7476
"@elizaos/plugin-fuel": "workspace:*",
7577
"@elizaos/plugin-avalanche": "workspace:*",
78+
"@elizaos/plugin-video-generation": "workspace:*",
7679
"@elizaos/plugin-web-search": "workspace:*",
7780
"@elizaos/plugin-letzai": "workspace:*",
7881
"@elizaos/plugin-thirdweb": "workspace:*",
@@ -94,4 +97,4 @@
9497
"ts-node": "10.9.2",
9598
"tsup": "8.3.5"
9699
}
97-
}
100+
}

agent/src/index.ts

+49-22
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import {
5353
webhookPlugin,
5454
} from "@elizaos/plugin-coinbase";
5555
import { coinmarketcapPlugin } from "@elizaos/plugin-coinmarketcap";
56-
import { coinPricePlugin } from "@elizaos/plugin-coinprice";
56+
import { coingeckoPlugin } from "@elizaos/plugin-coingecko";
5757
import { confluxPlugin } from "@elizaos/plugin-conflux";
5858
import { createCosmosPlugin } from "@elizaos/plugin-cosmos";
5959
import { cronosZkEVMPlugin } from "@elizaos/plugin-cronoszkevm";
@@ -68,17 +68,19 @@ import { nearPlugin } from "@elizaos/plugin-near";
6868
import { nftGenerationPlugin } from "@elizaos/plugin-nft-generation";
6969
import { createNodePlugin } from "@elizaos/plugin-node";
7070
import { obsidianPlugin } from "@elizaos/plugin-obsidian";
71+
import { sgxPlugin } from "@elizaos/plugin-sgx";
7172
import { solanaPlugin } from "@elizaos/plugin-solana";
7273
import { solanaAgentkitPlguin } from "@elizaos/plugin-solana-agentkit";
74+
import { autonomePlugin } from "@elizaos/plugin-autonome";
7375
import { storyPlugin } from "@elizaos/plugin-story";
7476
import { suiPlugin } from "@elizaos/plugin-sui";
75-
import { sgxPlugin } from "@elizaos/plugin-sgx";
7677
import { TEEMode, teePlugin } from "@elizaos/plugin-tee";
7778
import { teeLogPlugin } from "@elizaos/plugin-tee-log";
7879
import { teeMarlinPlugin } from "@elizaos/plugin-tee-marlin";
7980
import { tonPlugin } from "@elizaos/plugin-ton";
8081
import { webSearchPlugin } from "@elizaos/plugin-web-search";
8182

83+
import { coingeckoPlugin } from "@elizaos/plugin-coingecko";
8284
import { giphyPlugin } from "@elizaos/plugin-giphy";
8385
import { letzAIPlugin } from "@elizaos/plugin-letzai";
8486
import { thirdwebPlugin } from "@elizaos/plugin-thirdweb";
@@ -141,10 +143,6 @@ function tryLoadFile(filePath: string): string | null {
141143
}
142144
}
143145

144-
function isAllStrings(arr: unknown[]): boolean {
145-
return Array.isArray(arr) && arr.every((item) => typeof item === "string");
146-
}
147-
148146
export async function loadCharacters(
149147
charactersArg: string
150148
): Promise<Character[]> {
@@ -230,16 +228,9 @@ export async function loadCharacters(
230228
}
231229

232230
// Handle plugins
233-
if (isAllStrings(character.plugins)) {
234-
elizaLogger.info("Plugins are: ", character.plugins);
235-
const importedPlugins = await Promise.all(
236-
character.plugins.map(async (plugin) => {
237-
const importedPlugin = await import(plugin);
238-
return importedPlugin.default;
239-
})
240-
);
241-
character.plugins = importedPlugins;
242-
}
231+
character.plugins = await handlePluginImporting(
232+
character.plugins
233+
);
243234

244235
loadedCharacters.push(character);
245236
elizaLogger.info(
@@ -262,6 +253,36 @@ export async function loadCharacters(
262253
return loadedCharacters;
263254
}
264255

256+
async function handlePluginImporting(plugins: string[]) {
257+
if (plugins.length > 0) {
258+
elizaLogger.info("Plugins are: ", plugins);
259+
const importedPlugins = await Promise.all(
260+
plugins.map(async (plugin) => {
261+
try {
262+
const importedPlugin = await import(plugin);
263+
const functionName =
264+
plugin
265+
.replace("@elizaos/plugin-", "")
266+
.replace(/-./g, (x) => x[1].toUpperCase()) +
267+
"Plugin"; // Assumes plugin function is camelCased with Plugin suffix
268+
return (
269+
importedPlugin.default || importedPlugin[functionName]
270+
);
271+
} catch (importError) {
272+
elizaLogger.error(
273+
`Failed to import plugin: ${plugin}`,
274+
importError
275+
);
276+
return []; // Return null for failed imports
277+
}
278+
})
279+
);
280+
return importedPlugins;
281+
} else {
282+
return [];
283+
}
284+
}
285+
265286
export function getTokenForProvider(
266287
provider: ModelProviderName,
267288
character: Character
@@ -608,7 +629,6 @@ export async function createAgent(
608629
? confluxPlugin
609630
: null,
610631
nodePlugin,
611-
coinPricePlugin,
612632
getSecret(character, "TAVILY_API_KEY") ? webSearchPlugin : null,
613633
getSecret(character, "SOLANA_PUBLIC_KEY") ||
614634
(getSecret(character, "WALLET_PUBLIC_KEY") &&
@@ -618,6 +638,7 @@ export async function createAgent(
618638
getSecret(character, "SOLANA_PRIVATE_KEY")
619639
? solanaAgentkitPlguin
620640
: null,
641+
getSecret(character, "AUTONOME_JWT_TOKEN") ? autonomePlugin : null,
621642
(getSecret(character, "NEAR_ADDRESS") ||
622643
getSecret(character, "NEAR_WALLET_PUBLIC_KEY")) &&
623644
getSecret(character, "NEAR_WALLET_SECRET_KEY")
@@ -668,9 +689,9 @@ export async function createAgent(
668689
: []),
669690
...(teeMode !== TEEMode.OFF && walletSecretSalt ? [teePlugin] : []),
670691
getSecret(character, "SGX") ? sgxPlugin : null,
671-
(getSecret(character, "ENABLE_TEE_LOG") &&
672-
((teeMode !== TEEMode.OFF && walletSecretSalt) ||
673-
getSecret(character, "SGX")))
692+
getSecret(character, "ENABLE_TEE_LOG") &&
693+
((teeMode !== TEEMode.OFF && walletSecretSalt) ||
694+
getSecret(character, "SGX"))
674695
? teeLogPlugin
675696
: null,
676697
getSecret(character, "COINBASE_API_KEY") &&
@@ -679,7 +700,10 @@ export async function createAgent(
679700
? webhookPlugin
680701
: null,
681702
goatPlugin,
682-
getSecret(character, "COINGECKO_API_KEY") ? coingeckoPlugin : null,
703+
getSecret(character, "COINGECKO_API_KEY") ||
704+
getSecret(character, "COINGECKO_PRO_API_KEY")
705+
? coingeckoPlugin
706+
: null,
683707
getSecret(character, "EVM_PROVIDER_URL") ? goatPlugin : null,
684708
getSecret(character, "ABSTRACT_PRIVATE_KEY")
685709
? abstractPlugin
@@ -918,7 +942,10 @@ const startAgents = async () => {
918942
}
919943

920944
// upload some agent functionality into directClient
921-
directClient.startAgent = async (character: Character) => {
945+
directClient.startAgent = async (character) => {
946+
// Handle plugins
947+
character.plugins = await handlePluginImporting(character.plugins);
948+
922949
// wrap it so we don't have to inject directClient later
923950
return startAgent(character, directClient);
924951
};
+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
sidebar_position: 18
3+
---
4+
5+
# 🪪 Verified Inference
6+
7+
## Overview
8+
9+
With verified inference, you can turn your Eliza agent fully verifiable on-chain on Solana with an OpenAI compatible TEE API. This proves that your agent’s thoughts and outputs are free from human control thus increasing the trust of the agent.
10+
11+
Compared to [fully deploying the agent in a TEE](https://elizaos.github.io/eliza/docs/advanced/eliza-in-tee/), this is a more light-weight solution which only verifies the inference calls and only needs a single line of code change.
12+
13+
The API supports all OpenAI models out of the box, including your fine-tuned models. The following guide will walk you through how to use verified inference API with Eliza.
14+
15+
## Background
16+
17+
The API is built on top of [Sentience Stack](https://github.com/galadriel-ai/Sentience), which cryptographically verifies agent's LLM inferences inside TEEs, posts those proofs on-chain on Solana, and makes the verified inference logs available to read and display to users.
18+
19+
Here’s how it works:
20+
![](https://i.imgur.com/SNwSHam.png)
21+
22+
1. The agent sends a request containing a message with the desired LLM model to the TEE.
23+
2. The TEE securely processes the request by calling the LLM API.
24+
3. The TEE sends back the `{Message, Proof}` to the agent.
25+
4. The TEE submits the attestation with `{Message, Proof}` to Solana.
26+
5. The Proof of Sentience SDK is used to read the attestation from Solana and verify it with `{Message, Proof}`. The proof log can be added to the agent website/app.
27+
28+
To verify the code running inside the TEE, use instructions [from here](https://github.com/galadriel-ai/sentience/tree/main/verified-inference/verify).
29+
30+
## Tutorial
31+
32+
1. **Create a free API key on [Galadriel dashboard](https://dashboard.galadriel.com/login)**
33+
2. **Configure the environment variables**
34+
```bash
35+
GALADRIEL_API_KEY=gal-* # Get from https://dashboard.galadriel.com/
36+
# Use any model supported by OpenAI
37+
SMALL_GALADRIEL_MODEL= # Default: gpt-4o-mini
38+
MEDIUM_GALADRIEL_MODEL= # Default: gpt-4o
39+
LARGE_GALADRIEL_MODEL= # Default: gpt-4o
40+
# If you wish to use a fine-tuned model you will need to provide your own OpenAI API key
41+
GALADRIEL_FINE_TUNE_API_KEY= # starting with sk-
42+
```
43+
3. **Configure your character to use `galadriel`**
44+
45+
In your character file set the `modelProvider` as `galadriel`.
46+
```
47+
"modelProvider": "galadriel"
48+
```
49+
4. **Run your agent.**
50+
51+
Reminder how to run an agent is [here](https://elizaos.github.io/eliza/docs/quickstart/#create-your-first-agent).
52+
```bash
53+
pnpm start --character="characters/<your_character>.json"
54+
pnpm start:client
55+
```
56+
5. **Get the history of all of your verified inference calls**
57+
```javascript
58+
const url = 'https://api.galadriel.com/v1/verified/chat/completions?limit=100&filter=mine';
59+
const headers = {
60+
'accept': 'application/json',
61+
'Authorization': 'Bearer <GALADRIEL_API_KEY>'// Replace with your Galadriel API key
62+
};
63+
64+
const response = await fetch(url, { method: 'GET', headers });
65+
const data = await response.json();
66+
console.log(data);
67+
```
68+
69+
Use this to build a verified logs terminal to your agent front end, for example:
70+
![](https://i.imgur.com/yejIlao.png)
71+
72+
6. **Check your inferences in the explorer.**
73+
74+
You can also see your inferences with proofs in the [Galadriel explorer](https://explorer.galadriel.com/). For specific inference responses use `https://explorer.galadriel.com/details/<hash>`
75+
76+
The `hash` param is returned with every inference request.
77+
![](https://i.imgur.com/QazDxbE.png)
78+
79+
7. **Check proofs posted on Solana.**
80+
81+
You can also see your inferences with proofs on Solana. For specific inference responses: `https://explorer.solana.com/tx/<>tx_hash?cluster=devnet`
82+
83+
The `tx_hash` param is returned with every inference request.

0 commit comments

Comments
 (0)