MCPcopy
hub / github.com/vectorize-io/hindsight / start_server

Function start_server

hindsight-all/hindsight/server.py:220–280  ·  view source on GitHub ↗

Start a Hindsight server in a background thread. This is a convenience function that creates and starts a Server instance. Args: db_url: Database URL. Use "pg0" for embedded PostgreSQL. llm_provider: LLM provider ("groq", "openai", "ollama", "gemini", "anthropic", "lms

(
    db_url: str = "pg0",
    llm_provider: str = "groq",
    llm_api_key: str = "",
    llm_model: str = "openai/gpt-oss-120b",
    llm_base_url: Optional[str] = None,
    host: str = "127.0.0.1",
    port: Optional[int] = None,
    mcp_enabled: bool = False,
    log_level: str = "warning",
    timeout: float = 30.0,
)

Source from the content-addressed store, hash-verified

218
219
220def start_server(
221 db_url: str = "pg0",
222 llm_provider: str = "groq",
223 llm_api_key: str = "",
224 llm_model: str = "openai/gpt-oss-120b",
225 llm_base_url: Optional[str] = None,
226 host: str = "127.0.0.1",
227 port: Optional[int] = None,
228 mcp_enabled: bool = False,
229 log_level: str = "warning",
230 timeout: float = 30.0,
231) -> Server:
232 """
233 Start a Hindsight server in a background thread.
234
235 This is a convenience function that creates and starts a Server instance.
236
237 Args:
238 db_url: Database URL. Use "pg0" for embedded PostgreSQL.
239 llm_provider: LLM provider ("groq", "openai", "ollama", "gemini", "anthropic", "lmstudio")
240 llm_api_key: API key for the LLM provider
241 llm_model: Model name to use
242 llm_base_url: Optional custom base URL for LLM API
243 host: Host to bind to (default: 127.0.0.1)
244 port: Port to bind to (default: auto-select free port)
245 mcp_enabled: Whether to enable MCP server
246 log_level: Uvicorn log level (default: warning)
247 timeout: Maximum time to wait for server to start (seconds)
248
249 Returns:
250 Running Server instance
251
252 Example:
253 ```python
254 from hindsight import start_server, Client
255
256 server = start_server(
257 db_url="pg0",
258 llm_provider="groq",
259 llm_api_key="your-api-key",
260 llm_model="openai/gpt-oss-120b"
261 )
262
263 client = Client(base_url=server.url)
264 client.put(agent_id="assistant", content="User likes Python")
265
266 server.stop()
267 ```
268 """
269 server = Server(
270 db_url=db_url,
271 llm_provider=llm_provider,
272 llm_api_key=llm_api_key,
273 llm_model=llm_model,
274 llm_base_url=llm_base_url,
275 host=host,
276 port=port,
277 mcp_enabled=mcp_enabled,

Callers

nothing calls this directly

Calls 2

startMethod · 0.95
ServerClass · 0.85

Tested by

no test coverage detected