Skip to content

Commit 610fa88

Browse files
committed
Release ai agent v0.1.0
1 parent dd85946 commit 610fa88

5 files changed

Lines changed: 208 additions & 59 deletions

File tree

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ option(VIX_AI_AGENT_FETCH_JSON "Auto-fetch vix::json if missing" ON)
7272
option(VIX_AI_AGENT_FETCH_FS "Auto-fetch vix::fs if missing" ON)
7373
option(VIX_AI_AGENT_FETCH_PATH "Auto-fetch vix::path if missing" ON)
7474
option(VIX_AI_AGENT_FETCH_PROCESS "Auto-fetch vix::process if missing" ON)
75+
option(VIX_AI_AGENT_FETCH_NET "Auto-fetch vix::net if missing" ON)
7576
option(VIX_AI_AGENT_FETCH_ENV "Auto-fetch vix::env if missing" ON)
7677
option(VIX_AI_AGENT_FETCH_TIME "Auto-fetch vix::time if missing" ON)
7778
option(VIX_AI_AGENT_FETCH_CRYPTO "Auto-fetch vix::crypto if missing" ON)
@@ -100,6 +101,7 @@ if(DEFINED VIX_UMBRELLA_BUILD AND VIX_UMBRELLA_BUILD)
100101
set(VIX_AI_AGENT_FETCH_FS OFF CACHE BOOL "Auto-fetch vix::fs if missing" FORCE)
101102
set(VIX_AI_AGENT_FETCH_PATH OFF CACHE BOOL "Auto-fetch vix::path if missing" FORCE)
102103
set(VIX_AI_AGENT_FETCH_PROCESS OFF CACHE BOOL "Auto-fetch vix::process if missing" FORCE)
104+
set(VIX_AI_AGENT_FETCH_NET OFF CACHE BOOL "Auto-fetch vix::net if missing" FORCE)
103105
set(VIX_AI_AGENT_FETCH_ENV OFF CACHE BOOL "Auto-fetch vix::env if missing" FORCE)
104106
set(VIX_AI_AGENT_FETCH_TIME OFF CACHE BOOL "Auto-fetch vix::time if missing" FORCE)
105107
set(VIX_AI_AGENT_FETCH_CRYPTO OFF CACHE BOOL "Auto-fetch vix::crypto if missing" FORCE)
@@ -208,6 +210,15 @@ vix_ai_agent_require_dependency(
208210
v0.1.0
209211
)
210212

213+
vix_ai_agent_require_dependency(
214+
vix::net
215+
vix_net
216+
net
217+
VIX_AI_AGENT_FETCH_NET
218+
https://github.com/vixcpp/net.git
219+
v0.1.0
220+
)
221+
211222
vix_ai_agent_require_dependency(
212223
vix::env
213224
vix_env
@@ -306,6 +317,7 @@ target_link_libraries(vix_ai_agent
306317
vix::fs
307318
vix::path
308319
vix::process
320+
vix::net
309321
vix::env
310322
vix::time
311323
vix::crypto
@@ -469,6 +481,7 @@ message(STATUS "Json target: vix::json")
469481
message(STATUS "Fs target: vix::fs")
470482
message(STATUS "Path target: vix::path")
471483
message(STATUS "Process target: vix::process")
484+
message(STATUS "Net target: vix::net")
472485
message(STATUS "Env target: vix::env")
473486
message(STATUS "Time target: vix::time")
474487
message(STATUS "Crypto target: vix::crypto")

README.md

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Agent::run(...)
113113

114114
Current internal features:
115115

116-
- local Ollama provider
116+
- local Ollama provider through `vix::net::http`
117117
- model provider abstraction
118118
- workspace scanner
119119
- safe file reader
@@ -802,14 +802,14 @@ From the module directory:
802802

803803
```bash
804804
cd ~/vixcpp/vix/modules/agent
805-
cmake --build build-ninja
805+
vix build --build-target all -v
806806
```
807807

808808
From the Vix root:
809809

810810
```bash
811811
cd ~/vixcpp/vix
812-
cmake --build build-ninja
812+
vix build --build-target all -v
813813
```
814814

815815
## Example with Ollama
@@ -860,19 +860,5 @@ int main()
860860
}
861861
```
862862

863-
## Roadmap
864-
865-
Planned improvements:
866-
867-
- replace temporary curl usage in `OllamaProvider` with a native Vix HTTP client
868-
- enforce real process timeouts once `vix::process` supports command timeout
869-
- add streaming responses
870-
- add structured tool schemas
871-
- add safe file write support
872-
- add richer run replay support
873-
- add memory store for long-term agent context
874-
- add more local providers
875-
- add OpenAI-compatible provider later
876-
- expose stable helper APIs only after `Agent::run(...)` is fully settled
877-
878863
## License
864+
MIT

cmake/vix_ai_agentConfig.cmake.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ find_dependency(vix_json CONFIG)
77
find_dependency(vix_fs CONFIG)
88
find_dependency(vix_path CONFIG)
99
find_dependency(vix_process CONFIG)
10+
find_dependency(vix_net CONFIG)
1011
find_dependency(vix_env CONFIG)
1112
find_dependency(vix_time CONFIG)
1213
find_dependency(vix_crypto CONFIG)
1314
find_dependency(vix_log CONFIG)
1415
find_dependency(vix_cache CONFIG)
1516

1617
include("${CMAKE_CURRENT_LIST_DIR}/vix_ai_agentTargets.cmake")
18+
19+
check_required_components(vix_ai_agent)

include/vix/ai/agent/model/OllamaProvider.hpp

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
#ifndef VIX_AI_AGENT_MODEL_OLLAMAPROVIDER_HPP
1717
#define VIX_AI_AGENT_MODEL_OLLAMAPROVIDER_HPP
1818

19+
#include <memory>
1920
#include <string>
2021
#include <string_view>
2122

2223
#include <vix/ai/agent/AgentConfig.hpp>
2324
#include <vix/ai/agent/model/ModelProvider.hpp>
2425
#include <vix/ai/agent/model/ModelRequest.hpp>
2526
#include <vix/ai/agent/model/ModelResponse.hpp>
27+
#include <vix/net/http/Client.hpp>
2628

2729
namespace vix::ai::agent
2830
{
@@ -35,25 +37,62 @@ namespace vix::ai::agent
3537
* http://127.0.0.1:11434
3638
*
3739
* The provider is local-first and suitable for offline developer workflows.
40+
*
41+
* The HTTP transport is abstracted through vix::net::http::Client.
42+
* By default, the provider creates a curl-backed HTTP client, but callers
43+
* may inject another implementation later without changing the provider API.
3844
*/
3945
class OllamaProvider final : public ModelProvider
4046
{
4147
public:
4248
/**
4349
* @brief Construct an Ollama provider from AgentConfig.
4450
*
51+
* The endpoint and default model are read from the agent configuration.
52+
* A default HTTP client is created automatically when none is injected.
53+
*
4554
* @param config Agent configuration.
4655
*/
4756
explicit OllamaProvider(AgentConfig config);
4857

4958
/**
5059
* @brief Construct an Ollama provider from endpoint and default model.
5160
*
61+
* A default HTTP client is created automatically when none is injected.
62+
*
5263
* @param endpoint Ollama server endpoint.
5364
* @param default_model Default model name.
5465
*/
5566
OllamaProvider(std::string endpoint, std::string default_model);
5667

68+
/**
69+
* @brief Construct an Ollama provider from AgentConfig and HTTP client.
70+
*
71+
* This overload allows tests or advanced users to inject a custom HTTP
72+
* client implementation.
73+
*
74+
* @param config Agent configuration.
75+
* @param http_client HTTP client used to send Ollama requests.
76+
*/
77+
OllamaProvider(
78+
AgentConfig config,
79+
std::shared_ptr<vix::net::http::Client> http_client);
80+
81+
/**
82+
* @brief Construct an Ollama provider from endpoint, model and HTTP client.
83+
*
84+
* This overload allows the provider to use a custom HTTP transport while
85+
* keeping the provider logic independent from the concrete backend.
86+
*
87+
* @param endpoint Ollama server endpoint.
88+
* @param default_model Default model name.
89+
* @param http_client HTTP client used to send Ollama requests.
90+
*/
91+
OllamaProvider(
92+
std::string endpoint,
93+
std::string default_model,
94+
std::shared_ptr<vix::net::http::Client> http_client);
95+
5796
/**
5897
* @brief Return provider name.
5998
*/
@@ -91,6 +130,23 @@ namespace vix::ai::agent
91130
*/
92131
[[nodiscard]] const std::string &default_model() const noexcept;
93132

133+
/**
134+
* @brief Return the HTTP client used by the provider.
135+
*/
136+
[[nodiscard]] std::shared_ptr<vix::net::http::Client>
137+
http_client() const noexcept;
138+
139+
/**
140+
* @brief Replace the HTTP client used by the provider.
141+
*
142+
* If the provided client is null, the provider recreates its default
143+
* curl-backed HTTP client.
144+
*
145+
* @param client HTTP client implementation.
146+
*/
147+
void set_http_client(
148+
std::shared_ptr<vix::net::http::Client> client);
149+
94150
private:
95151
/**
96152
* @brief Build the effective model name for a request.
@@ -104,10 +160,16 @@ namespace vix::ai::agent
104160
[[nodiscard]] std::string effective_prompt(
105161
const ModelRequest &request) const;
106162

163+
/**
164+
* @brief Ensure the provider has a usable HTTP client.
165+
*/
166+
void ensure_http_client();
167+
107168
private:
108169
std::string endpoint_{"http://127.0.0.1:11434"};
109170
std::string default_model_{"llama3"};
110171
AgentConfig config_{};
172+
std::shared_ptr<vix::net::http::Client> http_client_{};
111173
};
112174

113175
} // namespace vix::ai::agent

0 commit comments

Comments
 (0)