vibecore 0.2.0__tar.gz → 0.3.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of vibecore might be problematic. Click here for more details.

Files changed (75) hide show
  1. {vibecore-0.2.0 → vibecore-0.3.0b1}/PKG-INFO +106 -1
  2. {vibecore-0.2.0 → vibecore-0.3.0b1}/README.md +103 -0
  3. {vibecore-0.2.0 → vibecore-0.3.0b1}/pyproject.toml +3 -1
  4. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/agents/default.py +6 -11
  5. vibecore-0.2.0/src/vibecore/agents/task_agent.py → vibecore-0.3.0b1/src/vibecore/agents/task.py +2 -6
  6. vibecore-0.3.0b1/src/vibecore/flow.py +105 -0
  7. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/main.py +28 -6
  8. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/settings.py +28 -3
  9. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/task/executor.py +1 -1
  10. vibecore-0.3.0b1/src/vibecore/tools/webfetch/__init__.py +7 -0
  11. vibecore-0.3.0b1/src/vibecore/tools/webfetch/executor.py +127 -0
  12. vibecore-0.3.0b1/src/vibecore/tools/webfetch/models.py +22 -0
  13. vibecore-0.3.0b1/src/vibecore/tools/webfetch/tools.py +46 -0
  14. vibecore-0.3.0b1/src/vibecore/tools/websearch/__init__.py +5 -0
  15. vibecore-0.3.0b1/src/vibecore/tools/websearch/base.py +27 -0
  16. vibecore-0.3.0b1/src/vibecore/tools/websearch/ddgs/__init__.py +5 -0
  17. vibecore-0.3.0b1/src/vibecore/tools/websearch/ddgs/backend.py +64 -0
  18. vibecore-0.3.0b1/src/vibecore/tools/websearch/executor.py +43 -0
  19. vibecore-0.3.0b1/src/vibecore/tools/websearch/models.py +20 -0
  20. vibecore-0.3.0b1/src/vibecore/tools/websearch/tools.py +49 -0
  21. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/widgets/tool_message_factory.py +16 -0
  22. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/widgets/tool_messages.py +117 -0
  23. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/widgets/tool_messages.tcss +48 -0
  24. {vibecore-0.2.0 → vibecore-0.3.0b1}/.gitignore +0 -0
  25. {vibecore-0.2.0 → vibecore-0.3.0b1}/LICENSE +0 -0
  26. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/__init__.py +0 -0
  27. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/agents/prompts.py +0 -0
  28. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/cli.py +0 -0
  29. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/context.py +0 -0
  30. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/handlers/__init__.py +0 -0
  31. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/handlers/stream_handler.py +0 -0
  32. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/main.tcss +0 -0
  33. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/mcp/__init__.py +0 -0
  34. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/mcp/manager.py +0 -0
  35. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/mcp/server_wrapper.py +0 -0
  36. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/models/__init__.py +0 -0
  37. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/models/anthropic.py +0 -0
  38. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/prompts/common_system_prompt.txt +0 -0
  39. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/py.typed +0 -0
  40. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/session/__init__.py +0 -0
  41. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/session/file_lock.py +0 -0
  42. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/session/jsonl_session.py +0 -0
  43. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/session/loader.py +0 -0
  44. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/session/path_utils.py +0 -0
  45. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/__init__.py +0 -0
  46. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/base.py +0 -0
  47. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/file/__init__.py +0 -0
  48. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/file/executor.py +0 -0
  49. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/file/tools.py +0 -0
  50. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/file/utils.py +0 -0
  51. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/python/__init__.py +0 -0
  52. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/python/backends/__init__.py +0 -0
  53. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/python/backends/terminal_backend.py +0 -0
  54. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/python/helpers.py +0 -0
  55. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/python/manager.py +0 -0
  56. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/python/tools.py +0 -0
  57. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/shell/__init__.py +0 -0
  58. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/shell/executor.py +0 -0
  59. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/shell/tools.py +0 -0
  60. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/task/__init__.py +0 -0
  61. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/task/tools.py +0 -0
  62. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/todo/__init__.py +0 -0
  63. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/todo/manager.py +0 -0
  64. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/todo/models.py +0 -0
  65. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/tools/todo/tools.py +0 -0
  66. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/utils/__init__.py +0 -0
  67. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/utils/text.py +0 -0
  68. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/widgets/core.py +0 -0
  69. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/widgets/core.tcss +0 -0
  70. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/widgets/expandable.py +0 -0
  71. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/widgets/expandable.tcss +0 -0
  72. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/widgets/info.py +0 -0
  73. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/widgets/info.tcss +0 -0
  74. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/widgets/messages.py +0 -0
  75. {vibecore-0.2.0 → vibecore-0.3.0b1}/src/vibecore/widgets/messages.tcss +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vibecore
3
- Version: 0.2.0
3
+ Version: 0.3.0b1
4
4
  Summary: Build your own AI-powered automation tools in the terminal with this extensible agent framework
5
5
  Project-URL: Homepage, https://github.com/serialx/vibecore
6
6
  Project-URL: Repository, https://github.com/serialx/vibecore
@@ -27,6 +27,8 @@ Classifier: Topic :: Terminals
27
27
  Classifier: Topic :: Text Processing :: Linguistic
28
28
  Classifier: Typing :: Typed
29
29
  Requires-Python: >=3.11
30
+ Requires-Dist: ddgs>=9.5.4
31
+ Requires-Dist: html2text>=2024.2.26
30
32
  Requires-Dist: litellm>=1.72.4
31
33
  Requires-Dist: openai-agents[litellm]>=0.2.2
32
34
  Requires-Dist: pydantic-settings>=2.10.1
@@ -65,6 +67,7 @@ Built on [Textual](https://textual.textualize.io/) and the [OpenAI Agents SDK](h
65
67
 
66
68
  ### Key Features
67
69
 
70
+ - **Flow Mode (Experimental)** - Build structured agent-based applications with programmatic conversation control
68
71
  - **AI-Powered Chat Interface** - Interact with state-of-the-art language models through an intuitive terminal interface
69
72
  - **Rich Tool Integration** - Built-in tools for file operations, shell commands, Python execution, and task management
70
73
  - **MCP Support** - Connect to external tools and services via Model Context Protocol servers
@@ -79,6 +82,26 @@ Built on [Textual](https://textual.textualize.io/) and the [OpenAI Agents SDK](h
79
82
  ### Prerequisites
80
83
 
81
84
  - Python 3.11 or higher
85
+ - (Optional) [uv](https://docs.astral.sh/uv/) for quick testing and better package management
86
+
87
+ ### Quick Test (No Installation)
88
+
89
+ Try vibecore instantly without installing it:
90
+
91
+ ```bash
92
+ # Install uv if you don't have it (optional)
93
+ curl -LsSf https://astral.sh/uv/install.sh | sh
94
+
95
+ # Configure your API key
96
+ export ANTHROPIC_API_KEY="your-api-key-here"
97
+ # or
98
+ export OPENAI_API_KEY="your-api-key-here"
99
+
100
+ # Run vibecore directly with uvx
101
+ uvx vibecore
102
+ ```
103
+
104
+ This will download and run vibecore in an isolated environment without affecting your system Python installation.
82
105
 
83
106
  ### Install from PyPI
84
107
 
@@ -136,6 +159,88 @@ Once vibecore is running, you can:
136
159
  - `/help` - Show help and keyboard shortcuts
137
160
  - `/clear` - Clear the current session and start a new one
138
161
 
162
+ ## Flow Mode (Experimental)
163
+
164
+ Flow Mode is vibecore's **key differentiator** - it transforms the framework from a chat interface into a platform for building structured agent-based applications with programmatic conversation control.
165
+
166
+ ### What is Flow Mode?
167
+
168
+ Flow Mode allows you to:
169
+ - **Define custom conversation logic** that controls how agents process user input
170
+ - **Build multi-step workflows** with defined sequences and decision points
171
+ - **Orchestrate multiple agents** with handoffs and shared context
172
+ - **Maintain conversation state** across interactions
173
+ - **Create agent-based applications** rather than just chatbots
174
+
175
+ ### Example: Simple Flow
176
+
177
+ ```python
178
+ import asyncio
179
+ from agents import Agent, Runner
180
+ from vibecore.flow import flow, UserInputFunc
181
+ from vibecore.context import VibecoreContext
182
+
183
+ # Define your agent with tools
184
+ agent = Agent[VibecoreContext](
185
+ name="Assistant",
186
+ instructions="You are a helpful assistant",
187
+ tools=[...], # Your tools here
188
+ )
189
+
190
+ # Define your conversation logic
191
+ async def logic(app, ctx: VibecoreContext, user_input: UserInputFunc):
192
+ # Get user input programmatically
193
+ user_message = await user_input("What would you like to do?")
194
+
195
+ # Process with agent
196
+ result = Runner.run_streamed(
197
+ agent,
198
+ input=user_message,
199
+ context=ctx,
200
+ session=app.session,
201
+ )
202
+
203
+ # Handle the response
204
+ app.current_worker = app.handle_streamed_response(result)
205
+ await app.current_worker.wait()
206
+
207
+ # Run the flow
208
+ async def main():
209
+ await flow(agent, logic)
210
+
211
+ if __name__ == "__main__":
212
+ asyncio.run(main())
213
+ ```
214
+
215
+ ### Example: Multi-Agent Customer Service
216
+
217
+ Flow Mode shines when building complex multi-agent systems. See `examples/customer_service.py` for a complete implementation featuring:
218
+
219
+ - **Triage Agent**: Routes requests to appropriate specialists
220
+ - **FAQ Agent**: Handles frequently asked questions
221
+ - **Booking Agent**: Manages seat reservations
222
+ - **Agent Handoffs**: Seamless transitions between agents with context preservation
223
+ - **Shared State**: Maintains customer information across the conversation
224
+
225
+ ### Key Components
226
+
227
+ - **`flow()`**: Entry point that sets up the Vibecore app with your custom logic
228
+ - **`logic()`**: Your async function that controls the conversation flow
229
+ - **`UserInputFunc`**: Provides programmatic user input collection
230
+ - **`VibecoreContext`**: Shared state across tools and agents
231
+ - **Agent Handoffs**: Transfer control between specialized agents
232
+
233
+ ### Use Cases
234
+
235
+ Flow Mode enables building:
236
+ - **Customer service systems** with routing and escalation
237
+ - **Guided workflows** for complex tasks
238
+ - **Interactive tutorials** with step-by-step guidance
239
+ - **Task automation** with human-in-the-loop controls
240
+ - **Multi-stage data processing** pipelines
241
+
242
+ The examples in the `examples/` directory are adapted from the official OpenAI Agents SDK with minimal modifications, demonstrating how easily you can build sophisticated agent applications with vibecore.
243
+
139
244
  ### Available Tools
140
245
 
141
246
  vibecore comes with powerful built-in tools:
@@ -29,6 +29,7 @@ Built on [Textual](https://textual.textualize.io/) and the [OpenAI Agents SDK](h
29
29
 
30
30
  ### Key Features
31
31
 
32
+ - **Flow Mode (Experimental)** - Build structured agent-based applications with programmatic conversation control
32
33
  - **AI-Powered Chat Interface** - Interact with state-of-the-art language models through an intuitive terminal interface
33
34
  - **Rich Tool Integration** - Built-in tools for file operations, shell commands, Python execution, and task management
34
35
  - **MCP Support** - Connect to external tools and services via Model Context Protocol servers
@@ -43,6 +44,26 @@ Built on [Textual](https://textual.textualize.io/) and the [OpenAI Agents SDK](h
43
44
  ### Prerequisites
44
45
 
45
46
  - Python 3.11 or higher
47
+ - (Optional) [uv](https://docs.astral.sh/uv/) for quick testing and better package management
48
+
49
+ ### Quick Test (No Installation)
50
+
51
+ Try vibecore instantly without installing it:
52
+
53
+ ```bash
54
+ # Install uv if you don't have it (optional)
55
+ curl -LsSf https://astral.sh/uv/install.sh | sh
56
+
57
+ # Configure your API key
58
+ export ANTHROPIC_API_KEY="your-api-key-here"
59
+ # or
60
+ export OPENAI_API_KEY="your-api-key-here"
61
+
62
+ # Run vibecore directly with uvx
63
+ uvx vibecore
64
+ ```
65
+
66
+ This will download and run vibecore in an isolated environment without affecting your system Python installation.
46
67
 
47
68
  ### Install from PyPI
48
69
 
@@ -100,6 +121,88 @@ Once vibecore is running, you can:
100
121
  - `/help` - Show help and keyboard shortcuts
101
122
  - `/clear` - Clear the current session and start a new one
102
123
 
124
+ ## Flow Mode (Experimental)
125
+
126
+ Flow Mode is vibecore's **key differentiator** - it transforms the framework from a chat interface into a platform for building structured agent-based applications with programmatic conversation control.
127
+
128
+ ### What is Flow Mode?
129
+
130
+ Flow Mode allows you to:
131
+ - **Define custom conversation logic** that controls how agents process user input
132
+ - **Build multi-step workflows** with defined sequences and decision points
133
+ - **Orchestrate multiple agents** with handoffs and shared context
134
+ - **Maintain conversation state** across interactions
135
+ - **Create agent-based applications** rather than just chatbots
136
+
137
+ ### Example: Simple Flow
138
+
139
+ ```python
140
+ import asyncio
141
+ from agents import Agent, Runner
142
+ from vibecore.flow import flow, UserInputFunc
143
+ from vibecore.context import VibecoreContext
144
+
145
+ # Define your agent with tools
146
+ agent = Agent[VibecoreContext](
147
+ name="Assistant",
148
+ instructions="You are a helpful assistant",
149
+ tools=[...], # Your tools here
150
+ )
151
+
152
+ # Define your conversation logic
153
+ async def logic(app, ctx: VibecoreContext, user_input: UserInputFunc):
154
+ # Get user input programmatically
155
+ user_message = await user_input("What would you like to do?")
156
+
157
+ # Process with agent
158
+ result = Runner.run_streamed(
159
+ agent,
160
+ input=user_message,
161
+ context=ctx,
162
+ session=app.session,
163
+ )
164
+
165
+ # Handle the response
166
+ app.current_worker = app.handle_streamed_response(result)
167
+ await app.current_worker.wait()
168
+
169
+ # Run the flow
170
+ async def main():
171
+ await flow(agent, logic)
172
+
173
+ if __name__ == "__main__":
174
+ asyncio.run(main())
175
+ ```
176
+
177
+ ### Example: Multi-Agent Customer Service
178
+
179
+ Flow Mode shines when building complex multi-agent systems. See `examples/customer_service.py` for a complete implementation featuring:
180
+
181
+ - **Triage Agent**: Routes requests to appropriate specialists
182
+ - **FAQ Agent**: Handles frequently asked questions
183
+ - **Booking Agent**: Manages seat reservations
184
+ - **Agent Handoffs**: Seamless transitions between agents with context preservation
185
+ - **Shared State**: Maintains customer information across the conversation
186
+
187
+ ### Key Components
188
+
189
+ - **`flow()`**: Entry point that sets up the Vibecore app with your custom logic
190
+ - **`logic()`**: Your async function that controls the conversation flow
191
+ - **`UserInputFunc`**: Provides programmatic user input collection
192
+ - **`VibecoreContext`**: Shared state across tools and agents
193
+ - **Agent Handoffs**: Transfer control between specialized agents
194
+
195
+ ### Use Cases
196
+
197
+ Flow Mode enables building:
198
+ - **Customer service systems** with routing and escalation
199
+ - **Guided workflows** for complex tasks
200
+ - **Interactive tutorials** with step-by-step guidance
201
+ - **Task automation** with human-in-the-loop controls
202
+ - **Multi-stage data processing** pipelines
203
+
204
+ The examples in the `examples/` directory are adapted from the official OpenAI Agents SDK with minimal modifications, demonstrating how easily you can build sophisticated agent applications with vibecore.
205
+
103
206
  ### Available Tools
104
207
 
105
208
  vibecore comes with powerful built-in tools:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "vibecore"
3
- version = "0.2.0"
3
+ version = "0.3.0b1"
4
4
  description = "Build your own AI-powered automation tools in the terminal with this extensible agent framework"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -44,6 +44,8 @@ classifiers = [
44
44
  "Typing :: Typed",
45
45
  ]
46
46
  dependencies = [
47
+ "ddgs>=9.5.4",
48
+ "html2text>=2024.2.26",
47
49
  "litellm>=1.72.4",
48
50
  "openai-agents[litellm]>=0.2.2",
49
51
  "pydantic-settings>=2.10.1",
@@ -1,8 +1,7 @@
1
1
  from typing import TYPE_CHECKING
2
2
 
3
- from agents import Agent, ModelSettings
3
+ from agents import Agent
4
4
  from agents.extensions.handoff_prompt import prompt_with_handoff_instructions
5
- from openai.types import Reasoning
6
5
 
7
6
  from vibecore.context import VibecoreContext
8
7
  from vibecore.settings import settings
@@ -11,6 +10,8 @@ from vibecore.tools.python.tools import execute_python
11
10
  from vibecore.tools.shell.tools import bash, glob, grep, ls
12
11
  from vibecore.tools.task.tools import task
13
12
  from vibecore.tools.todo.tools import todo_read, todo_write
13
+ from vibecore.tools.webfetch.tools import webfetch
14
+ from vibecore.tools.websearch.tools import websearch
14
15
 
15
16
  from .prompts import COMMON_PROMPT
16
17
 
@@ -50,26 +51,20 @@ def create_default_agent(mcp_servers: list["MCPServer"] | None = None) -> Agent[
50
51
  grep,
51
52
  ls,
52
53
  task,
54
+ websearch,
55
+ webfetch,
53
56
  ]
54
57
  instructions = INSTRUCTIONS
55
58
 
56
59
  instructions = prompt_with_handoff_instructions(instructions)
57
60
 
58
- # Configure reasoning based on settings
59
- reasoning_config = Reasoning(summary="auto")
60
- if settings.reasoning_effort is not None:
61
- reasoning_config = Reasoning(effort=settings.reasoning_effort, summary="auto")
62
-
63
61
  return Agent[VibecoreContext](
64
62
  name="Vibecore Agent",
65
63
  handoff_description="A versatile general-purpose assistant",
66
64
  instructions=instructions,
67
65
  tools=tools,
68
66
  model=settings.model,
69
- model_settings=ModelSettings(
70
- include_usage=True, # Ensure token usage is tracked in streaming mode
71
- reasoning=reasoning_config,
72
- ),
67
+ model_settings=settings.default_model_settings,
73
68
  handoffs=[],
74
69
  mcp_servers=mcp_servers or [],
75
70
  )
@@ -1,8 +1,7 @@
1
1
  """Task-specific agent configuration for executing delegated tasks."""
2
2
 
3
- from agents import Agent, ModelSettings
3
+ from agents import Agent
4
4
  from agents.extensions.handoff_prompt import prompt_with_handoff_instructions
5
- from openai.types import Reasoning
6
5
 
7
6
  from vibecore.context import VibecoreContext
8
7
  from vibecore.settings import settings
@@ -58,9 +57,6 @@ def create_task_agent(prompt: str) -> Agent[VibecoreContext]:
58
57
  instructions=instructions,
59
58
  tools=tools,
60
59
  model=settings.model,
61
- model_settings=ModelSettings(
62
- include_usage=True, # Ensure token usage is tracked in streaming mode
63
- reasoning=Reasoning(summary="auto"),
64
- ),
60
+ model_settings=settings.default_model_settings,
65
61
  handoffs=[],
66
62
  )
@@ -0,0 +1,105 @@
1
+ import asyncio
2
+ import threading
3
+ from collections.abc import Callable, Coroutine
4
+ from typing import Protocol
5
+
6
+ from agents import Agent
7
+ from textual.pilot import Pilot
8
+
9
+ from vibecore.context import VibecoreContext
10
+ from vibecore.main import AppIsExiting, VibecoreApp
11
+ from vibecore.widgets.core import MyTextArea
12
+ from vibecore.widgets.messages import SystemMessage
13
+
14
+
15
+ class UserInputFunc(Protocol):
16
+ """Protocol for user input function with optional prompt parameter."""
17
+
18
+ async def __call__(self, prompt: str = "") -> str:
19
+ """Get user input with optional prompt message.
20
+
21
+ Args:
22
+ prompt: Optional prompt to display before getting input.
23
+
24
+ Returns:
25
+ The user's input string.
26
+ """
27
+ ...
28
+
29
+
30
+ async def flow(
31
+ agent: Agent,
32
+ logic: Callable[[VibecoreApp, VibecoreContext, UserInputFunc], Coroutine],
33
+ headless: bool = False,
34
+ shutdown: bool = False,
35
+ disable_user_input: bool = True,
36
+ ):
37
+ ctx = VibecoreContext()
38
+ app = VibecoreApp(ctx, agent, show_welcome=False)
39
+
40
+ app_ready_event = asyncio.Event()
41
+
42
+ def on_app_ready() -> None:
43
+ """Called when app is ready to process events."""
44
+ app_ready_event.set()
45
+
46
+ async def run_app(app: VibecoreApp) -> None:
47
+ """Run the apps message loop.
48
+
49
+ Args:
50
+ app: App to run.
51
+ """
52
+
53
+ with app._context():
54
+ try:
55
+ app._loop = asyncio.get_running_loop()
56
+ app._thread_id = threading.get_ident()
57
+ await app._process_messages(
58
+ ready_callback=on_app_ready,
59
+ headless=headless,
60
+ )
61
+ finally:
62
+ app_ready_event.set()
63
+
64
+ async def user_input(prompt: str = "") -> str:
65
+ if prompt:
66
+ await app.add_message(SystemMessage(prompt))
67
+ app.query_one(MyTextArea).disabled = False
68
+ app.query_one(MyTextArea).focus()
69
+ user_input = await app.wait_for_user_input()
70
+ if disable_user_input:
71
+ app.query_one(MyTextArea).disabled = True
72
+ return user_input
73
+
74
+ async def run_logic(app: VibecoreApp, ctx: VibecoreContext, user_input: UserInputFunc) -> None:
75
+ try:
76
+ await logic(app, ctx, user_input)
77
+ except AppIsExiting:
78
+ return
79
+
80
+ app_task = asyncio.create_task(run_app(app), name=f"with_app({app})")
81
+ await app_ready_event.wait()
82
+ pilot = Pilot(app)
83
+ logic_task: asyncio.Task | None = None
84
+
85
+ await pilot._wait_for_screen()
86
+ if disable_user_input:
87
+ app.query_one(MyTextArea).disabled = True
88
+ logic_task = asyncio.create_task(run_logic(app, ctx, user_input), name="logic_task")
89
+ done, pending = await asyncio.wait([logic_task, app_task], return_when=asyncio.FIRST_COMPLETED)
90
+
91
+ # If app has exited and logic is still running, cancel logic
92
+ if app_task in done and logic_task in pending:
93
+ logic_task.cancel()
94
+ # If logic is finished and app is still running
95
+ elif logic_task in done and app_task in pending:
96
+ if shutdown:
97
+ if not headless:
98
+ await pilot._wait_for_screen()
99
+ await asyncio.sleep(1.0)
100
+ app.exit()
101
+ else:
102
+ # Enable text input so users can interact freely
103
+ app.query_one(MyTextArea).disabled = False
104
+ # Wait until app is exited
105
+ await app_task
@@ -30,7 +30,11 @@ from vibecore.widgets.core import AppFooter, MainScroll, MyTextArea
30
30
  from vibecore.widgets.info import Welcome
31
31
  from vibecore.widgets.messages import AgentMessage, BaseMessage, MessageStatus, SystemMessage, UserMessage
32
32
 
33
- AgentStatus = Literal["idle", "running"]
33
+ AgentStatus = Literal["idle", "running", "waiting_user_input"]
34
+
35
+
36
+ class AppIsExiting(Exception):
37
+ pass
34
38
 
35
39
 
36
40
  def detect_reasoning_effort(prompt: str) -> Literal["low", "medium", "high"] | None:
@@ -82,6 +86,7 @@ class VibecoreApp(App):
82
86
  agent: Agent,
83
87
  session_id: str | None = None,
84
88
  print_mode: bool = False,
89
+ show_welcome: bool = True,
85
90
  ) -> None:
86
91
  """Initialize the Vibecore app with context and agent.
87
92
 
@@ -90,6 +95,7 @@ class VibecoreApp(App):
90
95
  agent: The Agent instance to use
91
96
  session_id: Optional session ID to load existing session
92
97
  print_mode: Whether to run in print mode (useful for pipes)
98
+ show_welcome: Whether to show the welcome message (default: True)
93
99
  """
94
100
  self.context = context
95
101
  self.context.app = self # Set the app reference in context
@@ -99,6 +105,7 @@ class VibecoreApp(App):
99
105
  self.current_worker: Worker[None] | None = None
100
106
  self._session_id_provided = session_id is not None # Track if continuing session
101
107
  self.print_mode = print_mode
108
+ self.show_welcome = show_welcome
102
109
  self.message_queue: deque[str] = deque() # Queue for user messages
103
110
 
104
111
  # Initialize session based on settings
@@ -124,7 +131,8 @@ class VibecoreApp(App):
124
131
  yield Header()
125
132
  yield AppFooter()
126
133
  with MainScroll(id="messages"):
127
- yield Welcome()
134
+ if self.show_welcome:
135
+ yield Welcome()
128
136
 
129
137
  async def on_mount(self) -> None:
130
138
  """Called when the app is mounted."""
@@ -162,6 +170,8 @@ class VibecoreApp(App):
162
170
  Args:
163
171
  message: The message to add
164
172
  """
173
+ if not self.is_running:
174
+ raise AppIsExiting("App is not running")
165
175
  main_scroll = self.query_one("#messages", MainScroll)
166
176
  await main_scroll.mount(message)
167
177
 
@@ -225,6 +235,14 @@ class VibecoreApp(App):
225
235
  else:
226
236
  footer.hide_loading()
227
237
 
238
+ async def wait_for_user_input(self) -> str:
239
+ """Used in flow mode. See examples/basic_agent.py"""
240
+ self.agent_status = "waiting_user_input"
241
+ self.user_input_event = asyncio.Event()
242
+ await self.user_input_event.wait()
243
+ user_input = self.message_queue.pop()
244
+ return user_input
245
+
228
246
  async def on_my_text_area_user_message(self, event: MyTextArea.UserMessage) -> None:
229
247
  """Handle user messages from the text area."""
230
248
  if event.text:
@@ -248,8 +266,11 @@ class VibecoreApp(App):
248
266
  await self.add_message(user_message)
249
267
  user_message.scroll_visible()
250
268
 
251
- # If agent is running, queue the message
269
+ if self.agent_status == "waiting_user_input":
270
+ self.message_queue.append(event.text)
271
+ self.user_input_event.set()
252
272
  if self.agent_status == "running":
273
+ # If agent is running, queue the message
253
274
  self.message_queue.append(event.text)
254
275
  log(f"Message queued: {event.text}")
255
276
  footer = self.query_one(AppFooter)
@@ -268,7 +289,7 @@ class VibecoreApp(App):
268
289
  if reasoning_effort is not None:
269
290
  # Create a copy of the agent with updated model settings
270
291
  current_settings = self.agent.model_settings or ModelSettings()
271
- new_reasoning = Reasoning(effort=reasoning_effort, summary="auto")
292
+ new_reasoning = Reasoning(effort=reasoning_effort, summary=settings.reasoning_summary)
272
293
  updated_settings = ModelSettings(
273
294
  include_usage=current_settings.include_usage,
274
295
  reasoning=new_reasoning,
@@ -496,8 +517,9 @@ class VibecoreApp(App):
496
517
  for welcome in main_scroll.query("Welcome"):
497
518
  welcome.remove()
498
519
 
499
- # Add welcome widget back
500
- await main_scroll.mount(Welcome())
520
+ # Add welcome widget back if show_welcome is True
521
+ if self.show_welcome:
522
+ await main_scroll.mount(Welcome())
501
523
 
502
524
  # Show system message to confirm the clear operation
503
525
  system_message = SystemMessage(f"✨ Session cleared! Started new session: {new_session_id}")
@@ -4,9 +4,10 @@ import os
4
4
  from pathlib import Path
5
5
  from typing import Literal
6
6
 
7
- from agents import Model, OpenAIChatCompletionsModel
7
+ from agents import Model, ModelSettings, OpenAIChatCompletionsModel
8
8
  from agents.models.multi_provider import MultiProvider
9
- from pydantic import BaseModel, Field
9
+ from openai.types import Reasoning
10
+ from pydantic import BaseModel, Field, field_validator
10
11
  from pydantic_settings import BaseSettings, PydanticBaseSettingsSource, SettingsConfigDict, YamlConfigSettingsSource
11
12
 
12
13
  from vibecore.models import AnthropicModel
@@ -92,9 +93,10 @@ class Settings(BaseSettings):
92
93
  default_model: str = Field(
93
94
  # default="o3",
94
95
  # default="gpt-4.1",
96
+ default="gpt-5",
95
97
  # default="qwen3-30b-a3b-mlx@8bit",
96
98
  # default="mistralai/devstral-small-2507",
97
- default="anthropic/claude-sonnet-4-20250514",
99
+ # default="anthropic/claude-sonnet-4-20250514",
98
100
  # default="anthropic/claude-3-5-haiku-20241022",
99
101
  # default="litellm/deepseek/deepseek-chat",
100
102
  description="Default model to use for agents (e.g., 'gpt-4.1', 'o3-mini', 'anthropic/claude-sonnet-4')",
@@ -109,6 +111,18 @@ class Settings(BaseSettings):
109
111
  default=None,
110
112
  description="Default reasoning effort level for agents (null, 'minimal', 'low', 'medium', 'high')",
111
113
  )
114
+ reasoning_summary: Literal["auto", "concise", "detailed"] | None = Field(
115
+ default="auto",
116
+ description="Reasoning summary mode ('auto', 'concise', 'detailed', or 'off')",
117
+ )
118
+
119
+ @field_validator("reasoning_summary", mode="before")
120
+ @classmethod
121
+ def validate_reasoning_summary(cls, v):
122
+ """Convert string 'null' to None for reasoning_summary field."""
123
+ if v == "off" or v == "":
124
+ return None
125
+ return v
112
126
 
113
127
  # Session configuration
114
128
  session: SessionSettings = Field(
@@ -138,6 +152,17 @@ class Settings(BaseSettings):
138
152
  return OpenAIChatCompletionsModel(self.default_model, openai_provider._get_client())
139
153
  return self.default_model
140
154
 
155
+ @property
156
+ def default_model_settings(self) -> ModelSettings:
157
+ """Get the default model settings."""
158
+ return ModelSettings(
159
+ include_usage=True,
160
+ reasoning=Reasoning(
161
+ summary=self.reasoning_summary,
162
+ effort=self.reasoning_effort,
163
+ ),
164
+ )
165
+
141
166
  @classmethod
142
167
  def settings_customise_sources(
143
168
  cls,
@@ -7,7 +7,7 @@ from agents import (
7
7
  )
8
8
  from textual import log
9
9
 
10
- from vibecore.agents.task_agent import create_task_agent
10
+ from vibecore.agents.task import create_task_agent
11
11
  from vibecore.context import VibecoreContext
12
12
  from vibecore.settings import settings
13
13
 
@@ -0,0 +1,7 @@
1
+ """Webfetch tool for fetching and converting web content to Markdown."""
2
+
3
+ from .executor import fetch_url
4
+ from .models import WebFetchParams
5
+ from .tools import webfetch
6
+
7
+ __all__ = ["WebFetchParams", "fetch_url", "webfetch"]