Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions examples/context-engineering/context-engineering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
#include <functional>
#include <iostream>
#include <string>

#ifdef _WIN32
#include <io.h>
#define isatty _isatty
#else
#include <unistd.h>
#endif // _WIN32

static constexpr size_t DEFAULT_MAX_TOOL_CALLS = 1;

Expand Down
1 change: 0 additions & 1 deletion examples/memory/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <iostream>
#include <map>
#include <string>
#include <unistd.h>

using agent_cpp::json;

Expand Down
1 change: 0 additions & 1 deletion examples/multi-agent/multi-agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <iostream>
#include <memory>
#include <string>
#include <unistd.h>

using agent_cpp::json;

Expand Down
12 changes: 11 additions & 1 deletion examples/shared/chat_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
#include <cstdio>
#include <iostream>
#include <string>
#include <unistd.h>
#include <vector>

#ifdef _WIN32
#include <io.h>
#define isatty _isatty
#else
#include <unistd.h>
#endif // _WIN32

// Run an interactive chat loop with the given agent.
// Reads user input from stdin and prints agent responses to stdout.
// The loop continues until the user enters an empty line.
Expand Down Expand Up @@ -48,3 +54,7 @@ run_chat_loop(agent_cpp::Agent& agent)

printf("\n👋 Goodbye!\n");
}

#ifdef _WIN32
#undef isatty
#endif // _WIN32
10 changes: 10 additions & 0 deletions examples/shared/logging_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
#include "tool_result.h"
#include <cstdio>
#include <string>

#ifdef _WIN32
#include <io.h>
#define isatty _isatty
#else
#include <unistd.h>
#endif // _WIN32

// Logging callback to display tool execution information.
// Shared across examples to provide consistent tool call logging.
Expand Down Expand Up @@ -47,3 +53,7 @@ class LoggingCallback : public agent_cpp::Callback
}
}
};

#ifdef _WIN32
#undef isatty
#endif // _WIN32
9 changes: 9 additions & 0 deletions examples/shell/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@
#include <iostream>
#include <memory>
#include <string>

#ifdef _WIN32
#include <io.h>
#include <stdio.h>
#define isatty _isatty
#define popen _popen
#define pclose _pclose
#else
#include <unistd.h>
#endif // _WIN32

using agent_cpp::json;
using agent_cpp::ToolExecutionSkipped;
Expand Down