Skip to content

Commit 04302cc

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents e1d0d84 + 6325f2b commit 04302cc

File tree

6 files changed

+226
-51
lines changed

6 files changed

+226
-51
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,6 @@ AgentStack is open source software [licensed as MIT](LICENSE).
145145

146146
## How to Contribute
147147

148-
AgentStack is a new project built by passionate AI agent developers! We'd love help making this tool better. Easy first issues are available, create new issues with feature ideas, or chat with us on our [Discord](https://discord.gg/JdWkh9tgTQ).
148+
AgentStack is a new project built by passionate AI agent developers! We'd love help making this tool better. Easy first issues are available, create new issues with feature ideas, or chat with us on our [Discord](https://discord.gg/JdWkh9tgTQ). Make sure you read our contributor documentation to familiarize yourself with the project at [How to Contribute](https://docs.agentstack.sh/contributing/how-to-contribute).
149149

150150
If you are an Agent Tool developer, feel free to create an issue or even a PR to add your tool to AgentStack.

agentstack/cli/init.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,21 @@ def require_uv():
3838
def select_template(slug_name: str, framework: Optional[str] = None) -> TemplateConfig:
3939
"""Let the user select a template from the ones available."""
4040
templates: list[TemplateConfig] = get_all_templates()
41-
template_names = [shorten(f"⚡️ {t.name} - {t.description}", 80) for t in templates]
4241

43-
empty_msg = "🆕 Empty Project"
44-
template_choice = inquirer.list_input(
42+
EMPTY = 'empty'
43+
choices = [
44+
(EMPTY, "🆕 Empty Project"),
45+
]
46+
for template in templates:
47+
choices.append((template.name, shorten(f"⚡️ {template.name} - {template.description}", 80)))
48+
49+
choice = inquirer.list_input(
4550
message="Do you want to start with a template?",
46-
choices=[empty_msg] + template_names,
51+
choices=[c[1] for c in choices],
4752
)
48-
template_name = template_choice.split("⚡️ ")[1].split(" - ")[0]
53+
template_name = next(c[0] for c in choices if c[1] == choice)
4954

50-
if template_name == empty_msg:
55+
if template_name == EMPTY:
5156
return TemplateConfig(
5257
name=slug_name,
5358
description="",

docs/contributing/how-to-contribute.mdx

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,36 @@ The best place to engage in conversation about your contribution is in the Issue
1515

1616
## Setup
1717

18-
1. Clone the repo
19-
2. `poetry install`
20-
3. `pip install -e .`
18+
1. `git clone https://github.com/AgentOps-AI/AgentStack.git`
19+
`cd AgentStack`
20+
2. `uv pip install -e ".[dev,test]`
2121
- This will install the CLI locally and in editable mode so you can use `agentstack <command>` to test your latest changes
22+
- Note that after you initialize a project, it will install it's own version of `agentstack` in the project's
23+
virtual environment. To use your local version, run `uv pip install -e "../AgentStack/.[<framework>]"` to get
24+
your development version inside of the project, too.
2225

2326
## Project Structure
24-
TODO
27+
28+
A detailed overview of the project structure is available at [Project Structure](https://docs.agentstack.sh/contributing/project-structure).
29+
30+
31+
## Before Making a Pull Request
32+
33+
Make sure tests pass, type checking is correct, and ensure your code is formatted correctly.
34+
35+
1. `tox -m quick`
36+
- This will run tests for Python version 3.12 only. You can run tests on all supported versions with `tox`.
37+
2. `mypy agentstack`
38+
- Please resolve all type checking errors before marking your PR as ready for review.
39+
3. `ruff`
40+
- We use `ruff` to ensure consistency in our codebase.
2541

2642
## Tests
27-
HAHAHAHAHAHAHA good one (pls help 🥺)
43+
44+
We're actively working toward increasing our test coverage. Make sure to review the `codecov` output of your
45+
tests to ensure your contribution is well tested. We use `tox` to run our tests, which sets up individual
46+
environments for each framework and Python version we support. Tests are run when a PR is pushed to, and
47+
contributions without passing tests will not be merged.
48+
49+
You can test a specific Python version and framework by running: `tox -e py312-<framework>`, but keep in mind
50+
that the coverage report will be incomplete.

docs/contributing/project-structure.mdx

Lines changed: 179 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ the user's project, while only ever importing the single keyword.
5656
## `agentstack.conf.PATH`
5757
`<pathlib.Path>` This is the path to the current project directory.
5858

59+
## `@agentstack.agent`
60+
`<callable>` This is a decorator that marks a method as belonging to an Agent.
61+
62+
## `@agentstack.task`
63+
`<callable>` This is a decorator that marks a method as belonging to a Task.
64+
5965
## `agentstack.tools[<tool_name>]`
6066
`<callable>` This is a tool that is available to agents in the project. Tools
6167
are implementations from useful third party libraries that are provided to Agents
@@ -68,14 +74,36 @@ use including docstrings and type hints for argument and return types.
6874
`<str>` This is the name of the current framework ie. `"crewai"`.
6975

7076
## `agentstack.get_inputs()`
71-
`<dict[str, str]>` This function returns the inputs for a project. These are the
77+
`<dict[str, str]>` Returns the inputs for a project. These are the
7278
variables that can be used to configure tasks in the project and are stored in the
7379
`inputs.yaml` file inside the project directory.
7480

7581
## `agentstack.get_tags()`
76-
`<List[str]>` This function returns the tags for a project. These are strings
82+
`<List[str]>` Returns the tags for a project. These are strings
7783
that help identify the workflow in an `AgentOps` observability context.
7884

85+
## `agentstack.get_agent(name: str)`
86+
`<AgentConfig>` Returns the configuration for an agent in the
87+
project. Content of this object originates from the project's `agents.yaml` file.
88+
89+
## `agentstack.get_all_agents()`
90+
`<List[AgentConfig]>` Returns a list of all the agents in the
91+
project.
92+
93+
## `agentstack.get_all_agent_names()`
94+
`<List[str]>` Returns a list of all the agent names in the project.
95+
96+
## `agentstack.get_task(name: str)`
97+
`<TaskConfig>` Returns the configuration for a task in the project. Content of this object originates from the project's `tasks.yaml` file.
98+
99+
## `agentstack.get_all_tasks()`
100+
`<List[TaskConfig]>` Returns a list of all the tasks in the
101+
project.
102+
103+
## `agentstack.get_all_task_names()`
104+
`<List[str]>` Returns a list of all the task names in the project.
105+
106+
79107
# Core
80108
These namespaces occupy the root of `agentstack` and are shared across all
81109
project & frameworks. Methods from these products are generally candidates for
@@ -86,31 +114,89 @@ availability in the public API for use within a project.
86114
Agents are the actual personalities that accomplish work. We provide tools for
87115
interacting with the `agents.yaml` configuration file in this package.
88116

89-
### `AgentConfig.__init__(name: str)`
90-
`<AgentConfig>` Initialize an `AgentConfig` to read and modify `agents.yaml` in
91-
the current project.
117+
### `AgentConfig`
118+
`<AgentConfig>` This class represents an agent in the project. It is used to
119+
read and modify the `agents.yaml` file.
120+
121+
### Properties
122+
- `name` `<str>` The name of the agent.
123+
- `role` `<str>` The role prompt for the agent.
124+
- `goal` `<str>` The goal prompt for the agent.
125+
- `backstory` `<str>` The backstory prompt for the agent.
126+
- `prompt` `<str>` The full prompt for the agent (formatted role + goal + backstory).
127+
- `llm` `<str>` The LLM to use for the agent (ie. `"openai/gpt-4o"`).
128+
- `provider` `<str>` The provider to use for the agent (ie. `"openai"`).
129+
- `model` `<str>` The model to use for the agent (ie. `"gpt-4o"`).
130+
131+
### Read/Write
132+
Instantiate `AgentConfig` with the name of the agent to read the relevant part
133+
from the user project's `agents.yaml` file.
134+
135+
```python
136+
agent_config = AgentConfig("agent_name")
137+
agent_config.role
138+
```
139+
140+
Use the `AgentConfig` as a context manager to modify and write the relevant part
141+
of the user project's `agents.yaml` file.
142+
143+
```python
144+
with AgentConfig("agent_name") as agent_config:
145+
agent_config.role = "You are a friendly assistant."
146+
```
147+
148+
### `agents.get_agent(name: str)`
149+
`<AgentConfig>` Shortcut to return an `AgentConfig` object for a given agent name.
92150

93151
### `agents.get_all_agent_names()`
94-
`<List[str]>` This function returns a list of all the agent names in the project.
152+
`<List[str]>` Returns a list of all the agent names in the project.
95153

96154
### `agents.get_all_agents()`
97-
`<List[AgentConfig]>` This function returns a list of all the agents in the project.
155+
`<List[AgentConfig]>` Returns a list of all the agents in the project.
98156

99157

100158
## `tasks`
101159
Tasks are the individual units of work that an Agent can perform. `agents` will
102160
use the `tools` they have available to accomplish `tasks`. We provide tools for
103161
interacting with the `tasks.yaml` configuration file in this package.
104162

105-
### `TaskConfig.__init__(name: str)`
163+
### `TaskConfig`
164+
`<TaskConfig>` This class represents a task in the project. It is used to
165+
read and modify the `tasks.yaml` file.
166+
167+
#### Properties
168+
- `name` `<str>` The name of the task.
169+
- `description` `<str>` The description prompt for the task.
170+
- `expected_output` `<str>` The expected output prompt of the task.
171+
- `prompt` `<str>` The full prompt for the task (formatted description + expected output).
172+
- `agent` `<str>` The agent name to use for the task.
173+
174+
#### Read/Write
175+
Instantiate `TaskConfig` with the name of the task to read the relevant part
176+
from the user project's `tasks.yaml` file.
177+
178+
```python
179+
task_config = TaskConfig("task_name")
180+
task_config.description
181+
```
182+
183+
Use the `TaskConfig` as a context manager to modify and write the relevant part
184+
of the user project's `tasks.yaml` file.
185+
186+
```python
187+
with TaskConfig("task_name") as task_config:
188+
task_config.description = "How many R's are in strawberry."
189+
```
190+
191+
### `tasks.get_task(name: str)`
106192
`<TaskConfig>` Initialize a `TaskConfig` to read and modify `tasks.yaml` in the
107193
current project.
108194

109195
### `tasks.get_all_task_names()`
110-
`<List[str]>` This function returns a list of all the task names in the project.
196+
`<List[str]>` Returns a list of all the task names in the project.
111197

112198
### `tasks.get_all_tasks()`
113-
`<List[TaskConfig]>` This function returns a list of all the tasks in the project.
199+
`<List[TaskConfig]>` Returns a list of all the tasks in the project.
114200

115201

116202
## `inputs`
@@ -152,25 +238,26 @@ it's content to the current version.
152238
with the templates used by `generation`. Move existing templates to be part of
153239
the generation package.
154240

241+
### `TemplateConfig.from_user_input(identifier: str)`
242+
`<TemplateConfig>` Returns a `TemplateConfig` object for either a URL, file path,
243+
or builtin template name.
244+
155245
### `TemplateConfig.from_template_name(name: str)`
156-
`<TemplateConfig>` This function returns a `TemplateConfig` object for a given
157-
template name.
246+
`<TemplateConfig>` Returns a `TemplateConfig` object for a given template name.
158247

159248
### `TemplateConfig.from_file(path: Path)`
160-
`<TemplateConfig>` This function returns a `TemplateConfig` object for a given
161-
template file path.
249+
`<TemplateConfig>` Returns a `TemplateConfig` object for a given template file path.
162250

163251
### `TemplateConfig.from_url(url: str)`
164-
`<TemplateConfig>` This function returns a `TemplateConfig` object after loading
165-
data from a URL.
252+
`<TemplateConfig>` Returns a `TemplateConfig` object after loading data from a URL.
166253

167254
### `TemplateConfig.from_json(data: dict)`
168-
`<TemplateConfig>` This function returns a `TemplateConfig` object from a parsed
169-
JSON object.
255+
`<TemplateConfig>` Returns a `TemplateConfig` object from a parsed JSON object.
170256

171257
### `TemplateConfig.write_to_file(filename: Path)`
172258
`<None>` Instance method to serialize and write the `TemplateConfig` data to a file.
173259

260+
174261
### `templates.get_all_template_paths()`
175262
`<List[Path]>` This function returns a list of all the template paths in the project.
176263

@@ -182,20 +269,70 @@ JSON object.
182269
project as `TemplateConfig` objects.
183270

184271

272+
## `graph`
273+
We implement basic abstractions for graphing the relationships between `agents` and `tasks` in a project.
274+
275+
185276
## `conf`
186277
Configuration data for the AgentStack application. This includes the path to the
187278
current project directory and the name of the current framework.
188279

189-
### `agentstack.json`
280+
### `DEBUG`
281+
`<bool>` This is a flag that indicates whether the application is in debug mode.
282+
283+
### `set_debug(debug: bool)`
284+
`<None>` This function sets the debug mode for the application.
285+
286+
### `PATH`
287+
`<pathlib.Path>` This is the path to the current project directory. It may change
288+
during program execution, so always use `conf.PATH` to reference the global value.
289+
290+
### `set_path(path: Path)`
291+
`<None>` This function sets the path to the current project directory.
292+
293+
### `ConfigFile`
190294
This is the configuration file for a user's project. It contains the project's
191-
configuration and metadata. It can be read and modified directly by accessing
192-
`conf.ConfigFile`.
295+
configuration and metadata and is read from `agentstack.json` in the user's
296+
project directory.
297+
298+
#### Read/Write
299+
Instantiate `ConfigFile` to read the relevant part from the user project's
300+
`agentstack.json` file.
301+
302+
```python
303+
config = ConfigFile()
304+
config.framework
305+
```
306+
307+
Use the `ConfigFile` as a context manager to modify and write the relevant part
308+
of the user project's `agentstack.json` file.
309+
310+
```python
311+
with ConfigFile() as config:
312+
config.framework = "crewai"
313+
```
193314

194315
## `log`
195-
AgentStack provides a robust logging interface for tracking and debugging
196-
agentic workflows. Runs are separated into separate named files for easy tracking
197-
and have standard conventions for outputs from different parts of the system
198-
for parsing.
316+
AgentStack logs to `stdout/stderr` if available, and to `agentstack.log` in the
317+
current project directory, if it exists.
318+
319+
### Log Handlers
320+
`debug`, `tool_use`, `thinking`, `info`, `notify`, `success`, `response`,
321+
`warning` and `error` are available as functions to log messages at the
322+
appropriate level.
323+
324+
```python
325+
log.debug("This is a debug message.")
326+
```
327+
328+
### `set_stdout(stream: IO)`
329+
`<None>` This function sets the `stdout` stream for the application. To disable
330+
logging to `stdout`, set the stream to a new `io.StringIO()` object.
331+
332+
### `set_stderr(stream: IO)`
333+
`<None>` This function sets the `stderr` stream for the application. To disable
334+
logging to `stderr`, set the stream to a new `io.StringIO()` object.
335+
199336

200337
## `serve`
201338
Completed agents can be deployed to the AgentStack cloud service with a single
@@ -208,8 +345,8 @@ agentic workflows.
208345
The command line interface for `agentstack` is provided in this package. Outside
209346
of `main.py` all logic relating to the command line interface resides here.
210347

211-
> TODO: Code from other parts of the application should always throw exceptions
212-
and leave the CLI to handle error messaging and control flow.
348+
Typically, functionality inside the `cli` package handles user input and
349+
output, error messaging and status updates.
213350

214351
## `packaging`
215352
We manage the virtual environment and dependencies for tools that are added to
@@ -249,11 +386,13 @@ are imported into the project and available for use by `agents`.
249386
## `generation.files`
250387
This is code that creates and modifies the `files` in a user's project.
251388

252-
### `.env`
389+
### `EnvFile`
253390
This is the environment file for a user's project. It contains the project's
254391
environment variables. We dynamically modify this file to include relevant
255392
variables to support `tools` that are used in the project.
256393

394+
### `ProjectFile`
395+
257396
## `generation.asttools`
258397
Since we're interacting with generated code, we provide a shared toolkit for
259398
common AST operations.
@@ -270,15 +409,21 @@ This is the base protocol for all framework implementations– all implementatio
270409
must implement this protocol.
271410

272411
## `frameworks.crewai`
273-
This is the implementation for the CrewAI framework. CrewAI is a framework for
274-
creating and managing AI agents. All code related specifically to CrewAI is
275-
contained in this package.
412+
This is the implementation for the CrewAI framework. All code related specifically
413+
to CrewAI is contained in this package.
276414

277415
## `frameworks.langgraph`
278-
> TODO Add [LangGraph](https://langchain-ai.github.io/langgraph/) as a framework.
416+
This is the implementation for the LangGraph framework. All code related specifically
417+
to LangGraph is contained in this package.
279418

280419
## `frameworks.openai_swarms`
281-
> TODO: Add OpenAI Swarms as a framework.
420+
This is the implementation for the OpenAI Swarms framework. All code related specifically
421+
to OpenAI Swarms is contained in this package.
422+
423+
## `frameworks.llamaindex`
424+
. TODO : Add [LlamaIndex](https://docs.llamaindex.ai/en/stable/examples/agent/custom_agent/)
425+
as a framework.
282426

283427
## `frameworks.agency_swarm`
284-
> TODO: Add [VRSEN Agency Swarm](https://github.com/VRSEN/agency-swarm?tab=readme-ov-file) as a framework.
428+
> TODO: Add [VRSEN Agency Swarm](https://github.com/VRSEN/agency-swarm?tab=readme-ov-file)
429+
as a framework.

0 commit comments

Comments
 (0)