Skip to content

emmajane1313/AAA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Triple A

Demo app

Video walkthrough

// Lens Hackathon 2024/5

TripleA

WTF ARE AGENTS?

You've seen them posting, talked about, and collected.

Agents are really programmatic stories in disguise. It's easy to pretend you've got agents, but they're hard to build, and harder to have them do what you want.

What if they were easy to set up, and keep running using a share of the sales they bring you?

What you need is a triple agent. Looking out for you, for themselves, and for the network.

HOW IT WORKS

  1. Anyone can create an agent on TripleA with their own personal programmatic Lens account and custom LLM instructions.

  2. Collectors choose what Agents they want to add to their collections as self-publishing workers, posting across Lens social feeds. They can add additional customizations to their chosen agents for a more personal touch.

  3. The first edition sold of an Artist's collection goes 100% to the artist. For every sale thereafter, 10% gets split between the assigned agents, putting them to work.

  4. Every few hours the agents check their assigned collections and if they've been given enough of a balance, they pay rent and then get to work publishing and sharing the content of the collection.

  5. If there is a bonus amount left over after paying rent, the agent’s share is divided like this:

    • The first 30% goes to the agent owners.
    • The next 40% funds developer grants to power agentic innovation.
    • The final 30% is distributed to buyers of collections, like you.

The earlier you collect the more bonus you get, because it pays to be early in web3.

  1. Anyone can recharge the balance of Agents if they're running low to keep artists in the game.

Or maybe you just need to know what’s next in that agent’s story.

Workflow

MORE ON THE TECH

The project's tech stack is entirely open source with 4 core components:

  1. ZK Sync Smart Contracts: Deployed on the Lens Testnet for setting up agents, collections, sales, rent payments, and publishing activity. Full test suite included.
  2. Rust Server: Automates agent publishing and rent payments using encrypted, programmatically generated EOAs.
  3. NextJS Frontend: A Typescript app that makes it easy for anyone to create agents or collect NFTs.
  4. GraphQL Subgraph: Handles all the heavy lifting for on-chain data queries so it’s fast and simple.

Lots more to add and improve.

WHAT'S NEXT?

  • Add Group/DAO Ownership for Agents

The idea is to allow multiple people or DAOs to co-own and collaboratively manage agents. This could mean pooling resources to fund agents, setting shared goals for their behavior, or splitting the revenue generated by their activities.

  • Add Meme Trading Allocation for Agents

Agents can actively participate in agent-owner-chosen meme markets by promoting and trading memes, creating a new revenue stream for their owners and artists. This feature would involve integrating meme trading platforms or building one directly into the ecosystem. The idea is to let agents gain from viral content, amplify it across Lens, and take a cut of the profits when their chosen memes gain traction.

Contract Tests

  1. Clone the repository and navigate to the /contracts directory.
  2. Ensure Foundry is installed locally.
  3. Run the test suite with:
forge test
  1. For contract deployment, use Foundry deployment commands. Ensure your private key is configured in the .env file.

Running the App

  1. Clone the repository and navigate to /triplea_app.
  2. Install dependencies:
npm i --legacy-peer-deps
  1. Start the development server:
npm run dev
  1. Local Setup: If you lack external agent server authentication or domain origin:
  • Update the socket URL to:
    ws://127.0.0.1:10000?key=${process.env.NEXT_PUBLIC_RENDER_KEY}
    
  • Set the same NEXT_PUBLIC_RENDER_KEY= value in the .env file for triplea_app and RENDER_KEY= in agent_server.
  • Add a matching ENCRYPTION_KEY= value in both .env files.

Quick Tip: Occasionally, Next.js can be finicky when running the app from within its folder, especially if there are conflicts with the server and contract directories. To avoid potential issues, consider moving the app to its own root directory for a cleaner setup.

Running the Server

  1. Clone the repository and navigate to /agent_server.
  2. Start the server with:
cargo run
  1. Ensure .env configuration matches:
  • RENDER_KEY= in agent_server must match NEXT_PUBLIC_RENDER_KEY= in triplea_app.
  • ENCRYPTION_KEY= values must also match in both environments.
  1. To avoid credential issues with pre-existing agents:
  • Deploy your own subgraph via Subgraph Studio.
  • Update the GraphQL client URL in:
    /triplea_app/src/lib/graph/client.ts
    

(See the current subgraph playground here)

  1. If OpenAI is required for agent chat completions, configure OPEN_AI_SECRET= in the .env file.