session.Events() and separating thinking & final response
- Dominant language
- Go
- Stars
- 8.8k
- Forks
- 1k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 93
Description
When fetching a session and the event history, the responses do not contain sufficient information to discriminate between thinking output and final response intended for the user.
Code:
```go
fmt.Println("sessionChat", p.ID)
// get session
resp, err := c.runtime.s.Get(c.runtime.ctx, &session.GetRequest{
AppName: "veg",
UserID: "tony",
SessionID: p.ID,
})
if err != nil {
log.Printf("Error deleting session: %v", err)
return
}
fmt.Println("sessionChat.get", resp)
// build response
s := resp.Session
S := make(map[string]any)
S["id"] = s.ID()
S["state"] = maps.Collect(s.State().All())
S["events"] = slices.Collect(s.Events().All())
fmt.Println("mailing sessions", payload)
c.mail("session.info", S)
```
Thinking:
```json
{
"Content": {
"parts": [
{
"text": "The `lib/agent` directory contains the following:\n- `agents` (likely a directory)\n- `cmd` (likely a directory)\n- `runtime.go`\n- `tools` (likely a directory)\n- `websocket.go`\n\nTo understand what's going on, I should probably investigate the `runtime.go` and `websocket.go` files, as they seem to be source code files directly within this directory, and then potentially the `agents` and `cmd` subdirectories."
}
],
"role": "model"
},
"CitationMetadata": null,
"GroundingMetadata": null,
"UsageMetadata": {
"cacheTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 1732
}
],
"cachedContentTokenCount": 1732,
"candidatesTokenCount": 129,
"promptTokenCount": 2668,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 2668
}
],
"totalTokenCount": 2797
},
"CustomMetadata": null,
"LogprobsResult": null,
"Partial": false,
"TurnComplete": false,
"Interrupted": false,
"ErrorCode": "",
"ErrorMessage": "",
"FinishReason": "STOP",
"AvgLogprobs": 0,
"ID": "e6ca2b3d-dff5-481e-8ef6-307e28e881a5",
"Timestamp": "2025-11-18T01:29:29.718216-08:00",
"InvocationID": "e-c9945ca4-eb99-4ff3-87d6-9a8e13978a7a",
"Branch": "",
"Author": "filesys_agent",
"Actions": {
"StateDelta": {},
"ArtifactDelta": null,
"SkipSummarization": false,
"TransferToAgent": "",
"Escalate": false
},
"LongRunningToolIDs": null
}
```
Final:
```json
{
"Content": {
"parts": [
{
"text": "The \"hof project\" is about **\"hof - the higher order framework\"**, a CLI tool that unifies data models, schemas, code generation, and a task engine. It's designed to be integrated into existing workflows to:\n\n* **Augment data, configuration, and schemas with CUE** to improve consistency and unlock new possibilities.\n* **Generate multiple Yaml and JSON files** from a CUE-based source of truth.\n* **Generate much of application code**, allowing direct work in the output and regeneration without loss.\n* **Explore data or configuration** with its Terminal User Interface (TUI) in live-reload mode.\n* **Run workflows** with automatic task dependency inference.\n\nKey features include:\n* **Code generation**: Data + templates = anything, technology agnostic.\n* **Data modeling**: Define, checkpoint, and diff data models.\n* **Task engine**: Extensible task and DAG workflow engine.\n* **CUE commands**: Core `def`, `eval`, `export`, and `vet` commands.\n* **Creators**: Bootstrapping and starter kits from any repo.\n* **Modules**: CUE module dependency management.\n* **TUI**: A terminal interface to Hof and CUE.\n* **Chat**: Combine LLM and Hof code generation for better, scalable results (alpha).\n\n`hof` uses [CUE](https://cuelang.org) as its underlying technology for specifying schemas, configuration, and declarative sources of truth."
}
],
"role": "model"
},
"CitationMetadata": null,
"GroundingMetadata": null,
"UsageMetadata": {
"candidatesTokenCount": 324,
"promptTokenCount": 2323,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 2323
}
],
"thoughtsTokenCount": 409,
"totalTokenCount": 3056
},
"CustomMetadata": null,
"LogprobsResult": null,
"Partial": false,
"TurnComplete": false,
"Interrupted": false,
"ErrorCode": "",
"ErrorMessage": "",
"FinishReason": "STOP",
"AvgLogprobs": 0,
"ID": "f9f0237b-097a-4f58-bd3b-c25dcf82be4f",
"Timestamp": "2025-11-18T00:16:48.514527-08:00",
"InvocationID": "e-a7670430-d2de-4708-85bf-9ae63456fc37",
"Branch": "",
"Author": "filesys_agent",
"Actions": {
"StateDelta": {},
"ArtifactDelta": null,
"SkipSummarization": false,
"TransferToAgent": "",
"Escalate": false
},
"LongRunningToolIDs": null
}
```
Contributor guide
Assessment
This issue has not been assessed yet.