Nostr Agent Server¶
The NostrAgentServer
class provides a high-level interface for running a Nostr agent as a networked server. It manages the connection to the Nostr network, listens for incoming direct messages, and delegates them to the agent for processing.
Usage¶
import asyncio
from agentstr import NostrAgent, NostrAgentServer
# Initialize the Nostr agent
nostr_agent = NostrAgent(...)
# Create and run the server
async def main():
server = NostrAgentServer(nostr_agent=nostr_agent)
await server.start()
if __name__ == "__main__":
asyncio.run(main())
Note
See Nostr Agent for information on how to create an agent.
Reference¶
See Also¶
Agentstr Agent — for a high-level interface to run an agent on Nostr.
Nostr Agent — for adapting an agent to the Nostr protocol.
Agents — for an overview of all agentic components in the Agentstr SDK.