PageSourceSearch

https://www.zerepy.org/assets/js/dcf88df3.17fda9c1.js

js zerepy.org collected 2026-10-06 07:17:50 UTC 5,783 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdocusaurus=self.webpackChunkdocusaurus||[]).push([[911],{1305:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>l,default:()=>h,frontMatter:()=>o,metadata:()=>i,toc:()=>c});const i=JSON.parse('{"id":"server-mode","title":"Server Mode","description":"ZerePy includes a powerful server mode that enables remote control and monitoring of agents through a RESTful API. This allows you to integrate ZerePy agents into larger applications or control them programmatically over HTTP.","source":"@site/docs/server-mode.md","sourceDirName":".","slug":"/server-mode","permalink":"/docs/server-mode","draft":false,"unlisted":false,"editUrl":"https://github.com/blorm-network/zerepy-docs/blob/main/docs/server-mode.md","tags":[],"version":"current","sidebarPosition":6,"frontMatter":{"sidebar_position":6},"sidebar":"tutorialSidebar","previous":{"title":"Creating Custom Agents","permalink":"/docs/create-agents"}}');var s=t(4848),r=t(8453);const o={sidebar_position:6},l="Server Mode",a={},c=[{value:"Starting the Server",id:"starting-the-server",level:2},{value:"API Endpoints",id:"api-endpoints",level:2},{value:"Python Client",id:"python-client",level:2},{value:"Use Cases",id:"use-cases",level:2},{value:"Dependencies",id:"dependencies",level:2}];function d(e){const n={code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"server-mode",children:"Server Mode"})}),"\n",(0,s.jsx)(n.p,{children:"ZerePy includes a powerful server mode that enables remote control and monitoring of agents through a RESTful API. This allows you to integrate ZerePy agents into larger applications or control them programmatically over HTTP."}),"\n",(0,s.jsx)(n.h2,{id:"starting-the-server",children:"Starting the Server"}),"\n",(0,s.jsx)(n.p,{children:"You can start ZerePy in server mode using:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"python main.py --server --host 0.0.0.0 --p
1ort 8000\n"})}),"\n",(0,s.jsx)(n.p,{children:"The server provides a REST API that exposes all core ZerePy functionality, including:"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"Agent management (listing, loading)"}),"\n",(0,s.jsx)(n.li,{children:"Connection management"}),"\n",(0,s.jsx)(n.li,{children:"Action execution"}),"\n",(0,s.jsx)(n.li,{children:"Agent lifecycle control (start/stop)"}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"api-endpoints",children:"API Endpoints"}),"\n",(0,s.jsx)(n.p,{children:"Key endpoints include:"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"GET /"})," - Server status"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"GET /agents"})," - List available agents"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"POST /agents/{name}/load"})," - Load a specific agent"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"GET /connections"})," - List available connections"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"GET /connections/{name}/actions"})," - List actions for a specific connection"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"POST /agent/action"})," - Execute a single agent action"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"POST /agent/start"})," - Start the agent loop"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"POST /agent/stop"})," - Stop the agent loop"]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"python-client",children:"Python Client"}),"\n",(0,s.jsx)(n.p,{children:"A Python client is provided for easy integration:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-python",children:'from src.server.client import ZerePyClient\n\nclient = ZerePyClient("http://localhost:8000")\n\n# List available agents\nagents = client.list_agents()\n\n# Load an agent\nclient.load_agent("example")\n\n# List connections\nconnections = client.list_connections()\n\n# Execute an action\nclient.perform_action(\n    connection="anthropic",\n    action="generate-text",\n    params=["Tell me a joke", "You are a helpful AI assistant"]\n)\n\n# Start/stop agent loop\nclient.start_agent()\nclient.stop_agent()\n'})}),"\n",(0,s.jsx)(n.h2,{id:"use-cases",children:"Use Cases"}),"\n",(0,s.jsx)(n.p,{children:"Server mode is particularly useful for:"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"Building web interfaces for agent management"}),"\n",(0,s.jsx)(n.li,{children:"Integrating agents into larger applications"}),"\n",(0,s.jsx)(n.li,{children:"Remote monitoring and control"}),"\n",(0,s.jsx)(n.li,{children:"Automated testing and deployment"}),"\n",(0,s.jsx)(n.li,{children:"Building agent networks"}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"dependencies",children:"Dependencies"}),"\n",(0,s.jsx)(n.p,{children:"Server mode requires additional dependencies which can be installed via:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"poetry install --extras server\n"})}),"\n",(0,s.jsx)(n.p,{children:"This installs FastAPI, Uvicorn, and related dependencies needed for the server functionality."})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>l});var i=t(6540);const s={},r=i.createContext(s);function o(e){const n=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.