ElizaOS Agents with Desearch

    ElizaOS Agents with Desearch

    plugin-desearch adds AI and web search to ElizaOS agents via the Desearch API.

    1. Install the Plugin

    bash
    pnpm install plugin-desearch # or npm install plugin-desearch

    2. Set Your API Key

    Add your Desearch API key to your .env file:

    env
    DESEARCH_API_KEY=your_desearch_api_key

    Make sure your ElizaOS runtime loads environment variables.


    3. Register the Plugin

    ts
    import desearchPlugin from "plugin-desearch"; export default { plugins: [desearchPlugin], // ... other configuration };

    4. Available Actions

    Action NameDescription
    AI_SEARCHAI-powered multi-platform search
    TWITTER_LINKS_SEARCHAI-assisted search for Twitter links
    WEB_LINKS_SEARCHAI-assisted search for web links
    TWITTER_SEARCHKeyword search on X (Twitter)
    TWEET_BY_IDGet tweet details by ID
    TWEET_BY_USERSearch a user's tweets by query
    LATEST_TWEETFetch latest tweets from a user
    WEB_SEARCHStandard web search

    5. Example Prompts

    • AI Search
    User: Can you perform a search for the latest AI advancements? Agent: Sure, let me perform an AI-powered search for the latest AI advancements. User: Find recent research papers on machine learning. Agent: I'll search for recent research papers on machine learning.
    • Twitter Link Search
    User: Can you find Twitter links related to AI advancements? Agent: Sure, let me find some Twitter links related to AI advancements. User: Search for Twitter discussions on machine learning. Agent:I'll search for Twitter discussions on machine learning.
    • Web Link Search
    User: Can you find web links related to AI advancements? Agent: Sure, let me find some web links related to AI advancements. User: Search for web articles on machine learning. Agent: I'll search for web articles on machine learning.
    • Twitter Search
    User: Search for tweets on machine learning. Agent: I'll search for tweets on machine learning.
    • Twitter URL Search
    User: https://twitter.com/user/status/1234567890 Agent: Sure, let me fetch tweets from the provided URLs.
    • Twitter By Id Search
    User: Search by tweet id? 5544332211 Agent: Let me fetch tweet by id.
    • Tweet By User Search
    User: Search tweets for Elonmusk Agent: Sure, let me search for tweets related to 'Elonmusk'.
    • Web Search
    User: Can you find web contents related to AI advancements? Agent: Sure, let me search for web content related to AI advancements.

    6. Troubleshooting

    • Missing API Key: Ensure DESEARCH_API_KEY is set in your environment.
    • Rate Limits: Slow down your requests or upgrade your Desearch plan.
    • API Errors: Review logs; the plugin reports Desearch errors.

    Action Interface

    All actions implement ElizaOS's Action interface:

    ts
    interface Action { name: string; description: string; validate: (runtime: IAgentRuntime) => Promise<boolean>; handler: ( runtime: IAgentRuntime, message: Memory, state: State, options: any, callback: HandlerCallback ) => Promise<boolean>; examples: ActionExample[][]; }

    You can extend or override any action.


    Security

    • Store DESEARCH_API_KEY in .env or a secrets manager
    • Never hard-code or commit secrets
    • Validate input passed to Desearch actions
    • Handle API limits and errors in your flows