agentscope-ai / agentscope-ai/agentscope-runtime

[Feature Request] Add Agent Runner Builder Helper to simplify agentapp building process

Abierto
#306 0 comentarios 0 reacciones 1 asignado Reclamado por @rayrayraykk Ver en GitHub
Discussion enhancement
Lenguaje dominante
Python
Estrellas
863
Forks
168
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## Problem Description

Building an AgentApp currently requires writing a large amount of repetitive boilerplate code.
Even simple agent setups require manually handling:

• Engine initialization
• State service and session history setup
• Lifecycle hooks (init/shutdown)
• Query function structure
• Agent construction (model, tools, memory, formatter)
• SSE response streaming logic
• State load/save

These steps are repetitive, error‑prone, and make common scenarios unnecessarily complex.
Most developers follow nearly identical patterns, but still must write 100+ lines of setup code.

## Proposed Solution: **Runner Builder Helper**

Instead of an Agent Builder, introduce a **Runner Builder Helper**
(e.g., `AgentRunnerHelper`, `RunnerBuilder`, or `AgentRunnerBuilder`)
to encapsulate *all* the boilerplate code required to construct a fully working AgentApp and Runner.

The helper should:

• Automatically configure default services (state, session history, memory)
• Provide simple arguments or builder‑style APIs for customization (model, tools, prompts, formatter)
• Auto‑register lifecycle hooks
• Auto‑bind a standard query handler with SSE streaming enabled
• Allow overrides for advanced scenarios
• Return a fully initialized Runner, ready to `run()`

This reduces the setup to a few intuitive lines:

```python
helper = AgentRunnerHelper(
name="Friday",
model="qwen-turbo",
tools=[execute_python_code],
system_prompt="You're a helpful assistant named Friday.",
)

runner = helper.build()
app = AgentApp(runner=runner)
app.run(port=8000)
```

## What the Runner Builder Does Internally

The Runner Builder hides all complex logic that developers currently write manually.
Internally, it automatically performs:

• Creation of the Runner
• Registration of init and shutdown lifecycle hooks
• Initialization of InMemoryStateService
• Initialization of InMemorySessionHistoryService
• Construction of a ReActAgent
• Tool registration
• Binding of the default query handler
• Handling of SSE streaming output
• Loading and saving of agent state
• Construction of the Runner and returning it to the user

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.